CommonMapper.xml 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
  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. <update id="settleBankAccountList"></update>
  5. <select id="queryChargingStandrdList" resultType="com.gree.mall.manager.bean.charging.ChargingStandardBean">
  6. select
  7. a.* ,
  8. b.name as 'typeName',
  9. c.brand_name,
  10. (select name from goods_category where type=2 and category_id = a.one_category_id) as 'oneCategoryName',
  11. (select name from goods_category where type=2 and category_id = a.two_category_id) as 'twoCategoryName'
  12. from charging_standard a
  13. left join charging_standard_type b on a.charging_standard_type_id = b.id
  14. join brand c on c.id = a.brand_id
  15. where 1=1
  16. <if test="companyWechatId != null and companyWechatId !=''">
  17. and a.company_wechat_id=#{companyWechatId}
  18. </if>
  19. <if test="id != null and id !=''">
  20. and a.id = #{id}
  21. </if>
  22. <if test="type != null">
  23. and a.type = #{type}
  24. </if>
  25. <if test="status != null">
  26. and a.status=#{status}
  27. </if>
  28. <if test="brandId != null and brandId != ''">
  29. and a.brand_id=#{brandId}
  30. </if>
  31. <if test="oneCategoryId != null and oneCategoryId !=''">
  32. and a.one_category_id = #{oneCategoryId}
  33. </if>
  34. <if test="twoCategoryId != null and twoCategoryId !=''">
  35. and a.two_category_id = #{twoCategoryId}
  36. </if>
  37. <if test="content1 != null and content1 !=''">
  38. and a.content1 like concat('%',#{content1},'%')
  39. </if>
  40. order by a.create_time desc
  41. </select>
  42. <select id="chargingStandardTypeList" resultType="com.gree.mall.manager.bean.listvo.ChargingStandardTypeVO">
  43. select
  44. ${ex.selected}
  45. from charging_standard_type a
  46. ${ex.query}
  47. ORDER BY a.create_time DESC
  48. </select>
  49. <select id="chargingStandardList" resultType="com.gree.mall.manager.bean.listvo.ChargingStandardVO">
  50. select
  51. ${ex.selected},
  52. b.name 'chargingStandardTypeName',
  53. c.name 'oneCategoryName',
  54. d.name 'twoCategoryName'
  55. from charging_standard a
  56. join charging_standard_type b on a.charging_standard_type_id=b.id
  57. left join goods_category c on c.category_id = a.one_category_id
  58. left join goods_category d on d.category_id = a.two_category_id
  59. join brand e on e.id = a.brand_id
  60. ${ex.query}
  61. and a.type = 1
  62. ORDER BY a.create_time DESC
  63. </select>
  64. <select id="chargingStandardList2" resultType="com.gree.mall.manager.bean.listvo.ChargingStandard2VO">
  65. select
  66. ${ex.selected},
  67. c.name 'oneCategoryName',
  68. d.name 'twoCategoryName'
  69. from charging_standard a
  70. join brand b on b.id = a.brand_id
  71. left join goods_category c on c.category_id = a.one_category_id
  72. left join goods_category d on d.category_id = a.two_category_id
  73. ${ex.query}
  74. and a.type = 2
  75. ORDER BY a.create_time DESC
  76. </select>
  77. <select id="userList" resultType="com.gree.mall.manager.bean.listvo.UserVO">
  78. select
  79. ${ex.selected}
  80. <!--
  81. b.websit_id,
  82. c.name as 'websit_name',
  83. d.nick_name as 'slaveWorkerName'
  84. -->
  85. from user a
  86. <!--
  87. join websit_user b on a.user_id = b.user_id
  88. join admin_websit c on c.websit_id = b.websit_id
  89. left join user d on b.slave_worker_id = d.user_id
  90. -->
  91. ${ex.query}
  92. <!--
  93. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  94. AND c.websit_id IN
  95. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  96. #{item}
  97. </foreach>
  98. </if>
  99. -->
  100. and a.apply_type='WORKER'
  101. <if test="isOK != null and isOK == true">
  102. AND a.worker_number IS NOT NULL
  103. </if>
  104. <if test="ex.isGroupByWorkerId != null and ex.isGroupByWorkerId == true">
  105. GROUP BY a.worker_number
  106. </if>
  107. ORDER BY <!-- FIELD(b.examine_status,'WAIT','OK','FAIL'), --> a.create_time DESC
  108. </select>
  109. <select id="userServiceList" resultType="com.gree.mall.manager.bean.listvo.User2VO">
  110. select
  111. ${ex.selected}
  112. from user a
  113. ${ex.query}
  114. and a.apply_type='SERVICE'
  115. ORDER BY FIELD(a.examine_status,'WAIT','OK','FAIL'),a.create_time DESC
  116. </select>
  117. <select id="userCustomerList" resultType="com.gree.mall.manager.bean.listvo.UserCustomerVO">
  118. select
  119. ${ex.selected},
  120. b.nick_name as 'serviceName',
  121. b.mobile as 'serviceMobile',
  122. c.nick_name as 'firstServiceName',
  123. c.mobile as 'firstServiceMobile'
  124. from user a
  125. left join user b on a.service_id = b.user_id
  126. left join user c on a.first_service_id = c.user_id
  127. ${ex.query}
  128. and a.type='GENERAL'
  129. ORDER BY a.create_time DESC
  130. </select>
  131. <select id="websitStockList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockVO">
  132. select
  133. ${ex.selected},
  134. d.category_name 'categoryName2'
  135. from websit_stock a
  136. join websit_goods b on a.goods_id = b.goods_id
  137. left join websit_goods_category c on b.parent_category_id = c.category_id
  138. left join websit_goods_category d on b.goods_category_id = d.category_id
  139. left join storage e on a.storage_id = e.storage_id
  140. ${ex.query}
  141. and a.goods_type='M'
  142. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  143. AND a.websit_id IN
  144. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  145. #{item}
  146. </foreach>
  147. </if>
  148. order by a.id desc
  149. </select>
  150. <select id="websitStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockPVO">
  151. select
  152. ${ex.selected}
  153. from websit_stock a
  154. join websit_goods b on a.goods_id = b.goods_code
  155. left join storage c on a.storage_id = c.storage_id
  156. ${ex.query}
  157. and a.goods_type='P'
  158. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  159. AND a.websit_id IN
  160. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  161. #{item}
  162. </foreach>
  163. </if>
  164. order by a.id desc
  165. </select>
  166. <select id="websitStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccVO">
  167. select
  168. ${ex.selected},
  169. d.category_name 'categoryName2'
  170. from websit_stock_acc a
  171. join websit_goods b on a.goods_id = b.goods_id
  172. left join websit_goods_category c on b.parent_category_id = c.category_id
  173. left join websit_goods_category d on b.goods_category_id = d.category_id
  174. left join storage e on a.storage_id = e.storage_id
  175. ${ex.query}
  176. and a.goods_type='M'
  177. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  178. AND a.websit_id IN
  179. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  180. #{item}
  181. </foreach>
  182. </if>
  183. order by a.id desc
  184. </select>
  185. <select id="websitStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccPVO">
  186. select
  187. ${ex.selected}
  188. from websit_stock_acc a
  189. join websit_goods b on a.goods_id = b.goods_code
  190. left join storage c on a.storage_id = c.storage_id
  191. ${ex.query}
  192. and a.goods_type='P'
  193. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  194. AND a.websit_id IN
  195. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  196. #{item}
  197. </foreach>
  198. </if>
  199. order by a.id desc
  200. </select>
  201. <select id="workerStockList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockVO">
  202. select
  203. ${ex.selected},
  204. d.category_name 'categoryName2'
  205. from worker_stock a
  206. join worker_goods b on a.goods_id = b.goods_id
  207. left join websit_goods_category c on b.parent_category_id = c.category_id
  208. left join websit_goods_category d on b.goods_category_id = d.category_id
  209. left join user e on e.worker_number = a.worker_id
  210. ${ex.query}
  211. and a.goods_type='M'
  212. <if test="workers != null and workers.size > 0">
  213. AND (
  214. a.worker_id IN
  215. <foreach item="item" index="index" collection="workers" open="(" separator="," close=")">
  216. #{item}
  217. </foreach>
  218. )
  219. </if>
  220. order by a.id desc
  221. </select>
  222. <select id="workerStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccVO">
  223. select
  224. ${ex.selected},
  225. d.category_name 'categoryName2'
  226. from worker_stock_acc a
  227. join worker_goods b on a.goods_id = b.goods_id
  228. left join websit_goods_category c on b.parent_category_id = c.category_id
  229. left join websit_goods_category d on b.goods_category_id = d.category_id
  230. left join user e on e.worker_number = a.worker_id
  231. ${ex.query}
  232. and a.goods_type='M'
  233. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  234. AND (
  235. a.websit_id IN
  236. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  237. #{item}
  238. </foreach>
  239. )
  240. </if>
  241. order by a.id desc
  242. </select>
  243. <select id="workerStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockPVO">
  244. select
  245. ${ex.selected}
  246. from worker_stock a
  247. join websit_goods b on a.goods_id = b.goods_code
  248. left join user e on e.worker_number = a.worker_id
  249. ${ex.query}
  250. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  251. AND (
  252. a.websit_id IN
  253. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  254. #{item}
  255. </foreach>
  256. )
  257. </if>
  258. and a.goods_type='P'
  259. order by a.id desc
  260. </select>
  261. <select id="workerStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccPVO">
  262. select
  263. ${ex.selected}
  264. from worker_stock_acc a
  265. join websit_goods b on a.goods_id = b.goods_code
  266. left join user e on e.worker_number = a.worker_id
  267. ${ex.query}
  268. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  269. AND (
  270. a.websit_id IN
  271. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  272. #{item}
  273. </foreach>
  274. )
  275. </if>
  276. and a.goods_type='P'
  277. order by a.id desc
  278. </select>
  279. <select id="amityList" resultType="com.gree.mall.manager.bean.common.AmityUrlVO">
  280. select
  281. a.*
  282. from amity_url a
  283. ${ex.query}
  284. AND a.del = 0
  285. <if test="ex.orderBy == null or ex.orderBy ==''">
  286. order by a.create_time desc
  287. </if>
  288. ${ex.orderBy}
  289. </select>
  290. <select id="orderSmallTypeList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderSmallTypeVO">
  291. select
  292. ${ex.selected}
  293. from order_small_type a
  294. ${ex.query}
  295. order by a.id desc
  296. </select>
  297. <select id="orderBaseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO">
  298. select
  299. ${ex.selected}
  300. from pg_order_base a
  301. ${ex.query}
  302. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  303. and a.order_small_type = #{ex.orderSmallType}
  304. </if>
  305. <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()">
  306. and a.order_status = #{ex.orderStatus.key}
  307. </if>
  308. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  309. and a.is_exception =1
  310. </if>
  311. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  312. and a.appointment_time is null and a.order_status in('DYY','DSHPG','DWDPG','DJD')
  313. </if>
  314. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJSQZ'.toString()">
  315. and a.id in(select order_base_id from websit_parts_apply where `status` = 'ING')
  316. </if>
  317. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYDH'.toString()">
  318. and a.id in(select order_base_id from websit_parts_apply where `status` = 'END')
  319. </if>
  320. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYQX'.toString()">
  321. and a.id in(select order_base_id from websit_parts_apply where `status` = 'CANCEL')
  322. </if>
  323. <if test="ex.isYb != null and ex.isYb == true">
  324. and a.pg_incre_item_id !=''
  325. </if>
  326. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  327. AND (
  328. a.websit_id IN
  329. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  330. #{item}
  331. </foreach>
  332. or
  333. a.create_websit_id IN
  334. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  335. #{item}
  336. </foreach>
  337. <if test="companyWechatId != null and companyWechatId != ''">
  338. or a.company_wechat_id = #{companyWechatId}
  339. </if>
  340. )
  341. </if>
  342. order by a.create_time desc,id desc
  343. </select>
  344. <select id="examineProjectConfigList"
  345. resultType="com.gree.mall.manager.bean.workorder.ExamineProjectConfigVO">
  346. SELECT
  347. ${ex.selected}
  348. FROM pg_examine_project_config a
  349. ${ex.query}
  350. AND a.del = 0
  351. <if test="ex.orderBy == null or ex.orderBy ==''">
  352. ORDER BY a.create_time DESC
  353. </if>
  354. </select>
  355. <select id="examineProjectList" resultType="com.gree.mall.manager.bean.workorder.ExamineProjectVO">
  356. SELECT
  357. ${ex.selected}
  358. FROM pg_examine_project a
  359. ${ex.query}
  360. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  361. AND
  362. a.websit_id IN
  363. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  364. #{item}
  365. </foreach>
  366. </if>
  367. <if test="ex.orderBy == null or ex.orderBy ==''">
  368. ORDER BY a.create_time DESC
  369. </if>
  370. </select>
  371. <select id="orderBaseAppraiseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseAppraiseVO">
  372. select
  373. ${ex.selected}
  374. from pg_order_base a
  375. ${ex.query}
  376. and a.appraise_status != 'N'
  377. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  378. AND (
  379. a.websit_id IN
  380. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  381. #{item}
  382. </foreach>
  383. )
  384. </if>
  385. order by a.id desc
  386. </select>
  387. <select id="installNormList" resultType="com.gree.mall.manager.bean.workorder.InstallSettleNormVO">
  388. SELECT
  389. ${ex.selected}
  390. FROM pg_settle_norm a
  391. ${ex.query}
  392. AND a.del = 0
  393. AND a.settle_norm_type = 'INSTALL'
  394. <if test="ex.orderBy == null or ex.orderBy ==''">
  395. ORDER BY a.type, a.parent_category_id, a.category_id
  396. </if>
  397. </select>
  398. <select id="repairNormList" resultType="com.gree.mall.manager.bean.workorder.RepairSettleNormVO">
  399. SELECT
  400. ${ex.selected}
  401. FROM pg_settle_norm a
  402. ${ex.query}
  403. AND a.del = 0
  404. AND a.settle_norm_type = 'REPAIR'
  405. <if test="ex.orderBy == null or ex.orderBy ==''">
  406. ORDER BY a.type, a.parent_category_id, a.category_id, a.label
  407. </if>
  408. </select>
  409. <select id="otherNormList" resultType="com.gree.mall.manager.bean.workorder.OtherSettleNormVO">
  410. SELECT
  411. ${ex.selected}
  412. FROM pg_settle_norm a
  413. ${ex.query}
  414. AND a.del = 0
  415. AND a.settle_norm_type = 'OTHER'
  416. <if test="ex.orderBy == null or ex.orderBy ==''">
  417. ORDER BY a.type, a.label
  418. </if>
  419. </select>
  420. <select id="settleOrderList" resultType="com.gree.mall.manager.bean.workorder.SettleOrderVO">
  421. SELECT
  422. ${ex.selected}
  423. FROM pg_settle_order a
  424. ${ex.query}
  425. <if test="websitIds != null and websitIds.size > 0">
  426. AND (
  427. a.websit_id IN
  428. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  429. #{item}
  430. </foreach>
  431. )
  432. </if>
  433. <if test="ex.orderBy == null or ex.orderBy ==''">
  434. ORDER BY a.create_time DESC
  435. </if>
  436. ${ex.orderBy}
  437. </select>
  438. <select id="settlePoolList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolVO">
  439. SELECT
  440. ${ex.selected}
  441. FROM pg_settle_pool a
  442. ${ex.query}
  443. <if test="websitIds != null and websitIds.size > 0">
  444. AND (
  445. a.websit_id IN
  446. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  447. #{item}
  448. </foreach>
  449. )
  450. </if>
  451. <if test="ex.orderBy == null or ex.orderBy ==''">
  452. ORDER BY a.pool_create_time DESC
  453. </if>
  454. ${ex.orderBy}
  455. </select>
  456. <select id="poolDetailList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolWorkerVO">
  457. SELECT
  458. a.*,
  459. b.id AS order_id,
  460. b.order_base_id,
  461. b.customer_name,
  462. b.customer_mobile,
  463. b.customer_address,
  464. b.order_status,
  465. b.order_create_time,
  466. b.worker_end_time,
  467. b.order_type,
  468. b.order_type_text,
  469. b.order_small_type,
  470. b.order_small_type_text,
  471. b.brand_id,
  472. b.brand,
  473. b.order_source,
  474. b.order_channel,
  475. b.parent_category_id,
  476. b.parent_category_name,
  477. b.category_id,
  478. b.category_name,
  479. b.goods_name,
  480. b.order_num,
  481. b.settle_order_type,
  482. b.install_id,
  483. b.install_label,
  484. b.install_norm_amount,
  485. b.repair_id,
  486. b.repair_label,
  487. b.repair_amount,
  488. b.repair_rate,
  489. b.repair_settle_amount,
  490. b.other_id,
  491. b.other_type,
  492. b.other_label,
  493. b.other_price,
  494. b.examine_project_id,
  495. b.examine_project,
  496. b.examine_type,
  497. b.settle_num,
  498. b.settle_amount
  499. FROM
  500. 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
  501. WHERE
  502. a.pool_id = #{id}
  503. <if test="workerName!=null and workerName!=''">
  504. AND a.worker_name LIKE CONCAT('%',#{workerName},'%')
  505. </if>
  506. <if test="mobile!=null and mobile!=''">
  507. AND a.worker_mobile LIKE CONCAT('%',#{mobile},'%')
  508. </if>
  509. <if test="idcard!=null and idcard!=''">
  510. AND a.worker_idcard LIKE CONCAT('%',#{idcard},'%')
  511. </if>
  512. <if test="orderBaseId!=null and orderBaseId!=''">
  513. AND b.order_base_id LIKE CONCAT('%',#{orderBaseId},'%')
  514. </if>
  515. <if test="customerName!=null and customerName!=''">
  516. AND b.customer_name LIKE CONCAT('%',#{customerName},'%')
  517. </if>
  518. <if test="customerMobile!=null and customerMobile!=''">
  519. AND b.customer_mobile LIKE CONCAT('%',#{customerMobile},'%')
  520. </if>
  521. <if test="orderSmallType!=null and orderSmallType!=''">
  522. AND b.order_small_type = #{orderSmallType}
  523. </if>
  524. <if test="settleOrderType!=null and settleOrderType!=''">
  525. AND b.settle_order_type = #{settleOrderType}
  526. </if>
  527. </select>
  528. <select id="userWaitList" resultType="com.gree.mall.manager.bean.listvo.workorder.UserWaitVO">
  529. SELECT
  530. ${ex.selected}
  531. FROM user_wait a
  532. ${ex.query}
  533. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  534. AND (
  535. a.websit_id IN
  536. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  537. #{item}
  538. </foreach>
  539. )
  540. </if>
  541. ${ex.orderBy}
  542. </select>
  543. <select id="buyServiceRecordList" resultType="com.gree.mall.manager.bean.serivce.BuyServiceRecordVO">
  544. SELECT
  545. ${ex.selected}
  546. FROM buy_service_record a
  547. ${ex.query}
  548. <if test="companyName != null and companyName !=''">
  549. AND a.company_name = #{companyName}
  550. </if>
  551. <if test="ex.orderBy == null or ex.orderBy ==''">
  552. ORDER BY a.create_time DESC
  553. </if>
  554. ${ex.orderBy}
  555. </select>
  556. <select id="increOrderSettleList" resultType="com.gree.mall.manager.bean.workorder.IncreOrderVO">
  557. SELECT
  558. ${ex.selected}
  559. FROM pg_incre_order a
  560. ${ex.query}
  561. <if test="isSettleList != null and isSettleList == true">
  562. AND a.settle_status IN ('OVER', 'EXCEPTION')
  563. </if>
  564. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  565. AND (
  566. a.websit_id IN
  567. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  568. #{item}
  569. </foreach>
  570. )
  571. </if>
  572. <if test="ex.orderBy == null or ex.orderBy ==''">
  573. ORDER BY a.create_time DESC
  574. </if>
  575. ${ex.orderBy}
  576. </select>
  577. <select id="websitOrderSettleCountList"
  578. resultType="com.gree.mall.manager.bean.workorder.WebsitOrderSettleCountVO">
  579. SELECT
  580. a.company_wechat_id,
  581. a.company_wechat_name,
  582. a.websit_id,
  583. a.websit_name,
  584. COUNT(a.id) AS order_num,
  585. SUM(a.amount) AS order_amount,
  586. SUM(a.websit_amount) AS websit_amount
  587. FROM pg_incre_order a
  588. ${ex.query}
  589. AND a.settle_status IN ('OVER', 'EXCEPTION')
  590. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  591. AND (
  592. a.websit_id IN
  593. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  594. #{item}
  595. </foreach>
  596. )
  597. </if>
  598. GROUP BY
  599. a.company_wechat_id, a.websit_id
  600. </select>
  601. <select id="projectRepairList" resultType="com.gree.mall.manager.bean.engin.ProjectRepairVO">
  602. SELECT
  603. ${ex.selected}
  604. FROM rp_project_repair a LEFT JOIN rp_project_repair_websit b ON a.id = b.project_repair_id
  605. ${ex.query}
  606. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  607. AND (
  608. b.websit_id IN
  609. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  610. #{item}
  611. </foreach>
  612. )
  613. </if>
  614. GROUP BY a.id
  615. <if test="ex.orderBy == null or ex.orderBy ==''">
  616. ORDER BY a.create_time DESC
  617. </if>
  618. ${ex.orderBy}
  619. </select>
  620. <select id="orderBaseList2" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBase2VO">
  621. SELECT
  622. ${ex.selected}
  623. FROM pg_order_base a
  624. JOIN pg_order_product b ON a.id = b.order_base_id
  625. JOIN pg_order_settle_norm c ON b.id = c.pg_order_product_id AND c.settle_norm_type IN ('INSTALL','REPAIR')
  626. ${ex.query}
  627. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  628. AND a.order_small_type = #{ex.orderSmallType}
  629. </if>
  630. <if test="ex.orderStatus != null and ex.orderStatus.key !='YCD'.toString() and ex.orderStatus.key !='DYY'.toString()">
  631. AND a.order_status = #{ex.orderStatus.key}
  632. </if>
  633. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  634. AND a.is_exception =1
  635. </if>
  636. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  637. AND a.appointment_time IS NULL
  638. </if>
  639. <if test="ex.isYb != null and ex.isYb == true">
  640. AND a.pg_incre_item_id !=''
  641. </if>
  642. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  643. AND (
  644. a.websit_id IN
  645. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  646. #{item}
  647. </foreach>
  648. OR
  649. a.create_websit_id IN
  650. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  651. #{item}
  652. </foreach>
  653. )
  654. </if>
  655. ORDER BY a.create_time DESC,id DESC
  656. </select>
  657. <select id="workerOrderSettleCountList"
  658. resultType="com.gree.mall.manager.bean.workorder.WorkerOrderSettleCountVO">
  659. SELECT
  660. a.company_wechat_id,
  661. a.company_wechat_name,
  662. a.worker_id,
  663. a.worker_name,
  664. a.worker_idcard,
  665. a.worker_mobile,
  666. COUNT(a.id) AS order_num,
  667. SUM(a.amount) AS order_amount,
  668. SUM(a.worker_amount) AS worker_amount
  669. FROM pg_incre_order a
  670. ${ex.query}
  671. AND a.settle_status IN ('OVER', 'EXCEPTION')
  672. AND a.worker_id <![CDATA[ <> ]]> ''
  673. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  674. AND (
  675. a.websit_id IN
  676. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  677. #{item}
  678. </foreach>
  679. )
  680. </if>
  681. GROUP BY
  682. a.company_wechat_id, a.worker_id
  683. </select>
  684. <select id="goodsMaterialList" resultType="com.gree.mall.manager.bean.goods.GoodsMaterialVO">
  685. SELECT
  686. ${ex.selected}
  687. FROM goods_material a
  688. ${ex.query}
  689. <if test="ex.orderBy == null or ex.orderBy ==''">
  690. ORDER BY a.create_time DESC
  691. </if>
  692. ${ex.orderBy}
  693. </select>
  694. <select id="goodsPurchaseList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseVO">
  695. SELECT
  696. ${ex.selected}
  697. FROM goods_purchase a
  698. ${ex.query}
  699. <if test="ex.orderBy == null or ex.orderBy ==''">
  700. ORDER BY a.create_time DESC
  701. </if>
  702. ${ex.orderBy}
  703. </select>
  704. <select id="goodsPurchaseItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseItemVO">
  705. SELECT
  706. ${ex.selected}
  707. FROM goods_purchase a JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  708. ${ex.query}
  709. <if test="ex.orderBy == null or ex.orderBy ==''">
  710. ORDER BY a.create_time DESC
  711. </if>
  712. ${ex.orderBy}
  713. </select>
  714. <select id="goodsPurchaseCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseCodeVO">
  715. SELECT
  716. ${ex.selected}
  717. FROM goods_purchase a
  718. JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  719. JOIN goods_purchase_code c ON b.id = c.goods_purchase_item_id
  720. ${ex.query}
  721. <if test="ex.orderBy == null or ex.orderBy ==''">
  722. ORDER BY a.create_time DESC, c.id DESC
  723. </if>
  724. ${ex.orderBy}
  725. </select>
  726. <select id="queryOrderInfoList" resultType="com.gree.mall.manager.bean.listvo.OrderInfoVO">
  727. SELECT
  728. ${ex.selected},
  729. if(a.order_status IN ('NOPAY','TIMEOUT'),"待支付","已支付") 'payStatus'
  730. from order_info a
  731. join order_detail b on a.order_id=b.order_id
  732. ${ex.query}
  733. and a.sale_type = 2
  734. <if test="ex.orderBy == null or ex.orderBy ==''">
  735. ORDER BY a.create_time DESC
  736. </if>
  737. ${ex.orderBy}
  738. </select>
  739. <select id="goodsPurchaseRetList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetVO">
  740. SELECT
  741. ${ex.selected}
  742. FROM goods_purchase_ret a
  743. ${ex.query}
  744. <if test="ex.orderBy == null or ex.orderBy ==''">
  745. ORDER BY a.create_time DESC
  746. </if>
  747. ${ex.orderBy}
  748. </select>
  749. <select id="goodsPurchaseRetItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetItemVO">
  750. SELECT
  751. ${ex.selected}
  752. FROM goods_purchase_ret a JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  753. ${ex.query}
  754. <if test="ex.orderBy == null or ex.orderBy ==''">
  755. ORDER BY a.create_time DESC
  756. </if>
  757. ${ex.orderBy}
  758. </select>
  759. <select id="goodsPurchaseRetCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetCodeVO">
  760. SELECT
  761. ${ex.selected}
  762. FROM goods_purchase_ret a
  763. JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  764. JOIN goods_purchase_ret_code c ON b.id = c.goods_purchase_ret_item_id
  765. ${ex.query}
  766. <if test="ex.orderBy == null or ex.orderBy ==''">
  767. ORDER BY a.create_time DESC, c.id DESC
  768. </if>
  769. ${ex.orderBy}
  770. </select>
  771. <select id="goodsMaterialStockAccList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsMaterialStockAccVO">
  772. SELECT
  773. ${ex.selected}
  774. FROM goods_material_stock_acc a
  775. ${ex.query}
  776. <if test="ex.orderBy == null or ex.orderBy ==''">
  777. ORDER BY a.create_time DESC
  778. </if>
  779. ${ex.orderBy}
  780. </select>
  781. <select id="orderEnginBaseList" resultType="com.gree.mall.manager.bean.engin.OrderEnginBaseVO">
  782. SELECT
  783. ${ex.selected}
  784. FROM order_engin_base a
  785. ${ex.query}
  786. <if test="ex.orderBy == null or ex.orderBy ==''">
  787. ORDER BY a.create_time DESC
  788. </if>
  789. ${ex.orderBy}
  790. </select>
  791. <select id="punishOrderList" resultType="com.gree.mall.manager.bean.listvo.order.PunishOrderVO">
  792. SELECT
  793. ${ex.selected}
  794. FROM punish_order a
  795. join punish_order_worker b on a.id = b.punish_order_id
  796. join punish_order_product c on a.id = c.punish_order_id
  797. ${ex.query}
  798. <if test="ex.examineStatus != null">
  799. and a.status = #{ex.examineStatus.key}
  800. </if>
  801. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  802. AND a.websit_id IN
  803. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  804. #{item}
  805. </foreach>
  806. </if>
  807. <if test="ex.orderBy == null or ex.orderBy ==''">
  808. ORDER BY a.create_time DESC
  809. </if>
  810. ${ex.orderBy}
  811. </select>
  812. <select id="orderOfflineRefundList" resultType="com.gree.mall.manager.bean.order.refund.OrderOfflineRefundVO">
  813. SELECT
  814. ${ex.selected}
  815. from order_offline_refund a
  816. join order_info b on a.order_id = b.order_id
  817. ${ex.query}
  818. ORDER BY a.create_time DESC
  819. </select>
  820. <select id="workerSettleExpenseGatherList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseVO">
  821. SELECT
  822. ${ex.selected}
  823. FROM settle_expense a
  824. ${ex.query}
  825. <if test="ex.orderBy == null or ex.orderBy ==''">
  826. ORDER BY a.create_time DESC
  827. </if>
  828. ${ex.orderBy}
  829. </select>
  830. <select id="workerSettleExpenseList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseItemVO">
  831. SELECT
  832. ${ex.selected}
  833. FROM settle_expense_item a JOIN settle_expense b ON a.settle_expense_id = b.id
  834. ${ex.query}
  835. <if test="workerId != null">
  836. AND (a.worker_name1 = #{workerId} OR a.worker_name2 = #{workerId})
  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="settleMonthWagesGatherList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesVO">
  844. SELECT
  845. ${ex.selected}
  846. FROM settle_month_wages a
  847. ${ex.query}
  848. <if test="ex.orderBy == null or ex.orderBy ==''">
  849. ORDER BY a.create_time DESC
  850. </if>
  851. ${ex.orderBy}
  852. </select>
  853. <select id="settleMonthWagesList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesWorkerVO">
  854. SELECT
  855. ${ex.selected}
  856. FROM settle_month_wages_worker a LEFT JOIN settle_month_wages_detail b ON a.settle_month_wages_detail_id = b.id
  857. ${ex.query}
  858. <if test="ex.orderBy == null or ex.orderBy ==''">
  859. ORDER BY a.worker_id DESC
  860. </if>
  861. ${ex.orderBy}
  862. </select>
  863. <select id="goodsLeaseList" resultType="com.gree.mall.manager.bean.goods.GoodsLeaseBean">
  864. SELECT
  865. a.*
  866. FROM goods_lease a
  867. WHERE
  868. a.del = 0
  869. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  870. AND a.company_wechat_id in
  871. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  872. #{companyWechatId}
  873. </foreach>
  874. </if>
  875. <if test="keyword != null and keyword != ''">
  876. AND
  877. (a.id LIKE CONCAT('%', #{keyword},'%') OR a.name LIKE CONCAT('%',#{keyword},'%') OR a.category_name
  878. LIKE CONCAT('%',#{keyword},'%'))
  879. </if>
  880. <if test="startPrice != null and endPrice != null">
  881. AND
  882. a.lease_price BETWEEN #{startPrice} AND #{endPrice}
  883. </if>
  884. <if test="startDeposit != null and endDeposit != null">
  885. AND
  886. a.deposit_price BETWEEN #{startDeposit} AND #{endDeposit}
  887. </if>
  888. <if test="categoryIds != null and categoryIds.size() != 0">
  889. AND
  890. a.category_id IN
  891. <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
  892. #{item}
  893. </foreach>
  894. </if>
  895. <if test="status != null">
  896. AND
  897. a.status = #{status}
  898. </if>
  899. <choose>
  900. <when test="sortStr == null">
  901. ORDER BY a.sort DESC,a.create_time DESC
  902. </when>
  903. <otherwise>
  904. ORDER BY a.sort DESC,${sortStr},a.create_time DESC
  905. </otherwise>
  906. </choose>
  907. </select>
  908. <select id="leaseOrderList" resultType="com.gree.mall.manager.bean.order.LeaseOrderVO">
  909. SELECT
  910. a.*,
  911. b.category_id,
  912. b.category_name,
  913. b.category_url,
  914. b.goods_lease_id,
  915. b.goods_lease_name,
  916. b.goods_unit,
  917. b.qty,
  918. b.deposit_price,
  919. b.lease_price,
  920. b.start_date,
  921. b.end_date,
  922. b.real_end_date
  923. FROM
  924. lease_order a LEFT JOIN lease_order_item b ON a.id = b.lease_order_id
  925. WHERE
  926. a.pay_status = 1
  927. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  928. AND a.company_wechat_id in
  929. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  930. #{companyWechatId}
  931. </foreach>
  932. </if>
  933. <if test="orderId != null and orderId != ''">
  934. AND a.id LIKE CONCAT('%', #{orderId},'%')
  935. </if>
  936. <if test="goodsName != null and goodsName != ''">
  937. AND b.goods_lease_name LIKE CONCAT('%', #{goodsName},'%')
  938. </if>
  939. <if test="userName != null and userName != ''">
  940. AND a.user_name LIKE CONCAT('%', #{userName},'%')
  941. </if>
  942. <if test="userMobile != null and userMobile != ''">
  943. AND a.user_mobile LIKE CONCAT('%', #{userMobile},'%')
  944. </if>
  945. <if test="status != null and status != ''">
  946. AND a.status = #{status}
  947. </if>
  948. <if test="startDate != null and endDate != null">
  949. AND
  950. a.create_time BETWEEN #{startDate} AND #{endDate}
  951. </if>
  952. <if test="startPayDate != null and endPayDate != null">
  953. AND
  954. a.pay_time BETWEEN #{startPayDate} AND #{endPayDate}
  955. </if>
  956. ORDER BY a.create_time DESC
  957. </select>
  958. <select id="goodsLibraryList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsLibraryVO">
  959. SELECT
  960. ${ex.selected}
  961. FROM goods_library a
  962. join goods_library_spec b on a.goods_library_id = b.goods_library_id
  963. ${ex.query}
  964. group by a.goods_library_id
  965. ORDER BY a.update_time DESC
  966. </select>
  967. <select id="promotionQuestionnairList" resultType="com.gree.mall.manager.bean.listvo.PromotionQuestionnairVO">
  968. SELECT
  969. ${ex.selected},
  970. if(is_stop=1,'已终止',if(a.start_time > now(),'待生效',if(now() between a.start_time and a.end_time,'生效中','已过期'))) 'statusText'
  971. FROM promotion_questionnaire a
  972. ${ex.query}
  973. <if test="status != null">
  974. <if test="status == 0">
  975. and a.start_time > now()
  976. </if>
  977. <if test="status == 1">
  978. and now() between a.start_time and a.end_time and is_stop=0
  979. </if>
  980. <if test="status == 2">
  981. and a.end_time &lt; now()
  982. </if>
  983. <if test="status == 3">
  984. and a.is_stop = 1
  985. </if>
  986. </if>
  987. ORDER BY a.create_time DESC
  988. </select>
  989. <select id="promotionActivityList" resultType="com.gree.mall.manager.bean.activity.PromotionActivityVO">
  990. SELECT
  991. ${ex.selected},
  992. b.create_by AS orderCreateBy,
  993. b.create_time AS orderCreateTime,
  994. b.create_mobile AS orderCreateMobile
  995. FROM
  996. promotion_activity a LEFT JOIN promotion_questionnaire b ON a.promotion_questionnaire_id = b.id
  997. ${ex.query}
  998. <if test="ex.orderBy == null or ex.orderBy ==''">
  999. ORDER BY a.create_time DESC
  1000. </if>
  1001. ${ex.orderBy}
  1002. </select>
  1003. <select id="esGoodsList" resultType="com.gree.mall.manager.bean.es.ESGoodsVO">
  1004. SELECT
  1005. ${ex.selected}
  1006. FROM
  1007. es_goods a
  1008. ${ex.query}
  1009. AND a.del = 0
  1010. <if test="ex.orderBy == null or ex.orderBy ==''">
  1011. ORDER BY a.create_time DESC
  1012. </if>
  1013. ${ex.orderBy}
  1014. </select>
  1015. <select id="esGoodsMessageList" resultType="com.gree.mall.manager.bean.es.EsGoodsMessageVO">
  1016. SELECT
  1017. a.*,
  1018. b.content AS replyContent,
  1019. b.reply_time,
  1020. b.reply_by
  1021. FROM
  1022. es_goods_message a LEFT JOIN es_goods_message_reply b ON a.id = b.es_goods_message_id
  1023. WHERE
  1024. a.es_goods_id = #{id}
  1025. </select>
  1026. <select id="adminCompanyPayConfigList"
  1027. resultType="com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO">
  1028. SELECT
  1029. ${ex.selected}
  1030. FROM
  1031. admin_company_wechat_pay_config a
  1032. ${ex.query}
  1033. AND a.del = 0
  1034. <if test="ex.orderBy == null or ex.orderBy ==''">
  1035. ORDER BY a.create_time DESC
  1036. </if>
  1037. ${ex.orderBy}
  1038. </select>
  1039. <select id="repairSettleBankAccountList"
  1040. resultType="com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO">
  1041. SELECT
  1042. ${ex.selected}
  1043. FROM
  1044. settle_daily_bank_account a
  1045. ${ex.query}
  1046. <if test="ex.orderBy == null or ex.orderBy ==''">
  1047. ORDER BY a.create_time DESC
  1048. </if>
  1049. ${ex.orderBy}
  1050. </select>
  1051. <select id="repairSettleDailyWithholdList"
  1052. resultType="com.gree.mall.manager.bean.settle.repair.DailyWithholdVO">
  1053. SELECT
  1054. ${ex.selected}
  1055. FROM
  1056. settle_daily_withhold a
  1057. ${ex.query}
  1058. <if test="ex.orderBy == null or ex.orderBy ==''">
  1059. ORDER BY a.create_time DESC
  1060. </if>
  1061. ${ex.orderBy}
  1062. </select>
  1063. <select id="repairSettleDailyImportSummaryList"
  1064. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryVO">
  1065. SELECT
  1066. a.company_wechat_id,
  1067. a.company_wechat_name,
  1068. a.import_batch_no,
  1069. COUNT(DISTINCT a.repair_worker_mobile) AS personNums,
  1070. COUNT(1) AS 'orderNums',
  1071. SUM(a.total_fee) AS 'totalAmount',
  1072. IF(find_in_set('1', group_concat(DISTINCT a.summary_status)) > 0 , 1, 2) AS 'summaryStatus',
  1073. import_by ,
  1074. import_time ,
  1075. group_concat(DISTINCT summary_by) AS 'summaryBy',
  1076. summary_time AS 'summaryTime',
  1077. group_concat(DISTINCT summary_batch_no) AS 'summaryBatchNo' ,
  1078. group_concat(DISTINCT month) AS 'month'
  1079. FROM
  1080. settle_daily_import_summary_item a
  1081. ${ex.query}
  1082. GROUP BY
  1083. a.company_wechat_id, a.import_batch_no
  1084. <if test="ex.orderBy == null or ex.orderBy ==''">
  1085. ORDER BY a.create_time DESC
  1086. </if>
  1087. ${ex.orderBy}
  1088. </select>
  1089. <select id="repairDetailList"
  1090. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryItemVO">
  1091. SELECT
  1092. ${ex.selected}
  1093. FROM
  1094. settle_daily_import_summary_item a
  1095. ${ex.query}
  1096. <if test="ex.orderBy == null or ex.orderBy ==''">
  1097. ORDER BY a.create_time DESC
  1098. </if>
  1099. ${ex.orderBy}
  1100. </select>
  1101. <select id="reduceCountList"
  1102. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostCountVO">
  1103. SELECT
  1104. company_wechat_id,
  1105. company_wechat_name,
  1106. import_batch_no,
  1107. count(service_number) personNums,
  1108. count(id) orderNums,
  1109. sum(cost_amount) totalAmount,
  1110. do_status,
  1111. import_by,
  1112. import_time,
  1113. do_by,
  1114. do_time,
  1115. do_batch_no
  1116. FROM
  1117. settle_daily_incr_decr_cost a
  1118. ${ex.query}
  1119. GROUP BY a.company_wechat_id, a.import_batch_no
  1120. <if test="ex.orderBy == null or ex.orderBy ==''">
  1121. ORDER BY a.create_time DESC
  1122. </if>
  1123. ${ex.orderBy}
  1124. </select>
  1125. <select id="repairSettleDailyincrDecrCostList"
  1126. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostVO">
  1127. SELECT
  1128. ${ex.selected}
  1129. FROM
  1130. settle_daily_incr_decr_cost a
  1131. ${ex.query}
  1132. <if test="ex.orderBy == null or ex.orderBy ==''">
  1133. ORDER BY a.create_time DESC
  1134. </if>
  1135. ${ex.orderBy}
  1136. </select>
  1137. <select id="reduceTotalList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostGatherVO">
  1138. SELECT
  1139. company_wechat_id,
  1140. company_wechat_name,
  1141. COUNT(DISTINCT repair_worker_mobile) AS 'personNums',
  1142. COUNT(1) AS 'orderNums',
  1143. SUM(total_fee) AS 'totalAmount',
  1144. import_by ,
  1145. import_time ,
  1146. import_batch_no,
  1147. do_status,
  1148. do_by ,
  1149. do_time ,
  1150. do_batch_no
  1151. FROM
  1152. settle_daily_reduce_cost a
  1153. ${ex.query}
  1154. GROUP BY a.company_wechat_id, a.import_batch_no
  1155. <if test="ex.orderBy == null or ex.orderBy ==''">
  1156. ORDER BY a.create_time DESC
  1157. </if>
  1158. ${ex.orderBy}
  1159. </select>
  1160. <select id="reduceList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostVO">
  1161. SELECT
  1162. ${ex.selected}
  1163. FROM
  1164. settle_daily_reduce_cost a
  1165. ${ex.query}
  1166. <if test="ex.orderBy == null or ex.orderBy ==''">
  1167. ORDER BY a.create_time DESC
  1168. </if>
  1169. ${ex.orderBy}
  1170. </select>
  1171. <select id="buckleList" resultType="com.gree.mall.manager.bean.settle.repair.WorkerWaitBuckleVO">
  1172. SELECT
  1173. ${ex.selected}
  1174. FROM
  1175. settle_daily_remaine_buckle a
  1176. JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1177. JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1178. ${ex.query}
  1179. GROUP BY a.company_wechat_id, a.idcard
  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="transferList"
  1186. resultType="com.gree.mall.manager.bean.settle.repair.SettleDailyBankTransferRecordVO">
  1187. SELECT
  1188. ${ex.selected}
  1189. FROM
  1190. settle_daily_bank_transfer_record a
  1191. ${ex.query}
  1192. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1193. AND a.company_wechat_id IN
  1194. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1195. #{item}
  1196. </foreach>
  1197. </if>
  1198. <if test="ex.orderBy == null or ex.orderBy ==''">
  1199. ORDER BY a.create_time DESC
  1200. </if>
  1201. ${ex.orderBy}
  1202. </select>
  1203. <select id="repairAllList" resultType="com.gree.mall.manager.bean.settle.repair.AllDailyImportSummaryItemVO">
  1204. SELECT
  1205. ${ex.selected}
  1206. FROM
  1207. settle_daily_import_summary_item a
  1208. LEFT JOIN settle_daily_reduce_cost sdrc on a.dispatch_order_no = sdrc.dispatch_order_no
  1209. LEFT JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1210. LEFT JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1211. LEFT JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  1212. ${ex.query}
  1213. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1214. AND a.company_wechat_id IN
  1215. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1216. #{item}
  1217. </foreach>
  1218. </if>
  1219. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1220. AND a.websit_number IN
  1221. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1222. #{item}
  1223. </foreach>
  1224. </if>
  1225. GROUP BY a.id
  1226. <if test="ex.orderBy == null or ex.orderBy ==''">
  1227. ORDER BY a.create_time, a.id DESC
  1228. </if>
  1229. ${ex.orderBy}
  1230. </select>
  1231. <select id="repairAllCount" resultType="java.lang.Integer">
  1232. SELECT
  1233. COUNT(1)
  1234. FROM
  1235. settle_daily_import_summary_item a JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  1236. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1237. AND a.company_wechat_id IN
  1238. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1239. #{item}
  1240. </foreach>
  1241. </if>
  1242. <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
  1243. AND a.websit_number IN
  1244. <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
  1245. #{item}
  1246. </foreach>
  1247. </if>
  1248. WHERE
  1249. c.status = #{status}
  1250. </select>
  1251. </mapper>