CommonMapper.xml 44 KB

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