CommonMapper.xml 38 KB

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