CommonMapper.xml 56 KB

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