CommonMapper.xml 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  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. b.websit_id,
  81. c.name as 'websit_name',
  82. d.nick_name as 'slaveWorkerName'
  83. from user a
  84. join websit_user b on a.user_id = b.user_id
  85. join admin_websit c on c.websit_id = b.websit_id
  86. left join user d on b.slave_worker_id = d.user_id
  87. ${ex.query}
  88. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  89. AND c.websit_id IN
  90. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  91. #{item}
  92. </foreach>
  93. </if>
  94. and a.apply_type='WORKER'
  95. ORDER BY FIELD(b.examine_status,'WAIT','OK','FAIL'),a.create_time DESC
  96. </select>
  97. <select id="userServiceList" resultType="com.gree.mall.manager.bean.listvo.User2VO">
  98. select
  99. ${ex.selected}
  100. from user a
  101. ${ex.query}
  102. and a.apply_type='SERVICE'
  103. ORDER BY FIELD(a.examine_status,'WAIT','OK','FAIL'),a.create_time DESC
  104. </select>
  105. <select id="userCustomerList" resultType="com.gree.mall.manager.bean.listvo.UserCustomerVO">
  106. select
  107. ${ex.selected},
  108. b.nick_name as 'serviceName',
  109. b.mobile as 'serviceMobile',
  110. c.nick_name as 'firstServiceName',
  111. c.mobile as 'firstServiceMobile'
  112. from user a
  113. left join user b on a.service_id = b.user_id
  114. left join user c on a.first_service_id = c.user_id
  115. ${ex.query}
  116. and a.type='GENERAL'
  117. ORDER BY a.create_time DESC
  118. </select>
  119. <select id="websitStockList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockVO">
  120. select
  121. ${ex.selected},
  122. d.category_name 'categoryName2'
  123. from websit_stock a
  124. join websit_goods b on a.goods_id = b.goods_id
  125. left join websit_goods_category c on b.parent_category_id = c.category_id
  126. left join websit_goods_category d on b.goods_category_id = d.category_id
  127. left join storage e on a.storage_id = e.storage_id
  128. ${ex.query}
  129. and a.goods_type='M'
  130. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  131. AND a.websit_id IN
  132. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  133. #{item}
  134. </foreach>
  135. </if>
  136. order by a.id desc
  137. </select>
  138. <select id="websitStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockPVO">
  139. select
  140. ${ex.selected}
  141. from websit_stock a
  142. join websit_goods b on a.goods_id = b.goods_id
  143. left join storage c on a.storage_id = c.storage_id
  144. ${ex.query}
  145. and a.goods_type='P'
  146. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  147. AND a.websit_id IN
  148. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  149. #{item}
  150. </foreach>
  151. </if>
  152. order by a.id desc
  153. </select>
  154. <select id="websitStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccVO">
  155. select
  156. ${ex.selected},
  157. d.category_name 'categoryName2'
  158. from websit_stock_acc a
  159. join websit_goods b on a.goods_id = b.goods_id
  160. left join websit_goods_category c on b.parent_category_id = c.category_id
  161. left join websit_goods_category d on b.goods_category_id = d.category_id
  162. left join storage e on a.storage_id = e.storage_id
  163. ${ex.query}
  164. and a.goods_type='M'
  165. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  166. AND a.websit_id IN
  167. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  168. #{item}
  169. </foreach>
  170. </if>
  171. order by a.id desc
  172. </select>
  173. <select id="websitStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WebsitStockAccPVO">
  174. select
  175. ${ex.selected}
  176. from websit_stock_acc a
  177. join websit_goods b on a.goods_id = b.goods_id
  178. left join storage c on a.storage_id = c.storage_id
  179. ${ex.query}
  180. and a.goods_type='P'
  181. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  182. AND a.websit_id IN
  183. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  184. #{item}
  185. </foreach>
  186. </if>
  187. order by a.id desc
  188. </select>
  189. <select id="workerStockList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockVO">
  190. select
  191. ${ex.selected},
  192. d.category_name 'categoryName2'
  193. from worker_stock a
  194. join websit_goods b on a.goods_id = b.goods_id
  195. left join websit_goods_category c on b.parent_category_id = c.category_id
  196. left join websit_goods_category d on b.goods_category_id = d.category_id
  197. join user e on e.user_id = a.worker_id
  198. ${ex.query}
  199. and a.goods_type='M'
  200. order by a.id desc
  201. </select>
  202. <select id="workerStockAccList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccVO">
  203. select
  204. ${ex.selected},
  205. d.category_name 'categoryName2'
  206. from worker_stock_acc a
  207. join websit_goods b on a.goods_id = b.goods_id
  208. left join websit_goods_category c on b.parent_category_id = c.category_id
  209. left join websit_goods_category d on b.goods_category_id = d.category_id
  210. join user e on e.user_id = a.worker_id
  211. ${ex.query}
  212. and a.goods_type='M'
  213. order by a.id desc
  214. </select>
  215. <select id="workerStockPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockPVO">
  216. select
  217. ${ex.selected}
  218. from worker_stock a
  219. join websit_goods b on a.goods_id = b.goods_id
  220. join user e on e.user_id = a.worker_id
  221. ${ex.query}
  222. and a.goods_type='P'
  223. order by a.id desc
  224. </select>
  225. <select id="workerStockAccPList" resultType="com.gree.mall.manager.bean.listvo.material.WorkerStockAccPVO">
  226. select
  227. ${ex.selected}
  228. from worker_stock_acc a
  229. join websit_goods b on a.goods_id = b.goods_id
  230. join user e on e.user_id = a.worker_id
  231. ${ex.query}
  232. and a.goods_type='P'
  233. order by a.id desc
  234. </select>
  235. <select id="amityList" resultType="com.gree.mall.manager.bean.common.AmityUrlVO">
  236. select
  237. a.*
  238. from amity_url a
  239. ${ex.query}
  240. AND a.del = 0
  241. <if test="ex.orderBy == null or ex.orderBy ==''">
  242. order by a.create_time desc
  243. </if>
  244. ${ex.orderBy}
  245. </select>
  246. <select id="orderSmallTypeList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderSmallTypeVO">
  247. select
  248. ${ex.selected}
  249. from order_small_type a
  250. ${ex.query}
  251. order by a.id desc
  252. </select>
  253. <select id="orderBaseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO">
  254. select
  255. ${ex.selected}
  256. from pg_order_base a
  257. ${ex.query}
  258. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  259. and a.order_small_type = #{ex.orderSmallType}
  260. </if>
  261. <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()">
  262. and a.order_status = #{ex.orderStatus.key}
  263. </if>
  264. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  265. and a.is_exception =1
  266. </if>
  267. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  268. and a.appointment_time is null and a.order_status in('DYY','DSHPG','DWDPG','DJD')
  269. </if>
  270. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJSQZ'.toString()">
  271. and a.id in(select order_base_id from websit_parts_apply where `status` = 'ING')
  272. </if>
  273. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYDH'.toString()">
  274. and a.id in(select order_base_id from websit_parts_apply where `status` = 'END')
  275. </if>
  276. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYQX'.toString()">
  277. and a.id in(select order_base_id from websit_parts_apply where `status` = 'CANCEL')
  278. </if>
  279. <if test="ex.isYb != null and ex.isYb == true">
  280. and a.pg_incre_item_id !=''
  281. </if>
  282. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  283. AND (
  284. a.websit_id IN
  285. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  286. #{item}
  287. </foreach>
  288. or
  289. a.create_websit_id IN
  290. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  291. #{item}
  292. </foreach>
  293. )
  294. </if>
  295. order by a.create_time desc,id desc
  296. </select>
  297. <select id="examineProjectConfigList"
  298. resultType="com.gree.mall.manager.bean.workorder.ExamineProjectConfigVO">
  299. SELECT
  300. ${ex.selected}
  301. FROM pg_examine_project_config a
  302. ${ex.query}
  303. AND a.del = 0
  304. <if test="ex.orderBy == null or ex.orderBy ==''">
  305. ORDER BY a.create_time DESC
  306. </if>
  307. </select>
  308. <select id="examineProjectList" resultType="com.gree.mall.manager.bean.workorder.ExamineProjectVO">
  309. SELECT
  310. ${ex.selected}
  311. FROM pg_examine_project a
  312. ${ex.query}
  313. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  314. AND
  315. a.websit_id IN
  316. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  317. #{item}
  318. </foreach>
  319. </if>
  320. <if test="ex.orderBy == null or ex.orderBy ==''">
  321. ORDER BY a.create_time DESC
  322. </if>
  323. </select>
  324. <select id="orderBaseAppraiseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseAppraiseVO">
  325. select
  326. ${ex.selected}
  327. from pg_order_base a
  328. ${ex.query}
  329. and a.appraise_status != 'N'
  330. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  331. AND (
  332. a.websit_id IN
  333. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  334. #{item}
  335. </foreach>
  336. )
  337. </if>
  338. order by a.id desc
  339. </select>
  340. <select id="installNormList" resultType="com.gree.mall.manager.bean.workorder.InstallSettleNormVO">
  341. SELECT
  342. ${ex.selected}
  343. FROM pg_settle_norm a
  344. ${ex.query}
  345. AND a.del = 0
  346. AND a.settle_norm_type = 'INSTALL'
  347. <if test="ex.orderBy == null or ex.orderBy ==''">
  348. ORDER BY a.type, a.parent_category_id, a.category_id
  349. </if>
  350. </select>
  351. <select id="repairNormList" resultType="com.gree.mall.manager.bean.workorder.RepairSettleNormVO">
  352. SELECT
  353. ${ex.selected}
  354. FROM pg_settle_norm a
  355. ${ex.query}
  356. AND a.del = 0
  357. AND a.settle_norm_type = 'REPAIR'
  358. <if test="ex.orderBy == null or ex.orderBy ==''">
  359. ORDER BY a.type, a.parent_category_id, a.category_id, a.label
  360. </if>
  361. </select>
  362. <select id="otherNormList" resultType="com.gree.mall.manager.bean.workorder.OtherSettleNormVO">
  363. SELECT
  364. ${ex.selected}
  365. FROM pg_settle_norm a
  366. ${ex.query}
  367. AND a.del = 0
  368. AND a.settle_norm_type = 'OTHER'
  369. <if test="ex.orderBy == null or ex.orderBy ==''">
  370. ORDER BY a.type, a.label
  371. </if>
  372. </select>
  373. <select id="settleOrderList" resultType="com.gree.mall.manager.bean.workorder.SettleOrderVO">
  374. SELECT
  375. ${ex.selected}
  376. FROM pg_settle_order a
  377. ${ex.query}
  378. <if test="websitId != null and websitId != ''">
  379. AND a.websit_id = #{websitId}
  380. </if>
  381. <if test="ex.orderBy == null or ex.orderBy ==''">
  382. ORDER BY a.create_time DESC
  383. </if>
  384. ${ex.orderBy}
  385. </select>
  386. <select id="settlePoolList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolVO">
  387. SELECT
  388. ${ex.selected}
  389. FROM pg_settle_pool a
  390. ${ex.query}
  391. <if test="websitId != null and websitId != ''">
  392. AND a.websit_id = #{websitId}
  393. </if>
  394. <if test="ex.orderBy == null or ex.orderBy ==''">
  395. ORDER BY a.pool_create_time DESC
  396. </if>
  397. ${ex.orderBy}
  398. </select>
  399. <select id="poolDetailList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolWorkerVO">
  400. SELECT
  401. a.*,
  402. b.id AS order_id,
  403. b.order_base_id,
  404. b.customer_name,
  405. b.customer_mobile,
  406. b.customer_address,
  407. b.order_status,
  408. b.order_create_time,
  409. b.worker_end_time,
  410. b.order_type,
  411. b.order_type_text,
  412. b.order_small_type,
  413. b.order_small_type_text,
  414. b.brand_id,
  415. b.brand,
  416. b.order_source,
  417. b.order_channel,
  418. b.parent_category_id,
  419. b.parent_category_name,
  420. b.category_id,
  421. b.category_name,
  422. b.goods_name,
  423. b.order_num,
  424. b.settle_order_type,
  425. b.install_id,
  426. b.install_label,
  427. b.install_norm_amount,
  428. b.repair_id,
  429. b.repair_label,
  430. b.repair_amount,
  431. b.repair_rate,
  432. b.repair_settle_amount,
  433. b.other_id,
  434. b.other_type,
  435. b.other_label,
  436. b.other_price,
  437. b.examine_project_id,
  438. b.examine_project,
  439. b.examine_type,
  440. b.settle_num,
  441. b.settle_amount
  442. FROM
  443. 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
  444. WHERE
  445. a.pool_id = #{id}
  446. <if test="workerName!=null and workerName!=''">
  447. AND a.worker_name LIKE CONCAT('%',#{workerName},'%')
  448. </if>
  449. <if test="mobile!=null and mobile!=''">
  450. AND a.worker_mobile LIKE CONCAT('%',#{mobile},'%')
  451. </if>
  452. <if test="idcard!=null and idcard!=''">
  453. AND a.worker_idcard LIKE CONCAT('%',#{idcard},'%')
  454. </if>
  455. <if test="orderBaseId!=null and orderBaseId!=''">
  456. AND b.order_base_id LIKE CONCAT('%',#{orderBaseId},'%')
  457. </if>
  458. <if test="customerName!=null and customerName!=''">
  459. AND b.customer_name LIKE CONCAT('%',#{customerName},'%')
  460. </if>
  461. <if test="customerMobile!=null and customerMobile!=''">
  462. AND b.customer_mobile LIKE CONCAT('%',#{customerMobile},'%')
  463. </if>
  464. <if test="orderSmallType!=null and orderSmallType!=''">
  465. AND b.order_small_type = #{orderSmallType}
  466. </if>
  467. <if test="settleOrderType!=null and settleOrderType!=''">
  468. AND b.settle_order_type = #{settleOrderType}
  469. </if>
  470. </select>
  471. <select id="userWaitList" resultType="com.gree.mall.manager.bean.listvo.workorder.UserWaitVO">
  472. SELECT
  473. ${ex.selected}
  474. FROM user_wait a
  475. ${ex.query}
  476. ${ex.orderBy}
  477. </select>
  478. <select id="buyServiceRecordList" resultType="com.gree.mall.manager.bean.serivce.BuyServiceRecordVO">
  479. SELECT
  480. ${ex.selected}
  481. FROM buy_service_record a
  482. ${ex.query}
  483. <if test="companyName != null and companyName !=''">
  484. AND a.company_name = #{companyName}
  485. </if>
  486. <if test="ex.orderBy == null or ex.orderBy ==''">
  487. ORDER BY a.create_time DESC
  488. </if>
  489. ${ex.orderBy}
  490. </select>
  491. <select id="increOrderSettleList" resultType="com.gree.mall.manager.bean.workorder.IncreOrderVO">
  492. SELECT
  493. ${ex.selected}
  494. FROM pg_incre_order a
  495. ${ex.query}
  496. <if test="isSettleList != null and isSettleList == true">
  497. AND a.settle_status IN ('OVER', 'EXCEPTION')
  498. </if>
  499. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  500. AND (
  501. a.websit_id IN
  502. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  503. #{item}
  504. </foreach>
  505. )
  506. </if>
  507. <if test="ex.orderBy == null or ex.orderBy ==''">
  508. ORDER BY a.create_time DESC
  509. </if>
  510. ${ex.orderBy}
  511. </select>
  512. <select id="websitOrderSettleCountList"
  513. resultType="com.gree.mall.manager.bean.workorder.WebsitOrderSettleCountVO">
  514. SELECT
  515. a.company_wechat_id,
  516. a.company_wechat_name,
  517. a.websit_id,
  518. a.websit_name,
  519. COUNT(a.id) AS order_num,
  520. SUM(a.amount) AS order_amount,
  521. SUM(a.websit_amount) AS websit_amount
  522. FROM pg_incre_order a
  523. ${ex.query}
  524. AND a.settle_status IN ('OVER', 'EXCEPTION')
  525. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  526. AND (
  527. a.websit_id IN
  528. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  529. #{item}
  530. </foreach>
  531. )
  532. </if>
  533. GROUP BY
  534. a.company_wechat_id, a.websit_id
  535. </select>
  536. <select id="projectRepairList" resultType="com.gree.mall.manager.bean.engin.ProjectRepairVO">
  537. SELECT
  538. ${ex.selected}
  539. FROM rp_project_repair a LEFT JOIN rp_project_repair_websit b ON a.id = b.project_repair_id
  540. ${ex.query}
  541. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  542. AND (
  543. b.websit_id IN
  544. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  545. #{item}
  546. </foreach>
  547. )
  548. </if>
  549. GROUP BY a.id
  550. <if test="ex.orderBy == null or ex.orderBy ==''">
  551. ORDER BY a.create_time DESC
  552. </if>
  553. ${ex.orderBy}
  554. </select>
  555. <select id="orderBaseList2" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBase2VO">
  556. SELECT
  557. ${ex.selected}
  558. FROM pg_order_base a
  559. JOIN pg_order_product b ON a.id = b.order_base_id
  560. JOIN pg_order_settle_norm c ON b.id = c.pg_order_product_id AND c.settle_norm_type IN ('INSTALL','REPAIR')
  561. ${ex.query}
  562. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  563. AND a.order_small_type = #{ex.orderSmallType}
  564. </if>
  565. <if test="ex.orderStatus != null and ex.orderStatus.key !='YCD'.toString() and ex.orderStatus.key !='DYY'.toString()">
  566. AND a.order_status = #{ex.orderStatus.key}
  567. </if>
  568. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  569. AND a.is_exception =1
  570. </if>
  571. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  572. AND a.appointment_time IS NULL
  573. </if>
  574. <if test="ex.isYb != null and ex.isYb == true">
  575. AND a.pg_incre_item_id !=''
  576. </if>
  577. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  578. AND (
  579. a.websit_id IN
  580. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  581. #{item}
  582. </foreach>
  583. OR
  584. a.create_websit_id IN
  585. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  586. #{item}
  587. </foreach>
  588. )
  589. </if>
  590. ORDER BY a.create_time DESC,id DESC
  591. </select>
  592. <select id="workerOrderSettleCountList"
  593. resultType="com.gree.mall.manager.bean.workorder.WorkerOrderSettleCountVO">
  594. SELECT
  595. a.company_wechat_id,
  596. a.company_wechat_name,
  597. a.worker_id,
  598. a.worker_name,
  599. a.worker_idcard,
  600. a.worker_mobile,
  601. COUNT(a.id) AS order_num,
  602. SUM(a.amount) AS order_amount,
  603. SUM(a.worker_amount) AS worker_amount
  604. FROM pg_incre_order a
  605. ${ex.query}
  606. AND a.settle_status IN ('OVER', 'EXCEPTION')
  607. AND a.worker_id <![CDATA[ <> ]]> ''
  608. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  609. AND (
  610. a.websit_id IN
  611. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  612. #{item}
  613. </foreach>
  614. )
  615. </if>
  616. GROUP BY
  617. a.company_wechat_id, a.worker_id
  618. </select>
  619. <select id="goodsMaterialList" resultType="com.gree.mall.manager.bean.goods.GoodsMaterialVO">
  620. SELECT
  621. ${ex.selected}
  622. FROM goods_material a
  623. ${ex.query}
  624. <if test="ex.orderBy == null or ex.orderBy ==''">
  625. ORDER BY a.create_time DESC
  626. </if>
  627. ${ex.orderBy}
  628. </select>
  629. <select id="goodsPurchaseList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseVO">
  630. SELECT
  631. ${ex.selected}
  632. FROM goods_purchase a
  633. ${ex.query}
  634. <if test="ex.orderBy == null or ex.orderBy ==''">
  635. ORDER BY a.create_time DESC
  636. </if>
  637. ${ex.orderBy}
  638. </select>
  639. <select id="goodsPurchaseItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseItemVO">
  640. SELECT
  641. ${ex.selected}
  642. FROM goods_purchase a JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  643. ${ex.query}
  644. <if test="ex.orderBy == null or ex.orderBy ==''">
  645. ORDER BY a.create_time DESC
  646. </if>
  647. ${ex.orderBy}
  648. </select>
  649. <select id="goodsPurchaseCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseCodeVO">
  650. SELECT
  651. ${ex.selected}
  652. FROM goods_purchase a
  653. JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  654. JOIN goods_purchase_code c ON b.id = c.goods_purchase_item_id
  655. ${ex.query}
  656. <if test="ex.orderBy == null or ex.orderBy ==''">
  657. ORDER BY a.create_time DESC, c.id DESC
  658. </if>
  659. ${ex.orderBy}
  660. </select>
  661. <select id="queryOrderInfoList" resultType="com.gree.mall.manager.bean.listvo.OrderInfoVO">
  662. SELECT
  663. ${ex.selected},
  664. if(a.order_status IN ('NOPAY','TIMEOUT'),"待支付","已支付") 'payStatus'
  665. from order_info a
  666. join order_detail b on a.order_id=b.order_id
  667. ${ex.query}
  668. and a.sale_type = 2
  669. <if test="ex.orderBy == null or ex.orderBy ==''">
  670. ORDER BY a.create_time DESC
  671. </if>
  672. ${ex.orderBy}
  673. </select>
  674. <select id="goodsPurchaseRetList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetVO">
  675. SELECT
  676. ${ex.selected}
  677. FROM goods_purchase_ret a
  678. ${ex.query}
  679. <if test="ex.orderBy == null or ex.orderBy ==''">
  680. ORDER BY a.create_time DESC
  681. </if>
  682. ${ex.orderBy}
  683. </select>
  684. <select id="goodsPurchaseRetItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetItemVO">
  685. SELECT
  686. ${ex.selected}
  687. FROM goods_purchase_ret a JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  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="goodsPurchaseRetCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetCodeVO">
  695. SELECT
  696. ${ex.selected}
  697. FROM goods_purchase_ret a
  698. JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  699. JOIN goods_purchase_ret_code c ON b.id = c.goods_purchase_ret_item_id
  700. ${ex.query}
  701. <if test="ex.orderBy == null or ex.orderBy ==''">
  702. ORDER BY a.create_time DESC, c.id DESC
  703. </if>
  704. ${ex.orderBy}
  705. </select>
  706. <select id="goodsMaterialStockAccList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsMaterialStockAccVO">
  707. SELECT
  708. ${ex.selected}
  709. FROM goods_material_stock_acc a
  710. ${ex.query}
  711. <if test="ex.orderBy == null or ex.orderBy ==''">
  712. ORDER BY a.create_time DESC
  713. </if>
  714. ${ex.orderBy}
  715. </select>
  716. <select id="orderEnginBaseList" resultType="com.gree.mall.manager.bean.engin.OrderEnginBaseVO">
  717. SELECT
  718. ${ex.selected}
  719. FROM order_engin_base a
  720. ${ex.query}
  721. <if test="ex.orderBy == null or ex.orderBy ==''">
  722. ORDER BY a.create_time DESC
  723. </if>
  724. ${ex.orderBy}
  725. </select>
  726. <select id="punishOrderList" resultType="com.gree.mall.manager.bean.listvo.order.PunishOrderVO">
  727. SELECT
  728. ${ex.selected}
  729. FROM punish_order a
  730. join punish_order_worker b on a.id = b.punish_order_id
  731. join punish_order_product c on a.id = c.punish_order_id
  732. ${ex.query}
  733. <if test="ex.examineStatus != null">
  734. and a.status = #{ex.examineStatus.key}
  735. </if>
  736. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  737. AND a.websit_id IN
  738. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  739. #{item}
  740. </foreach>
  741. </if>
  742. <if test="ex.orderBy == null or ex.orderBy ==''">
  743. ORDER BY a.create_time DESC
  744. </if>
  745. ${ex.orderBy}
  746. </select>
  747. <select id="orderOfflineRefundList" resultType="com.gree.mall.manager.bean.order.refund.OrderOfflineRefundVO">
  748. SELECT
  749. ${ex.selected}
  750. from order_offline_refund a
  751. join order_info b on a.order_id = b.order_id
  752. ${ex.query}
  753. ORDER BY a.create_time DESC
  754. </select>
  755. <select id="workerSettleExpenseGatherList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseVO">
  756. SELECT
  757. ${ex.selected}
  758. FROM settle_expense a
  759. ${ex.query}
  760. <if test="ex.orderBy == null or ex.orderBy ==''">
  761. ORDER BY a.create_time DESC
  762. </if>
  763. ${ex.orderBy}
  764. </select>
  765. <select id="workerSettleExpenseList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseItemVO">
  766. SELECT
  767. ${ex.selected}
  768. FROM settle_expense_item a JOIN settle_expense b ON a.settle_expense_id = b.id
  769. ${ex.query}
  770. <if test="workerId != null">
  771. AND (a.worker_name1 = #{workerId} OR a.worker_name2 = #{workerId})
  772. </if>
  773. <if test="ex.orderBy == null or ex.orderBy ==''">
  774. ORDER BY a.create_time DESC
  775. </if>
  776. ${ex.orderBy}
  777. </select>
  778. <select id="settleMonthWagesGatherList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesVO">
  779. SELECT
  780. ${ex.selected}
  781. FROM settle_month_wages 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="settleMonthWagesList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesWorkerVO">
  789. SELECT
  790. ${ex.selected}
  791. FROM settle_month_wages_worker a LEFT JOIN settle_month_wages_detail b ON a.settle_month_wages_detail_id = b.id
  792. ${ex.query}
  793. <if test="ex.orderBy == null or ex.orderBy ==''">
  794. ORDER BY a.worker_id DESC
  795. </if>
  796. ${ex.orderBy}
  797. </select>
  798. <select id="goodsLeaseList" resultType="com.gree.mall.manager.bean.goods.GoodsLeaseBean">
  799. SELECT
  800. a.*
  801. FROM goods_lease a
  802. WHERE
  803. a.del = 0
  804. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  805. AND a.company_wechat_id in
  806. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  807. #{companyWechatId}
  808. </foreach>
  809. </if>
  810. <if test="keyword != null and keyword != ''">
  811. AND
  812. (a.id LIKE CONCAT('%', #{keyword},'%') OR a.name LIKE CONCAT('%',#{keyword},'%') OR a.category_name
  813. LIKE CONCAT('%',#{keyword},'%'))
  814. </if>
  815. <if test="startPrice != null and endPrice != null">
  816. AND
  817. a.lease_price BETWEEN #{startPrice} AND #{endPrice}
  818. </if>
  819. <if test="startDeposit != null and endDeposit != null">
  820. AND
  821. a.deposit_price BETWEEN #{startDeposit} AND #{endDeposit}
  822. </if>
  823. <if test="categoryIds != null and categoryIds.size() != 0">
  824. AND
  825. a.category_id IN
  826. <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
  827. #{item}
  828. </foreach>
  829. </if>
  830. <if test="status != null">
  831. AND
  832. a.status = #{status}
  833. </if>
  834. <choose>
  835. <when test="sortStr == null">
  836. ORDER BY a.sort DESC,a.create_time DESC
  837. </when>
  838. <otherwise>
  839. ORDER BY a.sort DESC,${sortStr},a.create_time DESC
  840. </otherwise>
  841. </choose>
  842. </select>
  843. <select id="leaseOrderList" resultType="com.gree.mall.manager.bean.order.LeaseOrderVO">
  844. SELECT
  845. a.*,
  846. b.category_id,
  847. b.category_name,
  848. b.category_url,
  849. b.goods_lease_id,
  850. b.goods_lease_name,
  851. b.goods_unit,
  852. b.qty,
  853. b.deposit_price,
  854. b.lease_price,
  855. b.start_date,
  856. b.end_date,
  857. b.real_end_date
  858. FROM
  859. lease_order a LEFT JOIN lease_order_item b ON a.id = b.lease_order_id
  860. WHERE
  861. a.pay_status = 1
  862. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  863. AND a.company_wechat_id in
  864. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  865. #{companyWechatId}
  866. </foreach>
  867. </if>
  868. <if test="orderId != null and orderId != ''">
  869. AND a.id LIKE CONCAT('%', #{orderId},'%')
  870. </if>
  871. <if test="goodsName != null and goodsName != ''">
  872. AND b.goods_lease_name LIKE CONCAT('%', #{goodsName},'%')
  873. </if>
  874. <if test="userName != null and userName != ''">
  875. AND a.user_name LIKE CONCAT('%', #{userName},'%')
  876. </if>
  877. <if test="userMobile != null and userMobile != ''">
  878. AND a.user_mobile LIKE CONCAT('%', #{userMobile},'%')
  879. </if>
  880. <if test="status != null and status != ''">
  881. AND a.status = #{status}
  882. </if>
  883. <if test="startDate != null and endDate != null">
  884. AND
  885. a.create_time BETWEEN #{startDate} AND #{endDate}
  886. </if>
  887. <if test="startPayDate != null and endPayDate != null">
  888. AND
  889. a.pay_time BETWEEN #{startPayDate} AND #{endPayDate}
  890. </if>
  891. ORDER BY a.create_time DESC
  892. </select>
  893. <select id="goodsLibraryList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsLibraryVO">
  894. SELECT
  895. ${ex.selected}
  896. FROM goods_library a
  897. join goods_library_spec b on a.goods_library_id = b.goods_library_id
  898. ${ex.query}
  899. group by a.goods_library_id
  900. ORDER BY a.update_time DESC
  901. </select>
  902. <select id="promotionQuestionnairList" resultType="com.gree.mall.manager.bean.listvo.PromotionQuestionnairVO">
  903. SELECT
  904. ${ex.selected},
  905. if(is_stop=1,'已终止',if(a.start_time > now(),'待生效',if(now() between a.start_time and a.end_time,'生效中','已过期'))) 'statusText'
  906. FROM promotion_questionnaire a
  907. ${ex.query}
  908. <if test="status != null">
  909. <if test="status == 0">
  910. and a.start_time > now()
  911. </if>
  912. <if test="status == 1">
  913. and now() between a.start_time and a.end_time and is_stop=0
  914. </if>
  915. <if test="status == 2">
  916. and a.end_time &lt; now()
  917. </if>
  918. <if test="status == 3">
  919. and a.is_stop = 1
  920. </if>
  921. </if>
  922. ORDER BY a.create_time DESC
  923. </select>
  924. <select id="promotionActivityList" resultType="com.gree.mall.manager.bean.activity.PromotionActivityVO">
  925. SELECT
  926. ${ex.selected},
  927. b.create_by AS orderCreateBy,
  928. b.create_time AS orderCreateTime,
  929. b.create_mobile AS orderCreateMobile
  930. FROM
  931. promotion_activity a LEFT JOIN promotion_questionnaire b ON a.promotion_questionnaire_id = b.id
  932. ${ex.query}
  933. <if test="ex.orderBy == null or ex.orderBy ==''">
  934. ORDER BY a.create_time DESC
  935. </if>
  936. ${ex.orderBy}
  937. </select>
  938. <select id="esGoodsList" resultType="com.gree.mall.manager.bean.es.ESGoodsVO">
  939. SELECT
  940. ${ex.selected}
  941. FROM
  942. es_goods a
  943. ${ex.query}
  944. AND a.del = 0
  945. <if test="ex.orderBy == null or ex.orderBy ==''">
  946. ORDER BY a.create_time DESC
  947. </if>
  948. ${ex.orderBy}
  949. </select>
  950. <select id="esGoodsMessageList" resultType="com.gree.mall.manager.bean.es.EsGoodsMessageVO">
  951. SELECT
  952. a.*,
  953. b.content AS replyContent,
  954. b.reply_time,
  955. b.reply_by
  956. FROM
  957. es_goods_message a LEFT JOIN es_goods_message_reply b ON a.id = b.es_goods_message_id
  958. WHERE
  959. a.es_goods_id = #{id}
  960. </select>
  961. <select id="adminCompanyPayConfigList"
  962. resultType="com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO">
  963. SELECT
  964. ${ex.selected}
  965. FROM
  966. admin_company_wechat_pay_config a
  967. ${ex.query}
  968. AND a.del = 0
  969. <if test="ex.orderBy == null or ex.orderBy ==''">
  970. ORDER BY a.create_time DESC
  971. </if>
  972. ${ex.orderBy}
  973. </select>
  974. <select id="repairSettleBankAccountList"
  975. resultType="com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO">
  976. SELECT
  977. ${ex.selected}
  978. FROM
  979. settle_daily_bank_account a
  980. ${ex.query}
  981. <if test="ex.orderBy == null or ex.orderBy ==''">
  982. ORDER BY a.create_time DESC
  983. </if>
  984. ${ex.orderBy}
  985. </select>
  986. <select id="repairSettleDailyWithholdList"
  987. resultType="com.gree.mall.manager.bean.settle.repair.DailyWithholdVO">
  988. SELECT
  989. ${ex.selected}
  990. FROM
  991. settle_daily_withhold a
  992. ${ex.query}
  993. <if test="ex.orderBy == null or ex.orderBy ==''">
  994. ORDER BY a.create_time DESC
  995. </if>
  996. ${ex.orderBy}
  997. </select>
  998. <select id="repairSettleDailyImportSummaryList"
  999. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryVO">
  1000. SELECT
  1001. a.company_wechat_id,
  1002. a.company_wechat_name,
  1003. a.import_batch_no,
  1004. COUNT(DISTINCT a.repair_worker_mobile) AS personNums,
  1005. COUNT(1) AS 'orderNums',
  1006. SUM(a.total_fee) AS 'totalAmount',
  1007. IF(find_in_set('1', group_concat(DISTINCT a.summary_status)) > 0 , 1, 2) AS 'summaryStatus',
  1008. import_by ,
  1009. import_time ,
  1010. group_concat(DISTINCT summary_by) AS 'summaryBy',
  1011. summary_time AS 'summaryTime',
  1012. group_concat(DISTINCT summary_batch_no) AS 'summaryBatchNo' ,
  1013. group_concat(DISTINCT month) AS 'month'
  1014. FROM
  1015. settle_daily_import_summary_item a
  1016. ${ex.query}
  1017. GROUP BY
  1018. a.company_wechat_id, a.import_batch_no
  1019. <if test="ex.orderBy == null or ex.orderBy ==''">
  1020. ORDER BY a.create_time DESC
  1021. </if>
  1022. ${ex.orderBy}
  1023. </select>
  1024. <select id="repairDetailList"
  1025. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryItemVO">
  1026. SELECT
  1027. ${ex.selected}
  1028. FROM
  1029. settle_daily_import_summary_item a
  1030. ${ex.query}
  1031. <if test="ex.orderBy == null or ex.orderBy ==''">
  1032. ORDER BY a.create_time DESC
  1033. </if>
  1034. ${ex.orderBy}
  1035. </select>
  1036. </mapper>