CommonMapper.xml 46 KB

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