CommonMapper.xml 53 KB

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