CommonMapper.xml 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.gree.mall.manager.commonmapper.CommonMapper">
  4. <select id="queryChargingStandrdList" resultType="com.gree.mall.manager.bean.charging.ChargingStandardBean">
  5. select
  6. a.* ,
  7. b.name as 'typeName',
  8. c.brand_name,
  9. (select name from goods_category where type=2 and category_id = a.one_category_id) as 'oneCategoryName',
  10. (select name from goods_category where type=2 and category_id = a.two_category_id) as 'twoCategoryName'
  11. from charging_standard a
  12. left join charging_standard_type b on a.charging_standard_type_id = b.id
  13. join brand c on c.id = a.brand_id
  14. where 1=1
  15. <if test="companyWechatId != null and companyWechatId !=''">
  16. and a.company_wechat_id=#{companyWechatId}
  17. </if>
  18. <if test="id != null and id !=''">
  19. and a.id = #{id}
  20. </if>
  21. <if test="type != null">
  22. and a.type = #{type}
  23. </if>
  24. <if test="status != null">
  25. and a.status=#{status}
  26. </if>
  27. <if test="brandId != null and brandId != ''">
  28. and a.brand_id=#{brandId}
  29. </if>
  30. <if test="oneCategoryId != null and oneCategoryId !=''">
  31. and a.one_category_id = #{oneCategoryId}
  32. </if>
  33. <if test="twoCategoryId != null and twoCategoryId !=''">
  34. and a.two_category_id = #{twoCategoryId}
  35. </if>
  36. <if test="content1 != null and content1 !=''">
  37. and a.content1 like concat('%',#{content1},'%')
  38. </if>
  39. order by a.create_time desc
  40. </select>
  41. <select id="chargingStandardTypeList" resultType="com.gree.mall.manager.bean.listvo.ChargingStandardTypeVO">
  42. select
  43. ${ex.selected}
  44. from charging_standard_type a
  45. ${ex.query}
  46. ORDER BY a.create_time DESC
  47. </select>
  48. <select id="chargingStandardList" resultType="com.gree.mall.manager.bean.listvo.ChargingStandardVO">
  49. select
  50. ${ex.selected},
  51. b.name 'chargingStandardTypeName',
  52. c.name 'oneCategoryName',
  53. d.name 'twoCategoryName'
  54. from charging_standard a
  55. join charging_standard_type b on a.charging_standard_type_id=b.id
  56. left join goods_category c on c.category_id = a.one_category_id
  57. left join goods_category d on d.category_id = a.two_category_id
  58. join brand e on e.id = a.brand_id
  59. ${ex.query}
  60. and a.type = 1
  61. ORDER BY a.create_time DESC
  62. </select>
  63. <select id="chargingStandardList2" resultType="com.gree.mall.manager.bean.listvo.ChargingStandard2VO">
  64. select
  65. ${ex.selected},
  66. c.name 'oneCategoryName',
  67. d.name 'twoCategoryName'
  68. from charging_standard a
  69. join brand b on b.id = a.brand_id
  70. left join goods_category c on c.category_id = a.one_category_id
  71. left join goods_category d on d.category_id = a.two_category_id
  72. ${ex.query}
  73. and a.type = 2
  74. ORDER BY a.create_time DESC
  75. </select>
  76. <select id="userList" resultType="com.gree.mall.manager.bean.listvo.UserVO">
  77. select
  78. ${ex.selected},
  79. c.name as 'websit_name',
  80. d.nick_name as 'slaveWorkerName'
  81. from user a
  82. join websit_user b on a.user_id = b.user_id
  83. join admin_websit c on c.websit_id = b.websit_id
  84. left join user d on b.slave_worker_id = d.user_id
  85. ${ex.query}
  86. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  87. AND c.websit_id IN
  88. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  89. #{item}
  90. </foreach>
  91. </if>
  92. <if test="ex.checkCert != null and ex.checkCert == true">
  93. AND b.examine_status IN ('OK', 'EXPIRED')
  94. </if>
  95. <if test="slaveWorkerList != null and slaveWorkerList.size > 0">
  96. AND a.user_id IN
  97. <foreach item="item" index="index" collection="slaveWorkerList" open="(" separator="," close=")">
  98. #{item}
  99. </foreach>
  100. </if>
  101. and a.apply_type='WORKER'
  102. <if test="ex.isGroupByWorkerId != null and ex.isGroupByWorkerId == true">
  103. GROUP BY a.worker_number
  104. </if>
  105. ORDER BY b.create_time DESC
  106. </select>
  107. <select id="userServiceList" resultType="com.gree.mall.manager.bean.listvo.User2VO">
  108. select
  109. ${ex.selected}
  110. from user a
  111. ${ex.query}
  112. and a.apply_type='SERVICE'
  113. ORDER BY FIELD(a.examine_status,'WAIT','OK','FAIL'),a.create_time DESC
  114. </select>
  115. <select id="userCustomerList" resultType="com.gree.mall.manager.bean.listvo.UserCustomerVO">
  116. select
  117. ${ex.selected},
  118. b.nick_name as 'serviceName',
  119. b.mobile as 'serviceMobile',
  120. c.nick_name as 'firstServiceName',
  121. c.mobile as 'firstServiceMobile'
  122. from user a
  123. left join user b on a.service_id = b.user_id
  124. left join user c on a.first_service_id = c.user_id
  125. ${ex.query}
  126. and a.type='GENERAL'
  127. ORDER BY a.create_time DESC
  128. </select>
  129. <select id="websitStockList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockVO">
  130. select
  131. ${ex.selected},
  132. d.category_name 'categoryName2'
  133. from websit_stock a
  134. join websit_goods b on a.goods_id = b.goods_id
  135. left join websit_goods_category c on b.parent_category_id = c.category_id
  136. left join websit_goods_category d on b.goods_category_id = d.category_id
  137. left join storage e on a.storage_id = e.storage_id
  138. ${ex.query}
  139. and a.goods_type='M'
  140. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  141. AND a.websit_id IN
  142. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  143. #{item}
  144. </foreach>
  145. </if>
  146. order by a.id desc
  147. </select>
  148. <select id="websitStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockPVO">
  149. select
  150. ${ex.selected}
  151. from websit_stock a
  152. join websit_goods b on a.goods_id = b.goods_code
  153. left join storage c on a.storage_id = c.storage_id
  154. ${ex.query}
  155. and a.goods_type='P'
  156. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  157. AND a.websit_id IN
  158. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  159. #{item}
  160. </foreach>
  161. </if>
  162. order by a.id desc
  163. </select>
  164. <select id="websitStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccVO">
  165. select
  166. ${ex.selected},
  167. d.category_name 'categoryName2'
  168. from websit_stock_acc a
  169. join websit_goods b on a.goods_id = b.goods_id
  170. left join websit_goods_category c on b.parent_category_id = c.category_id
  171. left join websit_goods_category d on b.goods_category_id = d.category_id
  172. left join storage e on a.storage_id = e.storage_id
  173. ${ex.query}
  174. and a.goods_type='M'
  175. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  176. AND a.websit_id IN
  177. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  178. #{item}
  179. </foreach>
  180. </if>
  181. order by a.id desc
  182. </select>
  183. <select id="websitStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccPVO">
  184. select
  185. ${ex.selected}
  186. from websit_stock_acc a
  187. join websit_goods b on a.goods_id = b.goods_code
  188. left join storage c on a.storage_id = c.storage_id
  189. ${ex.query}
  190. and a.goods_type='P'
  191. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  192. AND a.websit_id IN
  193. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  194. #{item}
  195. </foreach>
  196. </if>
  197. order by a.id desc
  198. </select>
  199. <select id="workerStockList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockVO">
  200. select
  201. ${ex.selected},
  202. d.category_name 'categoryName2'
  203. from worker_stock a
  204. join worker_goods b on a.goods_id = b.goods_id
  205. left join websit_goods_category c on b.parent_category_id = c.category_id
  206. left join websit_goods_category d on b.goods_category_id = d.category_id
  207. left join user e on e.id_card = a.identity
  208. ${ex.query}
  209. and a.goods_type='M'
  210. <if test="workers != null and workers.size > 0">
  211. AND (
  212. a.identity IN
  213. <foreach item="item" index="index" collection="workers" open="(" separator="," close=")">
  214. #{item}
  215. </foreach>
  216. )
  217. </if>
  218. order by a.id desc
  219. </select>
  220. <select id="workerStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccVO">
  221. select
  222. ${ex.selected},
  223. d.category_name 'categoryName2'
  224. from worker_stock_acc a
  225. join worker_goods b on a.goods_id = b.goods_id
  226. left join websit_goods_category c on b.parent_category_id = c.category_id
  227. left join websit_goods_category d on b.goods_category_id = d.category_id
  228. left join user e on e.id_card = a.identity
  229. ${ex.query}
  230. and a.goods_type='M'
  231. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  232. AND (
  233. a.websit_id IN
  234. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  235. #{item}
  236. </foreach>
  237. )
  238. </if>
  239. order by a.id desc
  240. </select>
  241. <select id="workerStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockPVO">
  242. select
  243. ${ex.selected}
  244. from worker_stock a
  245. join websit_goods b on a.goods_id = b.goods_code
  246. left join user e on e.worker_number = a.worker_id
  247. ${ex.query}
  248. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  249. AND (
  250. a.websit_id IN
  251. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  252. #{item}
  253. </foreach>
  254. )
  255. </if>
  256. and a.goods_type='P'
  257. order by a.id desc
  258. </select>
  259. <select id="workerStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccPVO">
  260. select
  261. ${ex.selected}
  262. from worker_stock_acc a
  263. join websit_goods b on a.goods_id = b.goods_code
  264. left join user e on e.worker_number = a.worker_id
  265. ${ex.query}
  266. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  267. AND (
  268. a.websit_id IN
  269. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  270. #{item}
  271. </foreach>
  272. )
  273. </if>
  274. and a.goods_type='P'
  275. order by a.id desc
  276. </select>
  277. <select id="amityList" resultType="com.gree.mall.manager.bean.common.AmityUrlVO">
  278. select
  279. a.*
  280. from amity_url a
  281. ${ex.query}
  282. AND a.del = 0
  283. <if test="ex.orderBy == null or ex.orderBy ==''">
  284. order by a.create_time desc
  285. </if>
  286. ${ex.orderBy}
  287. </select>
  288. <select id="orderSmallTypeList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderSmallTypeVO">
  289. select
  290. ${ex.selected}
  291. from order_small_type a
  292. ${ex.query}
  293. order by a.sort_num asc
  294. </select>
  295. <select id="orderBaseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO">
  296. select
  297. ${ex.selected}
  298. from pg_order_base a
  299. ${ex.query}
  300. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  301. and a.order_small_type = #{ex.orderSmallType}
  302. </if>
  303. <!-- <if test="ex.orderStatus != null and ex.orderStatus.key !='YCD'.toString() and ex.orderStatus.key !='DYY'.toString() and ex.orderStatus.key !='PJSQZ'.toString() and ex.orderStatus.key !='PJYDH'.toString() and ex.orderStatus.key !='PJYQX'.toString()">
  304. and a.order_status = #{ex.orderStatus.key}
  305. </if>-->
  306. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  307. and a.is_exception =1 and a.order_status NOT IN ('YWG','YWGO','YJS')
  308. </if>
  309. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  310. and a.appointment_time is null and a.order_status not in ('YWG','GCSZX','WDWG','YWGO','YQX','FWZT','YCGB',
  311. 'FWQX','FL','YJS','LRCD','DSHPG','CJ','YPD','DXSPD','DZBPG','DWDSPGP','DXSSPGP','DTJXSSPGP','DZBSPGP'
  312. )
  313. </if>
  314. <if test="ex.orderStatus != null and ex.orderStatus.key =='DJD'.toString()">
  315. and (a.is_meet =0 or a.order_status IN ('DJD')) and a.order_status not in ('YQX','FWQX','FL','FWZT','YCGB')
  316. </if>
  317. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJSQZ'.toString()">
  318. and a.id in(select order_base_id from websit_parts_apply where `status` = 'ING')
  319. </if>
  320. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYDH'.toString()">
  321. and a.id in(select order_base_id from websit_parts_apply where `status` = 'END')
  322. </if>
  323. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYQX'.toString()">
  324. and a.id in(select order_base_id from websit_parts_apply where `status` = 'CANCEL')
  325. </if>
  326. <if test="ex.isYb != null and ex.isYb == true">
  327. and a.pg_incre_item_id !=''
  328. </if>
  329. <if test="orderBaseId != null and orderBaseId.size > 0 ">
  330. AND
  331. a.id IN
  332. <foreach item="item" index="index" collection="orderBaseId" open="(" separator="," close=")">
  333. #{item}
  334. </foreach>
  335. </if>
  336. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 ">
  337. AND (
  338. a.websit_id IN
  339. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  340. #{item}
  341. </foreach>
  342. or
  343. a.create_websit_id IN
  344. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  345. #{item}
  346. </foreach>
  347. )
  348. </if>
  349. order by a.create_time desc,id desc
  350. </select>
  351. <select id="examineProjectConfigList"
  352. resultType="com.gree.mall.manager.bean.workorder.ExamineProjectConfigVO">
  353. SELECT
  354. ${ex.selected}
  355. FROM pg_examine_project_config a
  356. ${ex.query}
  357. AND a.del = 0
  358. <if test="ex.orderBy == null or ex.orderBy ==''">
  359. ORDER BY a.create_time DESC
  360. </if>
  361. </select>
  362. <select id="examineProjectList" resultType="com.gree.mall.manager.bean.workorder.ExamineProjectVO">
  363. SELECT
  364. ${ex.selected}
  365. FROM pg_examine_project a
  366. ${ex.query}
  367. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  368. AND
  369. a.websit_id IN
  370. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  371. #{item}
  372. </foreach>
  373. </if>
  374. <if test="ex.orderBy == null or ex.orderBy ==''">
  375. ORDER BY a.create_time DESC
  376. </if>
  377. </select>
  378. <select id="orderBaseAppraiseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseAppraiseVO">
  379. select
  380. ${ex.selected}
  381. from pg_order_base a
  382. ${ex.query}
  383. and a.appraise_status != 'N'
  384. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  385. AND (
  386. a.websit_id IN
  387. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  388. #{item}
  389. </foreach>
  390. )
  391. </if>
  392. order by a.id desc
  393. </select>
  394. <select id="installNormList" resultType="com.gree.mall.manager.bean.workorder.InstallSettleNormVO">
  395. SELECT
  396. ${ex.selected}
  397. FROM pg_settle_norm a
  398. ${ex.query}
  399. AND a.del = 0
  400. AND a.settle_norm_type = 'INSTALL'
  401. <if test="ex.orderBy == null or ex.orderBy ==''">
  402. ORDER BY a.type, a.parent_category_id, a.category_id
  403. </if>
  404. </select>
  405. <select id="repairNormList" resultType="com.gree.mall.manager.bean.workorder.RepairSettleNormVO">
  406. SELECT
  407. ${ex.selected}
  408. FROM pg_settle_norm a
  409. ${ex.query}
  410. AND a.del = 0
  411. AND a.settle_norm_type = 'REPAIR'
  412. <if test="ex.orderBy == null or ex.orderBy ==''">
  413. ORDER BY a.type, a.parent_category_id, a.category_id, a.label
  414. </if>
  415. </select>
  416. <select id="otherNormList" resultType="com.gree.mall.manager.bean.workorder.OtherSettleNormVO">
  417. SELECT
  418. ${ex.selected}
  419. FROM pg_settle_norm a
  420. ${ex.query}
  421. AND a.del = 0
  422. AND a.settle_norm_type = 'OTHER'
  423. <if test="ex.orderBy == null or ex.orderBy ==''">
  424. ORDER BY a.type, a.label
  425. </if>
  426. </select>
  427. <select id="settleOrderList" resultType="com.gree.mall.manager.bean.workorder.SettleOrderVO">
  428. SELECT
  429. ${ex.selected}
  430. FROM pg_settle_order a
  431. ${ex.query}
  432. <if test="websitIds != null and websitIds.size > 0">
  433. AND (
  434. a.websit_id IN
  435. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  436. #{item}
  437. </foreach>
  438. )
  439. </if>
  440. <if test="ex.orderBy == null or ex.orderBy ==''">
  441. ORDER BY a.create_time DESC
  442. </if>
  443. ${ex.orderBy}
  444. </select>
  445. <select id="settlePoolList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolVO">
  446. SELECT
  447. ${ex.selected}
  448. FROM pg_settle_pool a
  449. ${ex.query}
  450. <if test="websitIds != null and websitIds.size > 0">
  451. AND (
  452. a.websit_id IN
  453. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  454. #{item}
  455. </foreach>
  456. )
  457. </if>
  458. <if test="ex.orderBy == null or ex.orderBy ==''">
  459. ORDER BY a.pool_create_time DESC
  460. </if>
  461. ${ex.orderBy}
  462. </select>
  463. <select id="poolDetailList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolWorkerVO">
  464. SELECT
  465. a.*,
  466. b.id AS order_id,
  467. b.order_base_id,
  468. b.customer_name,
  469. b.customer_mobile,
  470. b.customer_address,
  471. b.order_status,
  472. b.order_create_time,
  473. b.worker_end_time,
  474. b.order_type,
  475. b.order_type_text,
  476. b.order_small_type,
  477. b.order_small_type_text,
  478. b.brand_id,
  479. b.brand,
  480. b.order_source,
  481. b.order_channel,
  482. b.parent_category_id,
  483. b.parent_category_name,
  484. b.category_id,
  485. b.category_name,
  486. b.goods_name,
  487. b.order_num,
  488. b.settle_order_type,
  489. b.install_id,
  490. b.install_label,
  491. b.install_norm_amount,
  492. b.repair_id,
  493. b.repair_label,
  494. b.repair_amount,
  495. b.repair_rate,
  496. b.repair_settle_amount,
  497. b.other_id,
  498. b.other_type,
  499. b.other_label,
  500. b.other_price,
  501. b.examine_project_id,
  502. b.examine_project,
  503. b.examine_type,
  504. b.settle_num,
  505. b.settle_amount
  506. FROM
  507. pg_settle_pool_worker a LEFT JOIN pg_settle_order b ON a.pool_id = b.pool_id AND a.worker_id = b.worker_id
  508. WHERE
  509. a.pool_id = #{id}
  510. <if test="workerName!=null and workerName!=''">
  511. AND a.worker_name LIKE CONCAT('%',#{workerName},'%')
  512. </if>
  513. <if test="mobile!=null and mobile!=''">
  514. AND a.worker_mobile LIKE CONCAT('%',#{mobile},'%')
  515. </if>
  516. <if test="idcard!=null and idcard!=''">
  517. AND a.worker_idcard LIKE CONCAT('%',#{idcard},'%')
  518. </if>
  519. <if test="orderBaseId!=null and orderBaseId!=''">
  520. AND b.order_base_id LIKE CONCAT('%',#{orderBaseId},'%')
  521. </if>
  522. <if test="customerName!=null and customerName!=''">
  523. AND b.customer_name LIKE CONCAT('%',#{customerName},'%')
  524. </if>
  525. <if test="customerMobile!=null and customerMobile!=''">
  526. AND b.customer_mobile LIKE CONCAT('%',#{customerMobile},'%')
  527. </if>
  528. <if test="orderSmallType!=null and orderSmallType!=''">
  529. AND b.order_small_type = #{orderSmallType}
  530. </if>
  531. <if test="settleOrderType!=null and settleOrderType!=''">
  532. AND b.settle_order_type = #{settleOrderType}
  533. </if>
  534. </select>
  535. <select id="userWaitList" resultType="com.gree.mall.manager.bean.listvo.workorder.UserWaitVO">
  536. SELECT
  537. ${ex.selected}
  538. FROM user_wait a
  539. ${ex.query}
  540. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  541. AND (
  542. a.websit_id IN
  543. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  544. #{item}
  545. </foreach>
  546. )
  547. </if>
  548. ${ex.orderBy}
  549. </select>
  550. <select id="buyServiceRecordList" resultType="com.gree.mall.manager.bean.serivce.BuyServiceRecordVO">
  551. SELECT
  552. ${ex.selected}
  553. FROM buy_service_record a
  554. ${ex.query}
  555. <if test="companyName != null and companyName !=''">
  556. AND a.company_name = #{companyName}
  557. </if>
  558. <if test="ex.orderBy == null or ex.orderBy ==''">
  559. ORDER BY a.create_time DESC
  560. </if>
  561. ${ex.orderBy}
  562. </select>
  563. <select id="increOrderSettleList" resultType="com.gree.mall.manager.bean.workorder.IncreOrderVO">
  564. SELECT
  565. ${ex.selected}
  566. FROM pg_incre_order a
  567. ${ex.query}
  568. <if test="isSettleList != null and isSettleList == true">
  569. AND a.settle_status IN ('OVER', 'EXCEPTION')
  570. </if>
  571. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  572. AND (
  573. a.websit_id IN
  574. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  575. #{item}
  576. </foreach>
  577. )
  578. </if>
  579. <if test="ex.orderBy == null or ex.orderBy ==''">
  580. ORDER BY a.create_time DESC
  581. </if>
  582. ${ex.orderBy}
  583. </select>
  584. <select id="websitOrderSettleCountList"
  585. resultType="com.gree.mall.manager.bean.workorder.WebsitOrderSettleCountVO">
  586. SELECT
  587. a.company_wechat_id,
  588. a.company_wechat_name,
  589. a.websit_id,
  590. a.websit_name,
  591. COUNT(a.id) AS order_num,
  592. SUM(a.amount) AS order_amount,
  593. SUM(a.websit_amount) AS websit_amount
  594. FROM pg_incre_order a
  595. ${ex.query}
  596. AND a.settle_status IN ('OVER', 'EXCEPTION')
  597. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  598. AND (
  599. a.websit_id IN
  600. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  601. #{item}
  602. </foreach>
  603. )
  604. </if>
  605. GROUP BY
  606. a.company_wechat_id, a.websit_id
  607. </select>
  608. <select id="projectRepairList" resultType="com.gree.mall.manager.bean.engin.ProjectRepairVO">
  609. SELECT
  610. ${ex.selected}
  611. FROM rp_project_repair a LEFT JOIN rp_project_repair_websit b ON a.id = b.project_repair_id
  612. ${ex.query}
  613. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  614. AND (
  615. b.websit_id IN
  616. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  617. #{item}
  618. </foreach>
  619. )
  620. </if>
  621. GROUP BY a.id
  622. <if test="ex.orderBy == null or ex.orderBy ==''">
  623. ORDER BY a.create_time DESC
  624. </if>
  625. ${ex.orderBy}
  626. </select>
  627. <select id="orderBaseList2" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBase2VO">
  628. SELECT
  629. ${ex.selected}
  630. FROM pg_order_base a
  631. JOIN pg_order_product b ON a.id = b.order_base_id
  632. JOIN pg_order_settle_norm c ON b.id = c.pg_order_product_id AND c.settle_norm_type IN ('INSTALL','REPAIR')
  633. ${ex.query}
  634. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  635. AND a.order_small_type = #{ex.orderSmallType}
  636. </if>
  637. <if test="ex.orderStatus != null and ex.orderStatus.key !='YCD'.toString() and ex.orderStatus.key !='DYY'.toString()">
  638. AND a.order_status = #{ex.orderStatus.key}
  639. </if>
  640. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  641. AND a.is_exception =1
  642. </if>
  643. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  644. AND a.appointment_time IS NULL
  645. </if>
  646. <if test="ex.isYb != null and ex.isYb == true">
  647. AND a.pg_incre_item_id !=''
  648. </if>
  649. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  650. AND (
  651. a.websit_id IN
  652. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  653. #{item}
  654. </foreach>
  655. OR
  656. a.create_websit_id IN
  657. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  658. #{item}
  659. </foreach>
  660. )
  661. </if>
  662. ORDER BY a.create_time DESC,id DESC
  663. </select>
  664. <select id="workerOrderSettleCountList"
  665. resultType="com.gree.mall.manager.bean.workorder.WorkerOrderSettleCountVO">
  666. SELECT
  667. a.company_wechat_id,
  668. a.company_wechat_name,
  669. a.worker_id,
  670. a.worker_name,
  671. a.worker_idcard,
  672. a.worker_mobile,
  673. COUNT(a.id) AS order_num,
  674. SUM(a.amount) AS order_amount,
  675. SUM(a.worker_amount) AS worker_amount
  676. FROM pg_incre_order a
  677. ${ex.query}
  678. AND a.settle_status IN ('OVER', 'EXCEPTION')
  679. AND a.worker_id <![CDATA[ <> ]]> ''
  680. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  681. AND (
  682. a.websit_id IN
  683. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  684. #{item}
  685. </foreach>
  686. )
  687. </if>
  688. GROUP BY
  689. a.company_wechat_id, a.worker_id
  690. </select>
  691. <select id="goodsMaterialList" resultType="com.gree.mall.manager.bean.goods.GoodsMaterialVO">
  692. SELECT
  693. ${ex.selected}
  694. FROM goods_material a
  695. ${ex.query}
  696. <if test="ex.orderBy == null or ex.orderBy ==''">
  697. ORDER BY a.create_time DESC
  698. </if>
  699. ${ex.orderBy}
  700. </select>
  701. <select id="goodsPurchaseList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseVO">
  702. SELECT
  703. ${ex.selected}
  704. FROM goods_purchase a
  705. ${ex.query}
  706. <if test="ex.orderBy == null or ex.orderBy ==''">
  707. ORDER BY a.create_time DESC
  708. </if>
  709. ${ex.orderBy}
  710. </select>
  711. <select id="goodsPurchaseItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseItemVO">
  712. SELECT
  713. ${ex.selected}
  714. FROM goods_purchase a JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  715. ${ex.query}
  716. <if test="ex.orderBy == null or ex.orderBy ==''">
  717. ORDER BY a.create_time DESC
  718. </if>
  719. ${ex.orderBy}
  720. </select>
  721. <select id="goodsPurchaseCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseCodeVO">
  722. SELECT
  723. ${ex.selected}
  724. FROM goods_purchase a
  725. JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  726. JOIN goods_purchase_code c ON b.id = c.goods_purchase_item_id
  727. ${ex.query}
  728. <if test="ex.orderBy == null or ex.orderBy ==''">
  729. ORDER BY a.create_time DESC, c.id DESC
  730. </if>
  731. ${ex.orderBy}
  732. </select>
  733. <select id="queryOrderInfoList" resultType="com.gree.mall.manager.bean.listvo.OrderInfoVO">
  734. SELECT
  735. ${ex.selected},
  736. if(a.order_status IN ('NOPAY','TIMEOUT'),"待支付","已支付") 'payStatus'
  737. from order_info a
  738. join order_detail b on a.order_id=b.order_id
  739. ${ex.query}
  740. and a.sale_type = 2
  741. <if test="ex.orderBy == null or ex.orderBy ==''">
  742. ORDER BY a.create_time DESC
  743. </if>
  744. ${ex.orderBy}
  745. </select>
  746. <select id="goodsPurchaseRetList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetVO">
  747. SELECT
  748. ${ex.selected}
  749. FROM goods_purchase_ret a
  750. ${ex.query}
  751. <if test="ex.orderBy == null or ex.orderBy ==''">
  752. ORDER BY a.create_time DESC
  753. </if>
  754. ${ex.orderBy}
  755. </select>
  756. <select id="goodsPurchaseRetItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetItemVO">
  757. SELECT
  758. ${ex.selected}
  759. FROM goods_purchase_ret a JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  760. ${ex.query}
  761. <if test="ex.orderBy == null or ex.orderBy ==''">
  762. ORDER BY a.create_time DESC
  763. </if>
  764. ${ex.orderBy}
  765. </select>
  766. <select id="goodsPurchaseRetCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetCodeVO">
  767. SELECT
  768. ${ex.selected}
  769. FROM goods_purchase_ret a
  770. JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  771. JOIN goods_purchase_ret_code c ON b.id = c.goods_purchase_ret_item_id
  772. ${ex.query}
  773. <if test="ex.orderBy == null or ex.orderBy ==''">
  774. ORDER BY a.create_time DESC, c.id DESC
  775. </if>
  776. ${ex.orderBy}
  777. </select>
  778. <select id="goodsMaterialStockAccList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsMaterialStockAccVO">
  779. SELECT
  780. ${ex.selected}
  781. FROM goods_material_stock_acc a
  782. ${ex.query}
  783. <if test="ex.orderBy == null or ex.orderBy ==''">
  784. ORDER BY a.create_time DESC
  785. </if>
  786. ${ex.orderBy}
  787. </select>
  788. <select id="orderEnginBaseList" resultType="com.gree.mall.manager.bean.engin.OrderEnginBaseVO">
  789. SELECT
  790. ${ex.selected}
  791. FROM order_engin_base a
  792. ${ex.query}
  793. <if test="ex.orderBy == null or ex.orderBy ==''">
  794. ORDER BY a.create_time DESC
  795. </if>
  796. ${ex.orderBy}
  797. </select>
  798. <select id="punishOrderList" resultType="com.gree.mall.manager.bean.listvo.order.PunishOrderVO">
  799. SELECT
  800. ${ex.selected}
  801. FROM punish_order a
  802. join punish_order_worker b on a.id = b.punish_order_id
  803. join punish_order_product c on a.id = c.punish_order_id
  804. ${ex.query}
  805. <if test="ex.examineStatus != null">
  806. and a.status = #{ex.examineStatus.key}
  807. </if>
  808. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  809. AND a.websit_id IN
  810. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  811. #{item}
  812. </foreach>
  813. </if>
  814. <if test="ex.orderBy == null or ex.orderBy ==''">
  815. ORDER BY a.create_time DESC
  816. </if>
  817. ${ex.orderBy}
  818. </select>
  819. <select id="orderOfflineRefundList" resultType="com.gree.mall.manager.bean.order.refund.OrderOfflineRefundVO">
  820. SELECT
  821. ${ex.selected}
  822. from order_offline_refund a
  823. join order_info b on a.order_id = b.order_id
  824. ${ex.query}
  825. ORDER BY a.create_time DESC
  826. </select>
  827. <select id="workerSettleExpenseGatherList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseVO">
  828. SELECT
  829. ${ex.selected}
  830. FROM settle_expense a
  831. ${ex.query}
  832. <if test='ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0' >
  833. AND a.websit_id in
  834. <foreach collection="ex.adminWebsitIds" open="(" close=")" item="item" separator=",">
  835. #{item}
  836. </foreach>
  837. </if>
  838. <if test="ex.orderBy == null or ex.orderBy ==''">
  839. ORDER BY a.create_time DESC
  840. </if>
  841. ${ex.orderBy}
  842. </select>
  843. <select id="workerSettleExpenseList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseItemVO">
  844. SELECT
  845. ${ex.selected}
  846. FROM settle_expense_item a JOIN settle_expense b ON a.settle_expense_id = b.id
  847. ${ex.query}
  848. <if test="workerId != null">
  849. AND (a.worker_name1 = #{workerId} OR a.worker_name2 = #{workerId})
  850. </if>
  851. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  852. AND a.websit_id IN
  853. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  854. #{item}
  855. </foreach>
  856. </if>
  857. <if test="ex.orderBy == null or ex.orderBy ==''">
  858. ORDER BY a.create_time DESC
  859. </if>
  860. ${ex.orderBy}
  861. </select>
  862. <select id="settleMonthWagesGatherList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesVO">
  863. SELECT
  864. ${ex.selected}
  865. FROM settle_month_wages a
  866. ${ex.query}
  867. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  868. AND a.websit_id IN
  869. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  870. #{item}
  871. </foreach>
  872. </if>
  873. <if test="ex.orderBy == null or ex.orderBy ==''">
  874. ORDER BY a.create_time DESC
  875. </if>
  876. ${ex.orderBy}
  877. </select>
  878. <select id="settleMonthWagesList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesWorkerVO">
  879. SELECT
  880. ${ex.selected}
  881. FROM settle_month_wages_worker a LEFT JOIN settle_month_wages_detail b ON a.settle_month_wages_detail_id = b.id
  882. ${ex.query}
  883. <if test="ex.orderBy == null or ex.orderBy ==''">
  884. ORDER BY a.worker_id DESC
  885. </if>
  886. ${ex.orderBy}
  887. </select>
  888. <select id="goodsLeaseList" resultType="com.gree.mall.manager.bean.goods.GoodsLeaseBean">
  889. SELECT
  890. a.*
  891. FROM goods_lease a
  892. WHERE
  893. a.del = 0
  894. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  895. AND a.company_wechat_id in
  896. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  897. #{companyWechatId}
  898. </foreach>
  899. </if>
  900. <if test="keyword != null and keyword != ''">
  901. AND
  902. (a.id LIKE CONCAT('%', #{keyword},'%') OR a.name LIKE CONCAT('%',#{keyword},'%') OR a.category_name
  903. LIKE CONCAT('%',#{keyword},'%'))
  904. </if>
  905. <if test="startPrice != null and endPrice != null">
  906. AND
  907. a.lease_price BETWEEN #{startPrice} AND #{endPrice}
  908. </if>
  909. <if test="startDeposit != null and endDeposit != null">
  910. AND
  911. a.deposit_price BETWEEN #{startDeposit} AND #{endDeposit}
  912. </if>
  913. <if test="categoryIds != null and categoryIds.size() != 0">
  914. AND
  915. a.category_id IN
  916. <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
  917. #{item}
  918. </foreach>
  919. </if>
  920. <if test="status != null">
  921. AND
  922. a.status = #{status}
  923. </if>
  924. <choose>
  925. <when test="sortStr == null">
  926. ORDER BY a.sort DESC,a.create_time DESC
  927. </when>
  928. <otherwise>
  929. ORDER BY a.sort DESC,${sortStr},a.create_time DESC
  930. </otherwise>
  931. </choose>
  932. </select>
  933. <select id="leaseOrderList" resultType="com.gree.mall.manager.bean.order.LeaseOrderVO">
  934. SELECT
  935. a.*,
  936. b.category_id,
  937. b.category_name,
  938. b.category_url,
  939. b.goods_lease_id,
  940. b.goods_lease_name,
  941. b.goods_unit,
  942. b.qty,
  943. b.deposit_price,
  944. b.lease_price,
  945. b.start_date,
  946. b.end_date,
  947. b.real_end_date
  948. FROM
  949. lease_order a LEFT JOIN lease_order_item b ON a.id = b.lease_order_id
  950. WHERE
  951. a.pay_status = 1
  952. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  953. AND a.company_wechat_id in
  954. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  955. #{companyWechatId}
  956. </foreach>
  957. </if>
  958. <if test="orderId != null and orderId != ''">
  959. AND a.id LIKE CONCAT('%', #{orderId},'%')
  960. </if>
  961. <if test="goodsName != null and goodsName != ''">
  962. AND b.goods_lease_name LIKE CONCAT('%', #{goodsName},'%')
  963. </if>
  964. <if test="userName != null and userName != ''">
  965. AND a.user_name LIKE CONCAT('%', #{userName},'%')
  966. </if>
  967. <if test="userMobile != null and userMobile != ''">
  968. AND a.user_mobile LIKE CONCAT('%', #{userMobile},'%')
  969. </if>
  970. <if test="status != null and status != ''">
  971. AND a.status = #{status}
  972. </if>
  973. <if test="startDate != null and endDate != null">
  974. AND
  975. a.create_time BETWEEN #{startDate} AND #{endDate}
  976. </if>
  977. <if test="startPayDate != null and endPayDate != null">
  978. AND
  979. a.pay_time BETWEEN #{startPayDate} AND #{endPayDate}
  980. </if>
  981. ORDER BY a.create_time DESC
  982. </select>
  983. <select id="goodsLibraryList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsLibraryVO">
  984. SELECT
  985. ${ex.selected}
  986. FROM goods_library a
  987. join goods_library_spec b on a.goods_library_id = b.goods_library_id
  988. ${ex.query}
  989. group by a.goods_library_id
  990. ORDER BY a.update_time DESC
  991. </select>
  992. <select id="promotionQuestionnairList" resultType="com.gree.mall.manager.bean.listvo.PromotionQuestionnairVO">
  993. SELECT
  994. ${ex.selected},
  995. if(is_stop=1,'已终止',if(a.start_time > now(),'待生效',if(now() between a.start_time and a.end_time,'生效中','已过期'))) 'statusText'
  996. FROM promotion_questionnaire a
  997. ${ex.query}
  998. <if test="status != null">
  999. <if test="status == 0">
  1000. and a.start_time > now()
  1001. </if>
  1002. <if test="status == 1">
  1003. and now() between a.start_time and a.end_time and is_stop=0
  1004. </if>
  1005. <if test="status == 2">
  1006. and a.end_time &lt; now()
  1007. </if>
  1008. <if test="status == 3">
  1009. and a.is_stop = 1
  1010. </if>
  1011. </if>
  1012. ORDER BY a.create_time DESC
  1013. </select>
  1014. <select id="promotionActivityList" resultType="com.gree.mall.manager.bean.activity.PromotionActivityVO">
  1015. SELECT
  1016. ${ex.selected},
  1017. b.create_by AS orderCreateBy,
  1018. b.create_time AS orderCreateTime,
  1019. b.create_mobile AS orderCreateMobile
  1020. FROM
  1021. promotion_activity a LEFT JOIN promotion_questionnaire b ON a.promotion_questionnaire_id = b.id
  1022. ${ex.query}
  1023. <if test="ex.orderBy == null or ex.orderBy ==''">
  1024. ORDER BY a.create_time DESC
  1025. </if>
  1026. ${ex.orderBy}
  1027. </select>
  1028. <select id="esGoodsList" resultType="com.gree.mall.manager.bean.es.ESGoodsVO">
  1029. SELECT
  1030. ${ex.selected}
  1031. FROM
  1032. es_goods a
  1033. ${ex.query}
  1034. AND a.del = 0
  1035. <if test="ex.orderBy == null or ex.orderBy ==''">
  1036. ORDER BY a.create_time DESC
  1037. </if>
  1038. ${ex.orderBy}
  1039. </select>
  1040. <select id="esGoodsMessageList" resultType="com.gree.mall.manager.bean.es.EsGoodsMessageVO">
  1041. SELECT
  1042. a.*,
  1043. b.content AS replyContent,
  1044. b.reply_time,
  1045. b.reply_by
  1046. FROM
  1047. es_goods_message a LEFT JOIN es_goods_message_reply b ON a.id = b.es_goods_message_id
  1048. WHERE
  1049. a.es_goods_id = #{id}
  1050. </select>
  1051. <select id="adminCompanyPayConfigList"
  1052. resultType="com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO">
  1053. SELECT
  1054. ${ex.selected}
  1055. FROM
  1056. admin_company_wechat_pay_config a
  1057. ${ex.query}
  1058. AND a.del = 0
  1059. <if test="ex.orderBy == null or ex.orderBy ==''">
  1060. ORDER BY a.create_time DESC
  1061. </if>
  1062. ${ex.orderBy}
  1063. </select>
  1064. <select id="repairSettleBankAccountList"
  1065. resultType="com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO">
  1066. SELECT
  1067. ${ex.selected}
  1068. FROM
  1069. settle_daily_bank_account a
  1070. ${ex.query}
  1071. <if test="ex.orderBy == null or ex.orderBy ==''">
  1072. ORDER BY a.create_time DESC
  1073. </if>
  1074. ${ex.orderBy}
  1075. </select>
  1076. <select id="repairSettleDailyWithholdList"
  1077. resultType="com.gree.mall.manager.bean.settle.repair.DailyWithholdVO">
  1078. SELECT
  1079. ${ex.selected}
  1080. FROM
  1081. settle_daily_withhold a
  1082. ${ex.query}
  1083. <if test="ex.orderBy == null or ex.orderBy ==''">
  1084. ORDER BY a.create_time DESC
  1085. </if>
  1086. ${ex.orderBy}
  1087. </select>
  1088. <select id="repairSettleDailyImportSummaryList"
  1089. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryVO">
  1090. SELECT
  1091. a.company_wechat_id,
  1092. a.company_wechat_name,
  1093. a.import_batch_no,
  1094. COUNT(DISTINCT a.repair_worker_mobile) AS personNums,
  1095. COUNT(1) AS 'orderNums',
  1096. SUM(a.total_fee) AS 'totalAmount',
  1097. IF(find_in_set('1', group_concat(DISTINCT a.summary_status)) > 0 , 1, 2) AS 'summaryStatus',
  1098. import_by ,
  1099. import_time ,
  1100. group_concat(DISTINCT summary_by) AS 'summaryBy',
  1101. summary_time AS 'summaryTime',
  1102. group_concat(DISTINCT summary_batch_no) AS 'summaryBatchNo' ,
  1103. group_concat(DISTINCT month) AS 'month'
  1104. FROM
  1105. settle_daily_import_summary_item a
  1106. ${ex.query}
  1107. GROUP BY
  1108. a.company_wechat_id, a.import_batch_no
  1109. <if test="ex.orderBy == null or ex.orderBy ==''">
  1110. ORDER BY a.create_time DESC
  1111. </if>
  1112. ${ex.orderBy}
  1113. </select>
  1114. <select id="repairDetailList"
  1115. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryItemVO">
  1116. SELECT
  1117. ${ex.selected}
  1118. FROM
  1119. settle_daily_import_summary_item a
  1120. ${ex.query}
  1121. <if test="ex.orderBy == null or ex.orderBy ==''">
  1122. ORDER BY a.create_time DESC
  1123. </if>
  1124. ${ex.orderBy}
  1125. </select>
  1126. <select id="reduceCountList"
  1127. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostCountVO">
  1128. SELECT
  1129. company_wechat_id,
  1130. company_wechat_name,
  1131. import_batch_no,
  1132. count(service_number) personNums,
  1133. count(id) orderNums,
  1134. sum(cost_amount) totalAmount,
  1135. do_status,
  1136. import_by,
  1137. import_time,
  1138. do_by,
  1139. do_time,
  1140. do_batch_no
  1141. FROM
  1142. settle_daily_incr_decr_cost a
  1143. ${ex.query}
  1144. GROUP BY a.company_wechat_id, a.import_batch_no
  1145. <if test="ex.orderBy == null or ex.orderBy ==''">
  1146. ORDER BY a.create_time DESC
  1147. </if>
  1148. ${ex.orderBy}
  1149. </select>
  1150. <select id="repairSettleDailyincrDecrCostList"
  1151. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostVO">
  1152. SELECT
  1153. ${ex.selected}
  1154. FROM
  1155. settle_daily_incr_decr_cost a
  1156. ${ex.query}
  1157. <if test="ex.orderBy == null or ex.orderBy ==''">
  1158. ORDER BY a.create_time DESC
  1159. </if>
  1160. ${ex.orderBy}
  1161. </select>
  1162. <select id="reduceTotalList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostGatherVO">
  1163. SELECT
  1164. company_wechat_id,
  1165. company_wechat_name,
  1166. COUNT(DISTINCT repair_worker_mobile) AS 'personNums',
  1167. COUNT(1) AS 'orderNums',
  1168. SUM(total_fee) AS 'totalAmount',
  1169. import_by ,
  1170. import_time ,
  1171. import_batch_no,
  1172. do_status,
  1173. do_by ,
  1174. do_time ,
  1175. do_batch_no
  1176. FROM
  1177. settle_daily_reduce_cost a
  1178. ${ex.query}
  1179. GROUP BY a.company_wechat_id, a.import_batch_no
  1180. <if test="ex.orderBy == null or ex.orderBy ==''">
  1181. ORDER BY a.create_time DESC
  1182. </if>
  1183. ${ex.orderBy}
  1184. </select>
  1185. <select id="reduceList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostVO">
  1186. SELECT
  1187. ${ex.selected}
  1188. FROM
  1189. settle_daily_reduce_cost a
  1190. ${ex.query}
  1191. <if test="ex.orderBy == null or ex.orderBy ==''">
  1192. ORDER BY a.create_time DESC
  1193. </if>
  1194. ${ex.orderBy}
  1195. </select>
  1196. <select id="buckleList" resultType="com.gree.mall.manager.bean.settle.repair.WorkerWaitBuckleVO">
  1197. SELECT
  1198. ${ex.selected}
  1199. FROM
  1200. settle_daily_remaine_buckle a
  1201. JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1202. JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1203. ${ex.query}
  1204. GROUP BY a.company_wechat_id, a.idcard
  1205. <if test="ex.orderBy == null or ex.orderBy ==''">
  1206. ORDER BY a.create_time DESC
  1207. </if>
  1208. ${ex.orderBy}
  1209. </select>
  1210. <select id="transferList"
  1211. resultType="com.gree.mall.manager.bean.settle.repair.SettleDailyBankTransferRecordVO">
  1212. SELECT
  1213. ${ex.selected}
  1214. FROM
  1215. settle_daily_bank_transfer_record a
  1216. ${ex.query}
  1217. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1218. AND a.company_wechat_id IN
  1219. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1220. #{item}
  1221. </foreach>
  1222. </if>
  1223. <if test="ex.orderBy == null or ex.orderBy ==''">
  1224. ORDER BY a.create_time DESC
  1225. </if>
  1226. ${ex.orderBy}
  1227. </select>
  1228. <select id="repairAllList" resultType="com.gree.mall.manager.bean.settle.repair.AllDailyImportSummaryItemVO">
  1229. SELECT
  1230. ${ex.selected}
  1231. FROM
  1232. settle_daily_import_summary_item a
  1233. LEFT JOIN settle_daily_reduce_cost sdrc on a.dispatch_order_no = sdrc.dispatch_order_no
  1234. LEFT JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1235. LEFT JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1236. LEFT JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  1237. ${ex.query}
  1238. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1239. AND a.company_wechat_id IN
  1240. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1241. #{item}
  1242. </foreach>
  1243. </if>
  1244. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1245. AND a.websit_number IN
  1246. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1247. #{item}
  1248. </foreach>
  1249. </if>
  1250. GROUP BY a.id
  1251. <if test="ex.orderBy == null or ex.orderBy ==''">
  1252. ORDER BY a.create_time, a.id DESC
  1253. </if>
  1254. ${ex.orderBy}
  1255. </select>
  1256. <select id="repairAllCount" resultType="java.lang.Integer">
  1257. SELECT
  1258. COUNT(1)
  1259. FROM
  1260. settle_daily_import_summary_item a JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  1261. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1262. AND a.company_wechat_id IN
  1263. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1264. #{item}
  1265. </foreach>
  1266. </if>
  1267. <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
  1268. AND a.websit_number IN
  1269. <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
  1270. #{item}
  1271. </foreach>
  1272. </if>
  1273. WHERE
  1274. c.status = #{status}
  1275. </select>
  1276. <select id="queryComList" resultType="com.gree.mall.manager.plus.entity.ComList">
  1277. select
  1278. a.*
  1279. from
  1280. com_list a join com_detail b on a.id=b.com_list_id
  1281. where
  1282. <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
  1283. b.websit_id IN
  1284. <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
  1285. #{item}
  1286. </foreach>
  1287. AND
  1288. </if>
  1289. a.is_notice=1 and a.is_pwd = 0
  1290. and not exists (select 1 from com_detail_log where user_name=#{userName} and com_list_id=a.id)
  1291. </select>
  1292. <select id="list" resultType="com.gree.mall.manager.bean.common.CallRecordVo">
  1293. SELECT
  1294. ${ex.selected}
  1295. FROM
  1296. call_send_record a
  1297. ${ex.query}
  1298. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1299. AND a.websit_number IN
  1300. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1301. #{item}
  1302. </foreach>
  1303. </if>
  1304. <if test="ex.orderBy == null or ex.orderBy ==''">
  1305. ORDER BY a.create_time, a.id DESC
  1306. </if>
  1307. ${ex.orderBy}
  1308. </select>
  1309. <select id="settleRelaConfigPage"
  1310. resultType="com.gree.mall.manager.bean.contract.SettleRelaConfigVO">
  1311. SELECT
  1312. ${ex.selected},
  1313. b.name AS parentName,
  1314. d.name AS subName
  1315. FROM
  1316. websit_follow_config a
  1317. JOIN admin_websit b ON a.websit_id = b.websit_id
  1318. LEFT JOIN websit_follow_config_item c ON a.websit_id = c.parent_id
  1319. LEFT JOIN admin_websit d ON c.sub_websit_id = d.websit_id
  1320. ${ex.query}
  1321. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1322. AND a.websit_id IN
  1323. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1324. #{item}
  1325. </foreach>
  1326. </if>
  1327. <if test="ex.orderBy == null or ex.orderBy ==''">
  1328. ORDER BY a.create_time DESC
  1329. </if>
  1330. ${ex.orderBy}
  1331. </select>
  1332. <select id="listOrder" resultType="com.gree.mall.manager.bean.common.CallRecordOrderVo">
  1333. SELECT
  1334. ${ex.selected}
  1335. FROM
  1336. call_record a
  1337. ${ex.query}
  1338. <if test="ex.orderBy == null or ex.orderBy ==''">
  1339. ORDER BY a.create_time DESC
  1340. </if>
  1341. ${ex.orderBy}
  1342. </select>
  1343. <select id="contractTemplatePage" resultType="com.gree.mall.manager.bean.contract.ContractTemplateVO">
  1344. SELECT
  1345. ${ex.selected},
  1346. b.contract_template_name AS followContractTemplateName
  1347. FROM
  1348. contract_template a
  1349. LEFT JOIN contract_template b ON a.follow_contract_template_id = b.contract_template_id
  1350. ${ex.query}
  1351. AND a.del = 0
  1352. <if test="ex.orderBy == null or ex.orderBy ==''">
  1353. ORDER BY a.create_time DESC
  1354. </if>
  1355. ${ex.orderBy}
  1356. </select>
  1357. <select id="contractWebsitList" resultType="com.gree.mall.manager.bean.contract.ContractWebsitBean">
  1358. SELECT
  1359. a.*,
  1360. d.name AS parent_name,
  1361. d.websit_id AS parent_id,
  1362. c.name,
  1363. d.belong_company,
  1364. d.belong_company_code
  1365. FROM
  1366. contract_websit a
  1367. LEFT JOIN websit_follow_config_item b ON a.sub_websit_id = b.sub_websit_id
  1368. LEFT JOIN admin_websit c on a.sub_websit_id = c.websit_id
  1369. LEFT JOIN admin_websit d on b.parent_id = d.websit_id
  1370. WHERE
  1371. a.contract_template_id = #{contractTemplateId}
  1372. </select>
  1373. <select id="querySettleRelaWebsit" resultType="com.gree.mall.manager.bean.contract.ContractWebsitBean">
  1374. SELECT
  1375. b.name AS parent_name,
  1376. c.name,
  1377. a.sub_websit_id,
  1378. b.belong_company,
  1379. b.belong_company_code
  1380. FROM
  1381. websit_follow_config_item a
  1382. LEFT JOIN admin_websit b ON a.parent_id = b.websit_id
  1383. LEFT JOIN admin_websit c ON a.sub_websit_id = c.websit_id
  1384. <where>
  1385. <if test="contractTemplateId != null and contractTemplateId != ''">
  1386. AND a.sub_websit_id NOT IN (SELECT sub_websit_id FROM contract_websit WHERE contract_template_id = #{contractTemplateId})
  1387. </if>
  1388. <if test="websitId != null and websitId != ''">
  1389. AND a.sub_websit_id = #{websitId}
  1390. </if>
  1391. <if test="websitName != null and websitName != ''">
  1392. AND c.name LIKE CONCAT('%', #{websitName}, '%')
  1393. </if>
  1394. </where>
  1395. ORDER BY b.belong_company_code, a.parent_id, a.sub_websit_id
  1396. </select>
  1397. <select id="companyCaAuthPage" resultType="com.gree.mall.manager.bean.contract.CompanyCaAuthVO">
  1398. SELECT
  1399. ${ex.selected}
  1400. FROM
  1401. company_ca_auth a
  1402. LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
  1403. ${ex.query}
  1404. AND a.del = 0
  1405. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1406. AND a.websit_id IN
  1407. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1408. #{item}
  1409. </foreach>
  1410. </if>
  1411. <if test="ex.orderBy == null or ex.orderBy ==''">
  1412. ORDER BY a.create_time DESC
  1413. </if>
  1414. ${ex.orderBy}
  1415. </select>
  1416. <select id="websitContractSignPage" resultType="com.gree.mall.manager.bean.contract.WebsitContractSignVO">
  1417. SELECT
  1418. ${ex.selected}
  1419. FROM
  1420. websit_contract_sign_record a
  1421. ${ex.query}
  1422. <if test="websitId != null">
  1423. AND a.websit_id = #{websitId}
  1424. </if>
  1425. <if test="websitId == null and ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1426. AND a.parent_id IN
  1427. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1428. #{item}
  1429. </foreach>
  1430. </if>
  1431. <if test="ex.orderBy == null or ex.orderBy ==''">
  1432. ORDER BY a.create_time DESC
  1433. </if>
  1434. ${ex.orderBy}
  1435. </select>
  1436. <select id="queryNeedContract" resultType="com.gree.mall.manager.plus.entity.ContractTemplate">
  1437. SELECT
  1438. b.*
  1439. FROM
  1440. contract_websit a,
  1441. contract_template b
  1442. WHERE
  1443. a.company_wechat_id = b.company_wechat_id
  1444. AND a.contract_template_id = b.contract_template_id
  1445. AND a.company_wechat_id = #{companyId}
  1446. AND a.sub_websit_id = #{websitId}
  1447. AND #{onDate} BETWEEN b.valid_date AND b.expire_date
  1448. AND b.contract_type = 'MAIN'
  1449. AND b.status = 'ON'
  1450. ORDER BY
  1451. create_time
  1452. </select>
  1453. <select id="selectMainContractIdByValidDate" resultType="java.lang.String">
  1454. SELECT
  1455. contract_template_id
  1456. FROM
  1457. `contract_template`
  1458. WHERE
  1459. company_wechat_id = #{companyId}
  1460. AND contract_type = 'MAIN'
  1461. AND `status` = 'ON'
  1462. AND #{onDate} BETWEEN valid_date AND expire_date
  1463. </select>
  1464. <select id="workerTeamPage" resultType="com.gree.mall.manager.bean.worker.WorkerTeamVO">
  1465. SELECT
  1466. ${ex.selected}
  1467. FROM
  1468. worker_team a
  1469. LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
  1470. ${ex.query}
  1471. <if test="workerId != null and workerId != ''">
  1472. AND (a.master_worker_id = #{workerId} OR a.assistant_worker_id = #{workerId})
  1473. </if>
  1474. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1475. AND a.websit_id IN
  1476. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1477. #{item}
  1478. </foreach>
  1479. </if>
  1480. <if test="ex.orderBy == null or ex.orderBy ==''">
  1481. ORDER BY a.create_time DESC
  1482. </if>
  1483. ${ex.orderBy}
  1484. </select>
  1485. <select id="appraiseCategoryList" resultType="com.gree.mall.manager.bean.workorder.PgAppraiseCategoryVO">
  1486. SELECT
  1487. ${ex.selected},
  1488. b.name AS parentName
  1489. FROM
  1490. pg_appraise_category a
  1491. LEFT JOIN pg_appraise_category b ON a.parent_id = b.id
  1492. ${ex.query}
  1493. <if test="ex.orderBy == null or ex.orderBy ==''">
  1494. ORDER BY a.create_time DESC
  1495. </if>
  1496. ${ex.orderBy}
  1497. </select>
  1498. <select id="appraiseApplyList" resultType="com.gree.mall.manager.bean.workorder.PgAppraiseApplyVO">
  1499. SELECT
  1500. ${ex.selected}
  1501. FROM
  1502. pg_appraise_apply a
  1503. ${ex.query}
  1504. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1505. AND a.websit_id IN
  1506. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1507. #{item}
  1508. </foreach>
  1509. </if>
  1510. <if test="ex.orderBy == null or ex.orderBy ==''">
  1511. ORDER BY a.update_time DESC
  1512. </if>
  1513. ${ex.orderBy}
  1514. </select>
  1515. <select id="workerManagerCheck" resultType="com.gree.mall.manager.bean.workorder.WorkerNumberCheckVO">
  1516. SELECT
  1517. ${ex.selected}
  1518. FROM
  1519. worker_number_check a
  1520. JOIN `user` c on c.nick_name = a.worker_name and RIGHT(c.mobile,4) = RIGHT(a.worker_phone_yun,4)
  1521. JOIN websit_user d on a.websit_id = d.websit_id and c.user_id = d.user_id and d.examine_status = 'OK'
  1522. LEFT JOIN admin_websit b on a.websit_id = b.websit_id
  1523. ${ex.query}
  1524. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1525. AND a.websit_id IN
  1526. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1527. #{item}
  1528. </foreach>
  1529. </if>
  1530. HAVING a.worker_number_yun != d.worker_number
  1531. <if test="ex.orderBy == null or ex.orderBy ==''">
  1532. ORDER BY a.websit_id,a.worker_number_yun DESC
  1533. </if>
  1534. ${ex.orderBy}
  1535. </select>
  1536. <select id="workerManagerCheckCount" resultType="java.lang.Integer">
  1537. SELECT
  1538. COUNT( 1 )
  1539. FROM
  1540. (
  1541. SELECT
  1542. a.worker_number_yun,
  1543. d.worker_number
  1544. FROM
  1545. worker_number_check a
  1546. JOIN `user` c on c.nick_name = a.worker_name and RIGHT(c.mobile,4) = RIGHT(a.worker_phone_yun,4)
  1547. JOIN websit_user d on a.websit_id = d.websit_id and c.user_id = d.user_id and d.examine_status = 'OK'
  1548. LEFT JOIN admin_websit b on a.websit_id = b.websit_id
  1549. ${ex.query}
  1550. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1551. AND a.websit_id IN
  1552. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1553. #{item}
  1554. </foreach>
  1555. </if>
  1556. HAVING a.worker_number_yun != d.worker_number
  1557. ) s
  1558. </select>
  1559. </mapper>