IncreMapper.xml 34 KB

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