CommonMapper.xml 37 KB

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