CommonMapper.xml 58 KB

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