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