IncreMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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.workorder.IncreMapper">
  4. <select id="list" resultType="com.gree.mall.manager.bean.workorder.IncreVO">
  5. SELECT
  6. ${ex.selected}
  7. FROM pg_incre a
  8. ${ex.query}
  9. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  10. AND a.company_wechat_id IN
  11. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  12. #{item}
  13. </foreach>
  14. </if>
  15. <if test="ex.orderBy == null or ex.orderBy ==''">
  16. ORDER BY a.create_time DESC
  17. </if>
  18. ${ex.orderBy}
  19. </select>
  20. <select id="listDispatch" resultType="com.gree.mall.manager.bean.workorder.DispatchVO">
  21. SELECT
  22. a.province_name,
  23. a.province_code,
  24. a.city_name,
  25. a.city_code,
  26. a.area_name,
  27. a.area_code,
  28. a.name as streetName,
  29. a.id as streetCode,
  30. c.order_small_type_text,
  31. c.id as orderSmallId,
  32. d.name as categoryName,
  33. d.category_id,
  34. e.dict_value as saleTypeName,
  35. e.dict_code as saleTypeId
  36. FROM
  37. region a
  38. join order_small_type c on
  39. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  40. AND a.`level` = 4
  41. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  42. AND c.company_wechat_id IN
  43. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  44. #{item}
  45. </foreach>
  46. </if>
  47. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  48. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  49. AND d.company_wechat_id IN
  50. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  51. #{item}
  52. </foreach>
  53. </if>
  54. join sys_dict_company e on e.dict_type = 'SALES_TYPE' and e.del = 0 and e.dict_code > 100
  55. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  56. AND e.company_wechat_id IN
  57. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  58. #{item}
  59. </foreach>
  60. </if>
  61. ${ex.query}
  62. <if test="codeList != null and codeList.size > 0">
  63. AND CONCAT(a.id,e.dict_code,c.id,d.category_id) not In
  64. <foreach item="item" index="index" collection="codeList" open="(" separator="," close=")">
  65. #{item}
  66. </foreach>
  67. </if>
  68. </select>
  69. <select id="listDispatchWebsit" resultType="com.gree.mall.manager.bean.workorder.WebsitDispatchVO">
  70. SELECT
  71. ${ex.selected}
  72. FROM websit_dispatch a
  73. ${ex.query}
  74. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  75. AND a.company_wechat_id IN
  76. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  77. #{item}
  78. </foreach>
  79. </if>
  80. <if test="ex.orderBy == null or ex.orderBy ==''">
  81. ORDER BY a.create_time DESC
  82. </if>
  83. ${ex.orderBy}
  84. </select>
  85. <select id="pList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  86. SELECT
  87. a.province_name as valueName,
  88. a.province_code as keyId
  89. FROM
  90. region a
  91. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  92. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  93. AND b.company_wechat_id IN
  94. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  95. #{item}
  96. </foreach>
  97. </if>
  98. join order_small_type c
  99. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  100. on c.company_wechat_id IN
  101. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  102. #{item}
  103. </foreach>
  104. </if>
  105. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  106. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  107. AND d.company_wechat_id IN
  108. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  109. #{item}
  110. </foreach>
  111. </if>
  112. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  113. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  114. AND f.company_wechat_id IN
  115. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  116. #{item}
  117. </foreach>
  118. </if>
  119. where 1=1
  120. and
  121. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  122. AND a.`level` = 4
  123. and f.id is null
  124. <if test="pId != null and pId !=''">
  125. AND a.province_code = #{pId}
  126. </if>
  127. <if test="cityCode != null and cityCode !=''">
  128. AND a.city_code = #{cityCode}
  129. </if>
  130. <if test="areaCode != null and areaCode !=''">
  131. AND a.area_code = #{areaCode}
  132. </if>
  133. <if test="streetCode != null and streetCode !=''">
  134. AND a.id = #{streetCode}
  135. </if>
  136. <if test="sales != null and sales.size > 0">
  137. AND b.dict_code IN
  138. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  139. #{item}
  140. </foreach>
  141. </if>
  142. <if test="orderSmallId != null and orderSmallId.size > 0">
  143. AND c.id in
  144. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  145. #{item}
  146. </foreach>
  147. </if>
  148. <if test="categoryId != null and categoryId.size > 0">
  149. AND d.category_id in
  150. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  151. #{item}
  152. </foreach>
  153. </if>
  154. group by a.province_code
  155. </select>
  156. <select id="cList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  157. SELECT
  158. a.city_name as valueName,
  159. a.city_code as keyId
  160. FROM
  161. region a
  162. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  163. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  164. AND b.company_wechat_id IN
  165. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  166. #{item}
  167. </foreach>
  168. </if>
  169. join order_small_type c
  170. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  171. on c.company_wechat_id IN
  172. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  173. #{item}
  174. </foreach>
  175. </if>
  176. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  177. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  178. AND d.company_wechat_id IN
  179. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  180. #{item}
  181. </foreach>
  182. </if>
  183. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  184. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  185. AND f.company_wechat_id IN
  186. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  187. #{item}
  188. </foreach>
  189. </if>
  190. where 1=1
  191. and
  192. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  193. AND a.`level` = 4
  194. and f.id is null
  195. <if test="pId != null and pId !=''">
  196. AND a.province_code = #{pId}
  197. </if>
  198. <if test="cityCode != null and cityCode !=''">
  199. AND a.city_code = #{cityCode}
  200. </if>
  201. <if test="areaCode != null and areaCode !=''">
  202. AND a.area_code = #{areaCode}
  203. </if>
  204. <if test="streetCode != null and streetCode !=''">
  205. AND a.id = #{streetCode}
  206. </if>
  207. <if test="sales != null and sales.size > 0">
  208. AND b.dict_code IN
  209. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  210. #{item}
  211. </foreach>
  212. </if>
  213. <if test="orderSmallId != null and orderSmallId.size > 0">
  214. AND c.id in
  215. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  216. #{item}
  217. </foreach>
  218. </if>
  219. <if test="categoryId != null and categoryId.size > 0">
  220. AND d.category_id in
  221. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  222. #{item}
  223. </foreach>
  224. </if>
  225. group by a.city_code
  226. </select>
  227. <select id="aList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  228. SELECT
  229. a.area_name as valueName,
  230. a.area_code as keyId
  231. FROM
  232. region a
  233. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  234. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  235. AND b.company_wechat_id IN
  236. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  237. #{item}
  238. </foreach>
  239. </if>
  240. join order_small_type c
  241. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  242. on c.company_wechat_id IN
  243. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  244. #{item}
  245. </foreach>
  246. </if>
  247. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  248. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  249. AND d.company_wechat_id IN
  250. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  251. #{item}
  252. </foreach>
  253. </if>
  254. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  255. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  256. AND f.company_wechat_id IN
  257. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  258. #{item}
  259. </foreach>
  260. </if>
  261. where 1=1
  262. and
  263. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  264. AND a.`level` = 4
  265. and f.id is null
  266. <if test="pId != null and pId !=''">
  267. AND a.province_code = #{pId}
  268. </if>
  269. <if test="cityCode != null and cityCode !=''">
  270. AND a.city_code = #{cityCode}
  271. </if>
  272. <if test="areaCode != null and areaCode !=''">
  273. AND a.area_code = #{areaCode}
  274. </if>
  275. <if test="streetCode != null and streetCode !=''">
  276. AND a.id = #{streetCode}
  277. </if>
  278. <if test="sales != null and sales.size > 0">
  279. AND b.dict_code IN
  280. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  281. #{item}
  282. </foreach>
  283. </if>
  284. <if test="orderSmallId != null and orderSmallId.size > 0">
  285. AND c.id in
  286. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  287. #{item}
  288. </foreach>
  289. </if>
  290. <if test="categoryId != null and categoryId.size > 0">
  291. AND d.category_id in
  292. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  293. #{item}
  294. </foreach>
  295. </if>
  296. group by a.area_code
  297. </select>
  298. <select id="sList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  299. SELECT
  300. a.name as valueName,
  301. a.id as keyId
  302. FROM
  303. region a
  304. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  305. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  306. AND b.company_wechat_id IN
  307. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  308. #{item}
  309. </foreach>
  310. </if>
  311. join order_small_type c
  312. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  313. on c.company_wechat_id IN
  314. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  315. #{item}
  316. </foreach>
  317. </if>
  318. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  319. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  320. AND d.company_wechat_id IN
  321. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  322. #{item}
  323. </foreach>
  324. </if>
  325. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  326. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  327. AND f.company_wechat_id IN
  328. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  329. #{item}
  330. </foreach>
  331. </if>
  332. where 1=1
  333. and
  334. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  335. AND a.`level` = 4
  336. and f.id is null
  337. <if test="pId != null and pId !=''">
  338. AND a.province_code = #{pId}
  339. </if>
  340. <if test="cityCode != null and cityCode !=''">
  341. AND a.city_code = #{cityCode}
  342. </if>
  343. <if test="areaCode != null and areaCode !=''">
  344. AND a.area_code = #{areaCode}
  345. </if>
  346. <if test="streetCode != null and streetCode !=''">
  347. AND a.id = #{streetCode}
  348. </if>
  349. <if test="sales != null and sales.size > 0">
  350. AND b.dict_code IN
  351. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  352. #{item}
  353. </foreach>
  354. </if>
  355. <if test="orderSmallId != null and orderSmallId.size > 0">
  356. AND c.id in
  357. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  358. #{item}
  359. </foreach>
  360. </if>
  361. <if test="categoryId != null and categoryId.size > 0">
  362. AND d.category_id in
  363. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  364. #{item}
  365. </foreach>
  366. </if>
  367. group by a.id
  368. </select>
  369. <select id="channel" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  370. SELECT
  371. b.dict_value as valueName,
  372. b.dict_code as keyId
  373. FROM
  374. region a
  375. join sys_dict_company b on b.dict_type = 'ORDER_CHANNEL' and b.del = 0
  376. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  377. AND b.company_wechat_id IN
  378. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  379. #{item}
  380. </foreach>
  381. </if>
  382. join order_small_type c
  383. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  384. on c.company_wechat_id IN
  385. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  386. #{item}
  387. </foreach>
  388. </if>
  389. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  390. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  391. AND d.company_wechat_id IN
  392. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  393. #{item}
  394. </foreach>
  395. </if>
  396. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  397. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  398. AND f.company_wechat_id IN
  399. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  400. #{item}
  401. </foreach>
  402. </if>
  403. where 1=1
  404. and
  405. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  406. AND a.`level` = 4
  407. and f.id is null
  408. <if test="pId != null and pId !=''">
  409. AND a.province_code = #{pId}
  410. </if>
  411. <if test="cityCode != null and cityCode !=''">
  412. AND a.city_code = #{cityCode}
  413. </if>
  414. <if test="areaCode != null and areaCode !=''">
  415. AND a.area_code = #{areaCode}
  416. </if>
  417. <if test="streetCode != null and streetCode !=''">
  418. AND a.id = #{streetCode}
  419. </if>
  420. <if test="dictCode != null and dictCode.size > 0">
  421. AND b.dict_code IN
  422. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  423. #{item}
  424. </foreach>
  425. </if>
  426. <if test="orderSmallId != null and orderSmallId.size > 0">
  427. AND c.id in
  428. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  429. #{item}
  430. </foreach>
  431. </if>
  432. <if test="categoryId != null and categoryId.size > 0">
  433. AND d.category_id in
  434. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  435. #{item}
  436. </foreach>
  437. </if>
  438. <if test="orderSourceId != null and orderSourceId.size > 0">
  439. AND e.dict_code in
  440. <foreach item="item" index="index" collection="orderSourceId" open="(" separator="," close=")">
  441. #{item}
  442. </foreach>
  443. </if>
  444. group by b.dict_code
  445. </select>
  446. <select id="smallList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  447. SELECT
  448. c.order_small_type_text as valueName,
  449. c.id as keyId
  450. FROM
  451. region a
  452. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  453. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  454. AND b.company_wechat_id IN
  455. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  456. #{item}
  457. </foreach>
  458. </if>
  459. join order_small_type c
  460. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  461. on c.company_wechat_id IN
  462. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  463. #{item}
  464. </foreach>
  465. </if>
  466. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  467. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  468. AND d.company_wechat_id IN
  469. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  470. #{item}
  471. </foreach>
  472. </if>
  473. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  474. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  475. AND f.company_wechat_id IN
  476. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  477. #{item}
  478. </foreach>
  479. </if>
  480. where 1=1
  481. and
  482. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  483. AND a.`level` = 4
  484. and f.id is null
  485. <if test="pId != null and pId !=''">
  486. AND a.province_code = #{pId}
  487. </if>
  488. <if test="cityCode != null and cityCode !=''">
  489. AND a.city_code = #{cityCode}
  490. </if>
  491. <if test="areaCode != null and areaCode !=''">
  492. AND a.area_code = #{areaCode}
  493. </if>
  494. <if test="streetCode != null and streetCode !=''">
  495. AND a.id = #{streetCode}
  496. </if>
  497. <if test="sales != null and sales.size > 0">
  498. AND b.dict_code IN
  499. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  500. #{item}
  501. </foreach>
  502. </if>
  503. <if test="orderSmallId != null and orderSmallId.size > 0">
  504. AND c.id in
  505. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  506. #{item}
  507. </foreach>
  508. </if>
  509. <if test="categoryId != null and categoryId.size > 0">
  510. AND d.category_id in
  511. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  512. #{item}
  513. </foreach>
  514. </if>
  515. group by c.id
  516. </select>
  517. <select id="categoryList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  518. SELECT
  519. d.name as valueName,
  520. d.category_id as keyId
  521. FROM
  522. region a
  523. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  524. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  525. AND b.company_wechat_id IN
  526. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  527. #{item}
  528. </foreach>
  529. </if>
  530. join order_small_type c
  531. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  532. on c.company_wechat_id IN
  533. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  534. #{item}
  535. </foreach>
  536. </if>
  537. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  538. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  539. AND d.company_wechat_id IN
  540. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  541. #{item}
  542. </foreach>
  543. </if>
  544. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  545. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  546. AND f.company_wechat_id IN
  547. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  548. #{item}
  549. </foreach>
  550. </if>
  551. where 1=1
  552. and
  553. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  554. AND a.`level` = 4
  555. and f.id is null
  556. <if test="pId != null and pId !=''">
  557. AND a.province_code = #{pId}
  558. </if>
  559. <if test="cityCode != null and cityCode !=''">
  560. AND a.city_code = #{cityCode}
  561. </if>
  562. <if test="areaCode != null and areaCode !=''">
  563. AND a.area_code = #{areaCode}
  564. </if>
  565. <if test="streetCode != null and streetCode !=''">
  566. AND a.id = #{streetCode}
  567. </if>
  568. <if test="sales != null and sales.size > 0">
  569. AND b.dict_code IN
  570. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  571. #{item}
  572. </foreach>
  573. </if>
  574. <if test="orderSmallId != null and orderSmallId.size > 0">
  575. AND c.id in
  576. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  577. #{item}
  578. </foreach>
  579. </if>
  580. <if test="categoryId != null and categoryId.size > 0">
  581. AND d.category_id in
  582. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  583. #{item}
  584. </foreach>
  585. </if>
  586. group by d.category_id
  587. </select>
  588. <select id="sourceList" resultType="com.gree.mall.manager.bean.workorder.DispatchCherVO">
  589. SELECT
  590. b.dict_value as valueName,
  591. b.dict_code as keyId
  592. FROM
  593. region a
  594. join sys_dict_company b on b.dict_type = 'SALES_TYPE' and b.dict_code >= 100 and b.del = 0
  595. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  596. AND b.company_wechat_id IN
  597. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  598. #{item}
  599. </foreach>
  600. </if>
  601. join order_small_type c
  602. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  603. on c.company_wechat_id IN
  604. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  605. #{item}
  606. </foreach>
  607. </if>
  608. join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
  609. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  610. AND d.company_wechat_id IN
  611. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  612. #{item}
  613. </foreach>
  614. </if>
  615. LEFT JOIN websit_dispatch f on a.id = f.street_code and b.dict_code = f.sale_type_id and c.id = f.order_small_id and d.category_id = f.category_id
  616. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  617. AND f.company_wechat_id IN
  618. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  619. #{item}
  620. </foreach>
  621. </if>
  622. where 1=1
  623. and
  624. a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
  625. AND a.`level` = 4
  626. and f.id is null
  627. <if test="pId != null and pId !=''">
  628. AND a.province_code = #{pId}
  629. </if>
  630. <if test="cityCode != null and cityCode !=''">
  631. AND a.city_code = #{cityCode}
  632. </if>
  633. <if test="areaCode != null and areaCode !=''">
  634. AND a.area_code = #{areaCode}
  635. </if>
  636. <if test="streetCode != null and streetCode !=''">
  637. AND a.id = #{streetCode}
  638. </if>
  639. <if test="sales != null and sales.size > 0">
  640. AND b.dict_code IN
  641. <foreach item="item" index="index" collection="dictCode" open="(" separator="," close=")">
  642. #{item}
  643. </foreach>
  644. </if>
  645. <if test="orderSmallId != null and orderSmallId.size > 0">
  646. AND c.id in
  647. <foreach item="item" index="index" collection="orderSmallId" open="(" separator="," close=")">
  648. #{item}
  649. </foreach>
  650. </if>
  651. <if test="categoryId != null and categoryId.size > 0">
  652. AND d.category_id in
  653. <foreach item="item" index="index" collection="categoryId" open="(" separator="," close=")">
  654. #{item}
  655. </foreach>
  656. </if>
  657. group by e.dict_code
  658. </select>
  659. <select id="listAbnormal" resultType="com.gree.mall.manager.bean.workorder.AbnormalVO">
  660. SELECT
  661. ${ex.selected}
  662. FROM abnormal a
  663. ${ex.query}
  664. <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
  665. AND a.company_wechat_id IN
  666. <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
  667. #{item}
  668. </foreach>
  669. </if>
  670. <if test="ex.orderBy == null or ex.orderBy ==''">
  671. ORDER BY a.create_time DESC
  672. </if>
  673. ${ex.orderBy}
  674. </select>
  675. </mapper>