CommonMapper.xml 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548
  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.partsApplyStatus != null and ex.partsApplyStatus =='PJSQZ'.toString()">
  315. and a.id in(select order_base_id from websit_parts_apply where `status` = 'ING')
  316. </if>
  317. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYDH'.toString()">
  318. and a.id in(select order_base_id from websit_parts_apply where `status` = 'END')
  319. </if>
  320. <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJYQX'.toString()">
  321. and a.id in(select order_base_id from websit_parts_apply where `status` = 'CANCEL')
  322. </if>
  323. <if test="ex.isYb != null and ex.isYb == true">
  324. and a.pg_incre_item_id !=''
  325. </if>
  326. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  327. AND (
  328. a.websit_id IN
  329. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  330. #{item}
  331. </foreach>
  332. or
  333. a.create_websit_id IN
  334. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  335. #{item}
  336. </foreach>
  337. <if test="companyWechatId != null and companyWechatId != ''">
  338. or a.company_wechat_id = #{companyWechatId}
  339. </if>
  340. )
  341. </if>
  342. order by a.create_time desc,id desc
  343. </select>
  344. <select id="examineProjectConfigList"
  345. resultType="com.gree.mall.manager.bean.workorder.ExamineProjectConfigVO">
  346. SELECT
  347. ${ex.selected}
  348. FROM pg_examine_project_config a
  349. ${ex.query}
  350. AND a.del = 0
  351. <if test="ex.orderBy == null or ex.orderBy ==''">
  352. ORDER BY a.create_time DESC
  353. </if>
  354. </select>
  355. <select id="examineProjectList" resultType="com.gree.mall.manager.bean.workorder.ExamineProjectVO">
  356. SELECT
  357. ${ex.selected}
  358. FROM pg_examine_project a
  359. ${ex.query}
  360. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  361. AND
  362. a.websit_id IN
  363. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  364. #{item}
  365. </foreach>
  366. </if>
  367. <if test="ex.orderBy == null or ex.orderBy ==''">
  368. ORDER BY a.create_time DESC
  369. </if>
  370. </select>
  371. <select id="orderBaseAppraiseList" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBaseAppraiseVO">
  372. select
  373. ${ex.selected}
  374. from pg_order_base a
  375. ${ex.query}
  376. and a.appraise_status != 'N'
  377. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  378. AND (
  379. a.websit_id IN
  380. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  381. #{item}
  382. </foreach>
  383. )
  384. </if>
  385. order by a.id desc
  386. </select>
  387. <select id="installNormList" resultType="com.gree.mall.manager.bean.workorder.InstallSettleNormVO">
  388. SELECT
  389. ${ex.selected}
  390. FROM pg_settle_norm a
  391. ${ex.query}
  392. AND a.del = 0
  393. AND a.settle_norm_type = 'INSTALL'
  394. <if test="ex.orderBy == null or ex.orderBy ==''">
  395. ORDER BY a.type, a.parent_category_id, a.category_id
  396. </if>
  397. </select>
  398. <select id="repairNormList" resultType="com.gree.mall.manager.bean.workorder.RepairSettleNormVO">
  399. SELECT
  400. ${ex.selected}
  401. FROM pg_settle_norm a
  402. ${ex.query}
  403. AND a.del = 0
  404. AND a.settle_norm_type = 'REPAIR'
  405. <if test="ex.orderBy == null or ex.orderBy ==''">
  406. ORDER BY a.type, a.parent_category_id, a.category_id, a.label
  407. </if>
  408. </select>
  409. <select id="otherNormList" resultType="com.gree.mall.manager.bean.workorder.OtherSettleNormVO">
  410. SELECT
  411. ${ex.selected}
  412. FROM pg_settle_norm a
  413. ${ex.query}
  414. AND a.del = 0
  415. AND a.settle_norm_type = 'OTHER'
  416. <if test="ex.orderBy == null or ex.orderBy ==''">
  417. ORDER BY a.type, a.label
  418. </if>
  419. </select>
  420. <select id="settleOrderList" resultType="com.gree.mall.manager.bean.workorder.SettleOrderVO">
  421. SELECT
  422. ${ex.selected}
  423. FROM pg_settle_order a
  424. ${ex.query}
  425. <if test="websitIds != null and websitIds.size > 0">
  426. AND (
  427. a.websit_id IN
  428. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  429. #{item}
  430. </foreach>
  431. )
  432. </if>
  433. <if test="ex.orderBy == null or ex.orderBy ==''">
  434. ORDER BY a.create_time DESC
  435. </if>
  436. ${ex.orderBy}
  437. </select>
  438. <select id="settlePoolList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolVO">
  439. SELECT
  440. ${ex.selected}
  441. FROM pg_settle_pool a
  442. ${ex.query}
  443. <if test="websitIds != null and websitIds.size > 0">
  444. AND (
  445. a.websit_id IN
  446. <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
  447. #{item}
  448. </foreach>
  449. )
  450. </if>
  451. <if test="ex.orderBy == null or ex.orderBy ==''">
  452. ORDER BY a.pool_create_time DESC
  453. </if>
  454. ${ex.orderBy}
  455. </select>
  456. <select id="poolDetailList" resultType="com.gree.mall.manager.bean.workorder.SettlePoolWorkerVO">
  457. SELECT
  458. a.*,
  459. b.id AS order_id,
  460. b.order_base_id,
  461. b.customer_name,
  462. b.customer_mobile,
  463. b.customer_address,
  464. b.order_status,
  465. b.order_create_time,
  466. b.worker_end_time,
  467. b.order_type,
  468. b.order_type_text,
  469. b.order_small_type,
  470. b.order_small_type_text,
  471. b.brand_id,
  472. b.brand,
  473. b.order_source,
  474. b.order_channel,
  475. b.parent_category_id,
  476. b.parent_category_name,
  477. b.category_id,
  478. b.category_name,
  479. b.goods_name,
  480. b.order_num,
  481. b.settle_order_type,
  482. b.install_id,
  483. b.install_label,
  484. b.install_norm_amount,
  485. b.repair_id,
  486. b.repair_label,
  487. b.repair_amount,
  488. b.repair_rate,
  489. b.repair_settle_amount,
  490. b.other_id,
  491. b.other_type,
  492. b.other_label,
  493. b.other_price,
  494. b.examine_project_id,
  495. b.examine_project,
  496. b.examine_type,
  497. b.settle_num,
  498. b.settle_amount
  499. FROM
  500. 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
  501. WHERE
  502. a.pool_id = #{id}
  503. <if test="workerName!=null and workerName!=''">
  504. AND a.worker_name LIKE CONCAT('%',#{workerName},'%')
  505. </if>
  506. <if test="mobile!=null and mobile!=''">
  507. AND a.worker_mobile LIKE CONCAT('%',#{mobile},'%')
  508. </if>
  509. <if test="idcard!=null and idcard!=''">
  510. AND a.worker_idcard LIKE CONCAT('%',#{idcard},'%')
  511. </if>
  512. <if test="orderBaseId!=null and orderBaseId!=''">
  513. AND b.order_base_id LIKE CONCAT('%',#{orderBaseId},'%')
  514. </if>
  515. <if test="customerName!=null and customerName!=''">
  516. AND b.customer_name LIKE CONCAT('%',#{customerName},'%')
  517. </if>
  518. <if test="customerMobile!=null and customerMobile!=''">
  519. AND b.customer_mobile LIKE CONCAT('%',#{customerMobile},'%')
  520. </if>
  521. <if test="orderSmallType!=null and orderSmallType!=''">
  522. AND b.order_small_type = #{orderSmallType}
  523. </if>
  524. <if test="settleOrderType!=null and settleOrderType!=''">
  525. AND b.settle_order_type = #{settleOrderType}
  526. </if>
  527. </select>
  528. <select id="userWaitList" resultType="com.gree.mall.manager.bean.listvo.workorder.UserWaitVO">
  529. SELECT
  530. ${ex.selected}
  531. FROM user_wait a
  532. ${ex.query}
  533. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  534. AND (
  535. a.websit_id IN
  536. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  537. #{item}
  538. </foreach>
  539. )
  540. </if>
  541. ${ex.orderBy}
  542. </select>
  543. <select id="buyServiceRecordList" resultType="com.gree.mall.manager.bean.serivce.BuyServiceRecordVO">
  544. SELECT
  545. ${ex.selected}
  546. FROM buy_service_record a
  547. ${ex.query}
  548. <if test="companyName != null and companyName !=''">
  549. AND a.company_name = #{companyName}
  550. </if>
  551. <if test="ex.orderBy == null or ex.orderBy ==''">
  552. ORDER BY a.create_time DESC
  553. </if>
  554. ${ex.orderBy}
  555. </select>
  556. <select id="increOrderSettleList" resultType="com.gree.mall.manager.bean.workorder.IncreOrderVO">
  557. SELECT
  558. ${ex.selected}
  559. FROM pg_incre_order a
  560. ${ex.query}
  561. <if test="isSettleList != null and isSettleList == true">
  562. AND a.settle_status IN ('OVER', 'EXCEPTION')
  563. </if>
  564. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  565. AND (
  566. a.websit_id IN
  567. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  568. #{item}
  569. </foreach>
  570. )
  571. </if>
  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="websitOrderSettleCountList"
  578. resultType="com.gree.mall.manager.bean.workorder.WebsitOrderSettleCountVO">
  579. SELECT
  580. a.company_wechat_id,
  581. a.company_wechat_name,
  582. a.websit_id,
  583. a.websit_name,
  584. COUNT(a.id) AS order_num,
  585. SUM(a.amount) AS order_amount,
  586. SUM(a.websit_amount) AS websit_amount
  587. FROM pg_incre_order a
  588. ${ex.query}
  589. AND a.settle_status IN ('OVER', 'EXCEPTION')
  590. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  591. AND (
  592. a.websit_id IN
  593. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  594. #{item}
  595. </foreach>
  596. )
  597. </if>
  598. GROUP BY
  599. a.company_wechat_id, a.websit_id
  600. </select>
  601. <select id="projectRepairList" resultType="com.gree.mall.manager.bean.engin.ProjectRepairVO">
  602. SELECT
  603. ${ex.selected}
  604. FROM rp_project_repair a LEFT JOIN rp_project_repair_websit b ON a.id = b.project_repair_id
  605. ${ex.query}
  606. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  607. AND (
  608. b.websit_id IN
  609. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  610. #{item}
  611. </foreach>
  612. )
  613. </if>
  614. GROUP BY a.id
  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="orderBaseList2" resultType="com.gree.mall.manager.bean.listvo.workorder.OrderBase2VO">
  621. SELECT
  622. ${ex.selected}
  623. FROM pg_order_base a
  624. JOIN pg_order_product b ON a.id = b.order_base_id
  625. JOIN pg_order_settle_norm c ON b.id = c.pg_order_product_id AND c.settle_norm_type IN ('INSTALL','REPAIR')
  626. ${ex.query}
  627. <if test="ex.orderSmallType != null and ex.orderSmallType !=''">
  628. AND a.order_small_type = #{ex.orderSmallType}
  629. </if>
  630. <if test="ex.orderStatus != null and ex.orderStatus.key !='YCD'.toString() and ex.orderStatus.key !='DYY'.toString()">
  631. AND a.order_status = #{ex.orderStatus.key}
  632. </if>
  633. <if test="ex.orderStatus != null and ex.orderStatus.key =='YCD'.toString()">
  634. AND a.is_exception =1
  635. </if>
  636. <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
  637. AND a.appointment_time IS NULL
  638. </if>
  639. <if test="ex.isYb != null and ex.isYb == true">
  640. AND a.pg_incre_item_id !=''
  641. </if>
  642. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0 and adminUserType != null and adminUserType == 0">
  643. AND (
  644. a.websit_id IN
  645. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  646. #{item}
  647. </foreach>
  648. OR
  649. a.create_websit_id IN
  650. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  651. #{item}
  652. </foreach>
  653. )
  654. </if>
  655. ORDER BY a.create_time DESC,id DESC
  656. </select>
  657. <select id="workerOrderSettleCountList"
  658. resultType="com.gree.mall.manager.bean.workorder.WorkerOrderSettleCountVO">
  659. SELECT
  660. a.company_wechat_id,
  661. a.company_wechat_name,
  662. a.worker_id,
  663. a.worker_name,
  664. a.worker_idcard,
  665. a.worker_mobile,
  666. COUNT(a.id) AS order_num,
  667. SUM(a.amount) AS order_amount,
  668. SUM(a.worker_amount) AS worker_amount
  669. FROM pg_incre_order a
  670. ${ex.query}
  671. AND a.settle_status IN ('OVER', 'EXCEPTION')
  672. AND a.worker_id <![CDATA[ <> ]]> ''
  673. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  674. AND (
  675. a.websit_id IN
  676. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  677. #{item}
  678. </foreach>
  679. )
  680. </if>
  681. GROUP BY
  682. a.company_wechat_id, a.worker_id
  683. </select>
  684. <select id="goodsMaterialList" resultType="com.gree.mall.manager.bean.goods.GoodsMaterialVO">
  685. SELECT
  686. ${ex.selected}
  687. FROM goods_material a
  688. ${ex.query}
  689. <if test="ex.orderBy == null or ex.orderBy ==''">
  690. ORDER BY a.create_time DESC
  691. </if>
  692. ${ex.orderBy}
  693. </select>
  694. <select id="goodsPurchaseList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseVO">
  695. SELECT
  696. ${ex.selected}
  697. FROM goods_purchase a
  698. ${ex.query}
  699. <if test="ex.orderBy == null or ex.orderBy ==''">
  700. ORDER BY a.create_time DESC
  701. </if>
  702. ${ex.orderBy}
  703. </select>
  704. <select id="goodsPurchaseItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseItemVO">
  705. SELECT
  706. ${ex.selected}
  707. FROM goods_purchase a JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  708. ${ex.query}
  709. <if test="ex.orderBy == null or ex.orderBy ==''">
  710. ORDER BY a.create_time DESC
  711. </if>
  712. ${ex.orderBy}
  713. </select>
  714. <select id="goodsPurchaseCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseCodeVO">
  715. SELECT
  716. ${ex.selected}
  717. FROM goods_purchase a
  718. JOIN goods_purchase_item b ON a.id = b.goods_purchase_id
  719. JOIN goods_purchase_code c ON b.id = c.goods_purchase_item_id
  720. ${ex.query}
  721. <if test="ex.orderBy == null or ex.orderBy ==''">
  722. ORDER BY a.create_time DESC, c.id DESC
  723. </if>
  724. ${ex.orderBy}
  725. </select>
  726. <select id="queryOrderInfoList" resultType="com.gree.mall.manager.bean.listvo.OrderInfoVO">
  727. SELECT
  728. ${ex.selected},
  729. if(a.order_status IN ('NOPAY','TIMEOUT'),"待支付","已支付") 'payStatus'
  730. from order_info a
  731. join order_detail b on a.order_id=b.order_id
  732. ${ex.query}
  733. and a.sale_type = 2
  734. <if test="ex.orderBy == null or ex.orderBy ==''">
  735. ORDER BY a.create_time DESC
  736. </if>
  737. ${ex.orderBy}
  738. </select>
  739. <select id="goodsPurchaseRetList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetVO">
  740. SELECT
  741. ${ex.selected}
  742. FROM goods_purchase_ret a
  743. ${ex.query}
  744. <if test="ex.orderBy == null or ex.orderBy ==''">
  745. ORDER BY a.create_time DESC
  746. </if>
  747. ${ex.orderBy}
  748. </select>
  749. <select id="goodsPurchaseRetItemList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetItemVO">
  750. SELECT
  751. ${ex.selected}
  752. FROM goods_purchase_ret a JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  753. ${ex.query}
  754. <if test="ex.orderBy == null or ex.orderBy ==''">
  755. ORDER BY a.create_time DESC
  756. </if>
  757. ${ex.orderBy}
  758. </select>
  759. <select id="goodsPurchaseRetCodeList" resultType="com.gree.mall.manager.bean.goods.GoodsPurchaseRetCodeVO">
  760. SELECT
  761. ${ex.selected}
  762. FROM goods_purchase_ret a
  763. JOIN goods_purchase_ret_item b ON a.id = b.goods_purchase_ret_id
  764. JOIN goods_purchase_ret_code c ON b.id = c.goods_purchase_ret_item_id
  765. ${ex.query}
  766. <if test="ex.orderBy == null or ex.orderBy ==''">
  767. ORDER BY a.create_time DESC, c.id DESC
  768. </if>
  769. ${ex.orderBy}
  770. </select>
  771. <select id="goodsMaterialStockAccList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsMaterialStockAccVO">
  772. SELECT
  773. ${ex.selected}
  774. FROM goods_material_stock_acc a
  775. ${ex.query}
  776. <if test="ex.orderBy == null or ex.orderBy ==''">
  777. ORDER BY a.create_time DESC
  778. </if>
  779. ${ex.orderBy}
  780. </select>
  781. <select id="orderEnginBaseList" resultType="com.gree.mall.manager.bean.engin.OrderEnginBaseVO">
  782. SELECT
  783. ${ex.selected}
  784. FROM order_engin_base a
  785. ${ex.query}
  786. <if test="ex.orderBy == null or ex.orderBy ==''">
  787. ORDER BY a.create_time DESC
  788. </if>
  789. ${ex.orderBy}
  790. </select>
  791. <select id="punishOrderList" resultType="com.gree.mall.manager.bean.listvo.order.PunishOrderVO">
  792. SELECT
  793. ${ex.selected}
  794. FROM punish_order a
  795. join punish_order_worker b on a.id = b.punish_order_id
  796. join punish_order_product c on a.id = c.punish_order_id
  797. ${ex.query}
  798. <if test="ex.examineStatus != null">
  799. and a.status = #{ex.examineStatus.key}
  800. </if>
  801. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  802. AND a.websit_id IN
  803. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  804. #{item}
  805. </foreach>
  806. </if>
  807. <if test="ex.orderBy == null or ex.orderBy ==''">
  808. ORDER BY a.create_time DESC
  809. </if>
  810. ${ex.orderBy}
  811. </select>
  812. <select id="orderOfflineRefundList" resultType="com.gree.mall.manager.bean.order.refund.OrderOfflineRefundVO">
  813. SELECT
  814. ${ex.selected}
  815. from order_offline_refund a
  816. join order_info b on a.order_id = b.order_id
  817. ${ex.query}
  818. ORDER BY a.create_time DESC
  819. </select>
  820. <select id="workerSettleExpenseGatherList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseVO">
  821. SELECT
  822. ${ex.selected}
  823. FROM settle_expense a
  824. ${ex.query}
  825. <if test="ex.orderBy == null or ex.orderBy ==''">
  826. ORDER BY a.create_time DESC
  827. </if>
  828. ${ex.orderBy}
  829. </select>
  830. <select id="workerSettleExpenseList" resultType="com.gree.mall.manager.bean.settle.SettleExpenseItemVO">
  831. SELECT
  832. ${ex.selected}
  833. FROM settle_expense_item a JOIN settle_expense b ON a.settle_expense_id = b.id
  834. ${ex.query}
  835. <if test="workerId != null">
  836. AND (a.worker_name1 = #{workerId} OR a.worker_name2 = #{workerId})
  837. </if>
  838. <if test="ex.orderBy == null or ex.orderBy ==''">
  839. ORDER BY a.create_time DESC
  840. </if>
  841. ${ex.orderBy}
  842. </select>
  843. <select id="settleMonthWagesGatherList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesVO">
  844. SELECT
  845. ${ex.selected}
  846. FROM settle_month_wages a
  847. ${ex.query}
  848. <if test="ex.orderBy == null or ex.orderBy ==''">
  849. ORDER BY a.create_time DESC
  850. </if>
  851. ${ex.orderBy}
  852. </select>
  853. <select id="settleMonthWagesList" resultType="com.gree.mall.manager.bean.settle.SettleMonthWagesWorkerVO">
  854. SELECT
  855. ${ex.selected}
  856. FROM settle_month_wages_worker a LEFT JOIN settle_month_wages_detail b ON a.settle_month_wages_detail_id = b.id
  857. ${ex.query}
  858. <if test="ex.orderBy == null or ex.orderBy ==''">
  859. ORDER BY a.worker_id DESC
  860. </if>
  861. ${ex.orderBy}
  862. </select>
  863. <select id="goodsLeaseList" resultType="com.gree.mall.manager.bean.goods.GoodsLeaseBean">
  864. SELECT
  865. a.*
  866. FROM goods_lease a
  867. WHERE
  868. a.del = 0
  869. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  870. AND a.company_wechat_id in
  871. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  872. #{companyWechatId}
  873. </foreach>
  874. </if>
  875. <if test="keyword != null and keyword != ''">
  876. AND
  877. (a.id LIKE CONCAT('%', #{keyword},'%') OR a.name LIKE CONCAT('%',#{keyword},'%') OR a.category_name
  878. LIKE CONCAT('%',#{keyword},'%'))
  879. </if>
  880. <if test="startPrice != null and endPrice != null">
  881. AND
  882. a.lease_price BETWEEN #{startPrice} AND #{endPrice}
  883. </if>
  884. <if test="startDeposit != null and endDeposit != null">
  885. AND
  886. a.deposit_price BETWEEN #{startDeposit} AND #{endDeposit}
  887. </if>
  888. <if test="categoryIds != null and categoryIds.size() != 0">
  889. AND
  890. a.category_id IN
  891. <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
  892. #{item}
  893. </foreach>
  894. </if>
  895. <if test="status != null">
  896. AND
  897. a.status = #{status}
  898. </if>
  899. <choose>
  900. <when test="sortStr == null">
  901. ORDER BY a.sort DESC,a.create_time DESC
  902. </when>
  903. <otherwise>
  904. ORDER BY a.sort DESC,${sortStr},a.create_time DESC
  905. </otherwise>
  906. </choose>
  907. </select>
  908. <select id="leaseOrderList" resultType="com.gree.mall.manager.bean.order.LeaseOrderVO">
  909. SELECT
  910. a.*,
  911. b.category_id,
  912. b.category_name,
  913. b.category_url,
  914. b.goods_lease_id,
  915. b.goods_lease_name,
  916. b.goods_unit,
  917. b.qty,
  918. b.deposit_price,
  919. b.lease_price,
  920. b.start_date,
  921. b.end_date,
  922. b.real_end_date
  923. FROM
  924. lease_order a LEFT JOIN lease_order_item b ON a.id = b.lease_order_id
  925. WHERE
  926. a.pay_status = 1
  927. <if test='companyWechatIds != null and companyWechatIds.size > 0' >
  928. AND a.company_wechat_id in
  929. <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
  930. #{companyWechatId}
  931. </foreach>
  932. </if>
  933. <if test="orderId != null and orderId != ''">
  934. AND a.id LIKE CONCAT('%', #{orderId},'%')
  935. </if>
  936. <if test="goodsName != null and goodsName != ''">
  937. AND b.goods_lease_name LIKE CONCAT('%', #{goodsName},'%')
  938. </if>
  939. <if test="userName != null and userName != ''">
  940. AND a.user_name LIKE CONCAT('%', #{userName},'%')
  941. </if>
  942. <if test="userMobile != null and userMobile != ''">
  943. AND a.user_mobile LIKE CONCAT('%', #{userMobile},'%')
  944. </if>
  945. <if test="status != null and status != ''">
  946. AND a.status = #{status}
  947. </if>
  948. <if test="startDate != null and endDate != null">
  949. AND
  950. a.create_time BETWEEN #{startDate} AND #{endDate}
  951. </if>
  952. <if test="startPayDate != null and endPayDate != null">
  953. AND
  954. a.pay_time BETWEEN #{startPayDate} AND #{endPayDate}
  955. </if>
  956. ORDER BY a.create_time DESC
  957. </select>
  958. <select id="goodsLibraryList" resultType="com.gree.mall.manager.bean.listvo.goods.GoodsLibraryVO">
  959. SELECT
  960. ${ex.selected}
  961. FROM goods_library a
  962. join goods_library_spec b on a.goods_library_id = b.goods_library_id
  963. ${ex.query}
  964. group by a.goods_library_id
  965. ORDER BY a.update_time DESC
  966. </select>
  967. <select id="promotionQuestionnairList" resultType="com.gree.mall.manager.bean.listvo.PromotionQuestionnairVO">
  968. SELECT
  969. ${ex.selected},
  970. if(is_stop=1,'已终止',if(a.start_time > now(),'待生效',if(now() between a.start_time and a.end_time,'生效中','已过期'))) 'statusText'
  971. FROM promotion_questionnaire a
  972. ${ex.query}
  973. <if test="status != null">
  974. <if test="status == 0">
  975. and a.start_time > now()
  976. </if>
  977. <if test="status == 1">
  978. and now() between a.start_time and a.end_time and is_stop=0
  979. </if>
  980. <if test="status == 2">
  981. and a.end_time &lt; now()
  982. </if>
  983. <if test="status == 3">
  984. and a.is_stop = 1
  985. </if>
  986. </if>
  987. ORDER BY a.create_time DESC
  988. </select>
  989. <select id="promotionActivityList" resultType="com.gree.mall.manager.bean.activity.PromotionActivityVO">
  990. SELECT
  991. ${ex.selected},
  992. b.create_by AS orderCreateBy,
  993. b.create_time AS orderCreateTime,
  994. b.create_mobile AS orderCreateMobile
  995. FROM
  996. promotion_activity a LEFT JOIN promotion_questionnaire b ON a.promotion_questionnaire_id = b.id
  997. ${ex.query}
  998. <if test="ex.orderBy == null or ex.orderBy ==''">
  999. ORDER BY a.create_time DESC
  1000. </if>
  1001. ${ex.orderBy}
  1002. </select>
  1003. <select id="esGoodsList" resultType="com.gree.mall.manager.bean.es.ESGoodsVO">
  1004. SELECT
  1005. ${ex.selected}
  1006. FROM
  1007. es_goods a
  1008. ${ex.query}
  1009. AND a.del = 0
  1010. <if test="ex.orderBy == null or ex.orderBy ==''">
  1011. ORDER BY a.create_time DESC
  1012. </if>
  1013. ${ex.orderBy}
  1014. </select>
  1015. <select id="esGoodsMessageList" resultType="com.gree.mall.manager.bean.es.EsGoodsMessageVO">
  1016. SELECT
  1017. a.*,
  1018. b.content AS replyContent,
  1019. b.reply_time,
  1020. b.reply_by
  1021. FROM
  1022. es_goods_message a LEFT JOIN es_goods_message_reply b ON a.id = b.es_goods_message_id
  1023. WHERE
  1024. a.es_goods_id = #{id}
  1025. </select>
  1026. <select id="adminCompanyPayConfigList"
  1027. resultType="com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO">
  1028. SELECT
  1029. ${ex.selected}
  1030. FROM
  1031. admin_company_wechat_pay_config a
  1032. ${ex.query}
  1033. AND a.del = 0
  1034. <if test="ex.orderBy == null or ex.orderBy ==''">
  1035. ORDER BY a.create_time DESC
  1036. </if>
  1037. ${ex.orderBy}
  1038. </select>
  1039. <select id="repairSettleBankAccountList"
  1040. resultType="com.gree.mall.manager.bean.settle.repair.DailyBankAccountVO">
  1041. SELECT
  1042. ${ex.selected}
  1043. FROM
  1044. settle_daily_bank_account a
  1045. ${ex.query}
  1046. <if test="ex.orderBy == null or ex.orderBy ==''">
  1047. ORDER BY a.create_time DESC
  1048. </if>
  1049. ${ex.orderBy}
  1050. </select>
  1051. <select id="repairSettleDailyWithholdList"
  1052. resultType="com.gree.mall.manager.bean.settle.repair.DailyWithholdVO">
  1053. SELECT
  1054. ${ex.selected}
  1055. FROM
  1056. settle_daily_withhold a
  1057. ${ex.query}
  1058. <if test="ex.orderBy == null or ex.orderBy ==''">
  1059. ORDER BY a.create_time DESC
  1060. </if>
  1061. ${ex.orderBy}
  1062. </select>
  1063. <select id="repairSettleDailyImportSummaryList"
  1064. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryVO">
  1065. SELECT
  1066. a.company_wechat_id,
  1067. a.company_wechat_name,
  1068. a.import_batch_no,
  1069. COUNT(DISTINCT a.repair_worker_mobile) AS personNums,
  1070. COUNT(1) AS 'orderNums',
  1071. SUM(a.total_fee) AS 'totalAmount',
  1072. IF(find_in_set('1', group_concat(DISTINCT a.summary_status)) > 0 , 1, 2) AS 'summaryStatus',
  1073. import_by ,
  1074. import_time ,
  1075. group_concat(DISTINCT summary_by) AS 'summaryBy',
  1076. summary_time AS 'summaryTime',
  1077. group_concat(DISTINCT summary_batch_no) AS 'summaryBatchNo' ,
  1078. group_concat(DISTINCT month) AS 'month'
  1079. FROM
  1080. settle_daily_import_summary_item a
  1081. ${ex.query}
  1082. GROUP BY
  1083. a.company_wechat_id, a.import_batch_no
  1084. <if test="ex.orderBy == null or ex.orderBy ==''">
  1085. ORDER BY a.create_time DESC
  1086. </if>
  1087. ${ex.orderBy}
  1088. </select>
  1089. <select id="repairDetailList"
  1090. resultType="com.gree.mall.manager.bean.settle.repair.DailyImportSummaryItemVO">
  1091. SELECT
  1092. ${ex.selected}
  1093. FROM
  1094. settle_daily_import_summary_item a
  1095. ${ex.query}
  1096. <if test="ex.orderBy == null or ex.orderBy ==''">
  1097. ORDER BY a.create_time DESC
  1098. </if>
  1099. ${ex.orderBy}
  1100. </select>
  1101. <select id="reduceCountList"
  1102. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostCountVO">
  1103. SELECT
  1104. company_wechat_id,
  1105. company_wechat_name,
  1106. import_batch_no,
  1107. count(service_number) personNums,
  1108. count(id) orderNums,
  1109. sum(cost_amount) totalAmount,
  1110. do_status,
  1111. import_by,
  1112. import_time,
  1113. do_by,
  1114. do_time,
  1115. do_batch_no
  1116. FROM
  1117. settle_daily_incr_decr_cost a
  1118. ${ex.query}
  1119. GROUP BY a.company_wechat_id, a.import_batch_no
  1120. <if test="ex.orderBy == null or ex.orderBy ==''">
  1121. ORDER BY a.create_time DESC
  1122. </if>
  1123. ${ex.orderBy}
  1124. </select>
  1125. <select id="repairSettleDailyincrDecrCostList"
  1126. resultType="com.gree.mall.manager.bean.settle.repair.DailyIncrDecrCostVO">
  1127. SELECT
  1128. ${ex.selected}
  1129. FROM
  1130. settle_daily_incr_decr_cost a
  1131. ${ex.query}
  1132. <if test="ex.orderBy == null or ex.orderBy ==''">
  1133. ORDER BY a.create_time DESC
  1134. </if>
  1135. ${ex.orderBy}
  1136. </select>
  1137. <select id="reduceTotalList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostGatherVO">
  1138. SELECT
  1139. company_wechat_id,
  1140. company_wechat_name,
  1141. COUNT(DISTINCT repair_worker_mobile) AS 'personNums',
  1142. COUNT(1) AS 'orderNums',
  1143. SUM(total_fee) AS 'totalAmount',
  1144. import_by ,
  1145. import_time ,
  1146. import_batch_no,
  1147. do_status,
  1148. do_by ,
  1149. do_time ,
  1150. do_batch_no
  1151. FROM
  1152. settle_daily_reduce_cost a
  1153. ${ex.query}
  1154. GROUP BY a.company_wechat_id, a.import_batch_no
  1155. <if test="ex.orderBy == null or ex.orderBy ==''">
  1156. ORDER BY a.create_time DESC
  1157. </if>
  1158. ${ex.orderBy}
  1159. </select>
  1160. <select id="reduceList" resultType="com.gree.mall.manager.bean.settle.repair.DailyReduceCostVO">
  1161. SELECT
  1162. ${ex.selected}
  1163. FROM
  1164. settle_daily_reduce_cost a
  1165. ${ex.query}
  1166. <if test="ex.orderBy == null or ex.orderBy ==''">
  1167. ORDER BY a.create_time DESC
  1168. </if>
  1169. ${ex.orderBy}
  1170. </select>
  1171. <select id="buckleList" resultType="com.gree.mall.manager.bean.settle.repair.WorkerWaitBuckleVO">
  1172. SELECT
  1173. ${ex.selected}
  1174. FROM
  1175. settle_daily_remaine_buckle a
  1176. JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1177. JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1178. ${ex.query}
  1179. GROUP BY a.company_wechat_id, a.idcard
  1180. <if test="ex.orderBy == null or ex.orderBy ==''">
  1181. ORDER BY a.create_time DESC
  1182. </if>
  1183. ${ex.orderBy}
  1184. </select>
  1185. <select id="transferList"
  1186. resultType="com.gree.mall.manager.bean.settle.repair.SettleDailyBankTransferRecordVO">
  1187. SELECT
  1188. ${ex.selected}
  1189. FROM
  1190. settle_daily_bank_transfer_record a
  1191. ${ex.query}
  1192. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1193. AND a.company_wechat_id IN
  1194. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1195. #{item}
  1196. </foreach>
  1197. </if>
  1198. <if test="ex.orderBy == null or ex.orderBy ==''">
  1199. ORDER BY a.create_time DESC
  1200. </if>
  1201. ${ex.orderBy}
  1202. </select>
  1203. <select id="repairAllList" resultType="com.gree.mall.manager.bean.settle.repair.AllDailyImportSummaryItemVO">
  1204. SELECT
  1205. ${ex.selected}
  1206. FROM
  1207. settle_daily_import_summary_item a
  1208. LEFT JOIN settle_daily_reduce_cost sdrc on a.dispatch_order_no = sdrc.dispatch_order_no
  1209. LEFT JOIN user aa on a.worker_number = aa.worker_number AND aa.apply_type = 'WORKER'
  1210. LEFT JOIN settle_daily_bank_account b ON aa.id_card = b.idcard
  1211. LEFT JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  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.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1220. AND a.websit_number IN
  1221. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1222. #{item}
  1223. </foreach>
  1224. </if>
  1225. GROUP BY a.id
  1226. <if test="ex.orderBy == null or ex.orderBy ==''">
  1227. ORDER BY a.create_time, a.id DESC
  1228. </if>
  1229. ${ex.orderBy}
  1230. </select>
  1231. <select id="repairAllCount" resultType="java.lang.Integer">
  1232. SELECT
  1233. COUNT(1)
  1234. FROM
  1235. settle_daily_import_summary_item a JOIN settle_daily_issue_summary_record c ON c.id = a.issue_salary_id
  1236. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  1237. AND a.company_wechat_id IN
  1238. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  1239. #{item}
  1240. </foreach>
  1241. </if>
  1242. <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
  1243. AND a.websit_number IN
  1244. <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
  1245. #{item}
  1246. </foreach>
  1247. </if>
  1248. WHERE
  1249. c.status = #{status}
  1250. </select>
  1251. <select id="queryComList" resultType="com.gree.mall.manager.plus.entity.ComList">
  1252. select
  1253. a.*
  1254. from
  1255. com_list a join com_detail b on a.id=b.com_list_id
  1256. where
  1257. <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
  1258. b.websit_id IN
  1259. <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
  1260. #{item}
  1261. </foreach>
  1262. AND
  1263. </if>
  1264. a.is_notice=1 and a.is_pwd = 0
  1265. and not exists (select 1 from com_detail_log where user_name=#{userName} and com_list_id=a.id)
  1266. </select>
  1267. <select id="list" resultType="com.gree.mall.manager.bean.common.CallRecordVo">
  1268. SELECT
  1269. ${ex.selected}
  1270. FROM
  1271. call_send_record a
  1272. ${ex.query}
  1273. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1274. AND a.websit_number IN
  1275. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1276. #{item}
  1277. </foreach>
  1278. </if>
  1279. <if test="ex.orderBy == null or ex.orderBy ==''">
  1280. ORDER BY a.create_time, a.id DESC
  1281. </if>
  1282. ${ex.orderBy}
  1283. </select>
  1284. <select id="settleRelaConfigPage"
  1285. resultType="com.gree.mall.manager.bean.contract.SettleRelaConfigVO">
  1286. SELECT
  1287. ${ex.selected},
  1288. b.name AS parentName,
  1289. d.name AS subName
  1290. FROM
  1291. websit_follow_config a
  1292. JOIN admin_websit b ON a.websit_id = b.websit_id
  1293. LEFT JOIN websit_follow_config_item c ON a.websit_id = c.parent_id
  1294. LEFT JOIN admin_websit d ON c.sub_websit_id = d.websit_id
  1295. ${ex.query}
  1296. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1297. AND a.websit_id IN
  1298. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1299. #{item}
  1300. </foreach>
  1301. </if>
  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="listOrder" resultType="com.gree.mall.manager.bean.common.CallRecordOrderVo">
  1308. SELECT
  1309. ${ex.selected}
  1310. FROM
  1311. call_record a
  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="contractTemplatePage" resultType="com.gree.mall.manager.bean.contract.ContractTemplateVO">
  1319. SELECT
  1320. ${ex.selected},
  1321. b.contract_template_name AS followContractTemplateName
  1322. FROM
  1323. contract_template a
  1324. LEFT JOIN contract_template b ON a.follow_contract_template_id = b.contract_template_id
  1325. ${ex.query}
  1326. AND a.del = 0
  1327. <if test="ex.orderBy == null or ex.orderBy ==''">
  1328. ORDER BY a.create_time DESC
  1329. </if>
  1330. ${ex.orderBy}
  1331. </select>
  1332. <select id="contractWebsitList" resultType="com.gree.mall.manager.bean.contract.ContractWebsitBean">
  1333. SELECT
  1334. a.*,
  1335. d.name AS parent_name,
  1336. c.name,
  1337. d.belong_company,
  1338. d.belong_company_code
  1339. FROM
  1340. contract_websit a
  1341. LEFT JOIN websit_follow_config_item b ON a.sub_websit_id = b.sub_websit_id
  1342. LEFT JOIN admin_websit c on a.sub_websit_id = c.websit_id
  1343. LEFT JOIN admin_websit d on b.parent_id = d.websit_id
  1344. WHERE
  1345. a.contract_template_id = #{contractTemplateId}
  1346. </select>
  1347. <select id="querySettleRelaWebsit" resultType="com.gree.mall.manager.bean.contract.ContractWebsitBean">
  1348. SELECT
  1349. b.name AS parent_name,
  1350. c.name,
  1351. a.sub_websit_id,
  1352. b.belong_company,
  1353. b.belong_company_code
  1354. FROM
  1355. websit_follow_config_item a
  1356. LEFT JOIN admin_websit b ON a.parent_id = b.websit_id
  1357. LEFT JOIN admin_websit c ON a.sub_websit_id = c.websit_id
  1358. <where>
  1359. <if test="contractTemplateId != null and contractTemplateId != ''">
  1360. AND a.sub_websit_id NOT IN (SELECT sub_websit_id FROM contract_websit WHERE contract_template_id = #{contractTemplateId})
  1361. </if>
  1362. <if test="websitId != null and websitId != ''">
  1363. AND a.sub_websit_id = #{websitId}
  1364. </if>
  1365. <if test="websitName != null and websitName != ''">
  1366. AND c.name LIKE CONCAT('%', #{websitName}, '%')
  1367. </if>
  1368. </where>
  1369. ORDER BY b.belong_company_code, a.parent_id, a.sub_websit_id
  1370. </select>
  1371. <select id="companyCaAuthPage" resultType="com.gree.mall.manager.bean.contract.CompanyCaAuthVO">
  1372. SELECT
  1373. ${ex.selected}
  1374. FROM
  1375. company_ca_auth a
  1376. LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
  1377. ${ex.query}
  1378. AND a.del = 0
  1379. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1380. AND a.websit_id IN
  1381. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1382. #{item}
  1383. </foreach>
  1384. </if>
  1385. <if test="ex.orderBy == null or ex.orderBy ==''">
  1386. ORDER BY a.create_time DESC
  1387. </if>
  1388. ${ex.orderBy}
  1389. </select>
  1390. <select id="websitContractSignPage" resultType="com.gree.mall.manager.bean.contract.WebsitContractSignVO">
  1391. SELECT
  1392. ${ex.selected}
  1393. FROM
  1394. websit_contract_sign_record a
  1395. ${ex.query}
  1396. <if test="websitId != null">
  1397. AND a.websit_id = #{websitId}
  1398. </if>
  1399. <if test="websitId == null and ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1400. AND a.parent_id IN
  1401. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1402. #{item}
  1403. </foreach>
  1404. </if>
  1405. <if test="ex.orderBy == null or ex.orderBy ==''">
  1406. ORDER BY a.create_time DESC
  1407. </if>
  1408. ${ex.orderBy}
  1409. </select>
  1410. <select id="queryNeedContract" resultType="com.gree.mall.manager.plus.entity.ContractTemplate">
  1411. SELECT
  1412. b.*
  1413. FROM
  1414. contract_websit a,
  1415. contract_template b
  1416. WHERE
  1417. a.company_wechat_id = b.company_wechat_id
  1418. AND a.contract_template_id = b.contract_template_id
  1419. AND a.company_wechat_id = #{companyId}
  1420. AND a.sub_websit_id = #{websitId}
  1421. AND #{onDate} BETWEEN b.valid_date AND b.expire_date
  1422. AND b.contract_type = 'MAIN'
  1423. AND b.status = 'ON'
  1424. ORDER BY
  1425. create_time
  1426. </select>
  1427. <select id="selectMainContractIdByValidDate" resultType="java.lang.String">
  1428. SELECT
  1429. contract_template_id
  1430. FROM
  1431. `contract_template`
  1432. WHERE
  1433. company_wechat_id = #{companyId}
  1434. AND contract_type = 'MAIN'
  1435. AND `status` = 'ON'
  1436. AND #{onDate} BETWEEN valid_date AND expire_date
  1437. </select>
  1438. <select id="workerTeamPage" resultType="com.gree.mall.manager.bean.worker.WorkerTeamVO">
  1439. SELECT
  1440. ${ex.selected}
  1441. FROM
  1442. worker_team a
  1443. LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
  1444. ${ex.query}
  1445. <if test="workerId != null and workerId != ''">
  1446. AND (a.master_worker_id = #{workerId} OR a.assistant_worker_id = #{workerId})
  1447. </if>
  1448. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  1449. AND a.websit_id IN
  1450. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  1451. #{item}
  1452. </foreach>
  1453. </if>
  1454. <if test="ex.orderBy == null or ex.orderBy ==''">
  1455. ORDER BY a.create_time DESC
  1456. </if>
  1457. ${ex.orderBy}
  1458. </select>
  1459. </mapper>