MaterialMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  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.MaterialMapper">
  4. <update id="updateItemPushFlag">
  5. UPDATE websit_parts_sales_item SET push_flag = #{pushFlag} WHERE sales_id = #{id}
  6. </update>
  7. <select id="partsBasePage" resultType="com.gree.mall.manager.bean.material.base.PartsBaseVO">
  8. SELECT
  9. ${ex.selected}
  10. FROM websit_parts_base a
  11. ${ex.query}
  12. <if test="ex.orderBy == null or ex.orderBy ==''">
  13. ORDER BY a.create_time DESC
  14. </if>
  15. ${ex.orderBy}
  16. </select>
  17. <select id="materialCategoryPage" resultType="com.gree.mall.manager.bean.material.base.MaterialCategoryVO">
  18. SELECT
  19. ${ex.selected}
  20. FROM websit_goods_category a
  21. ${ex.query}
  22. <if test="ex.orderBy == null or ex.orderBy ==''">
  23. ORDER BY a.parent_category_id, a.sort, a.create_time DESC
  24. </if>
  25. ${ex.orderBy}
  26. </select>
  27. <select id="mPage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsMVO">
  28. SELECT
  29. ${ex.selected}
  30. FROM websit_goods a LEFT JOIN websit_goods_category b ON a.goods_category_id = b.category_id
  31. ${ex.query}
  32. AND a.goods_type = 'M'
  33. <if test="ex.orderBy == null or ex.orderBy ==''">
  34. ORDER BY a.create_time DESC
  35. </if>
  36. ${ex.orderBy}
  37. </select>
  38. <select id="pPage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsPVO">
  39. SELECT
  40. ${ex.selected}
  41. FROM websit_goods a
  42. ${ex.query}
  43. AND a.goods_type = 'P'
  44. <if test="ex.orderBy == null or ex.orderBy ==''">
  45. ORDER BY a.create_time DESC
  46. </if>
  47. ${ex.orderBy}
  48. </select>
  49. <select id="workGoodsPage" resultType="com.gree.mall.manager.bean.material.base.WorkerGoodsVO">
  50. SELECT
  51. ${ex.selected}
  52. FROM worker_goods a LEFT JOIN websit_goods_category b ON a.goods_category_id = b.category_id
  53. ${ex.query}
  54. <if test="ex.orderBy == null or ex.orderBy ==''">
  55. ORDER BY a.create_time DESC
  56. </if>
  57. ${ex.orderBy}
  58. </select>
  59. <select id="websitGoodsPricePage"
  60. resultType="com.gree.mall.manager.bean.material.manage.WebsitGoodsPriceVO">
  61. SELECT
  62. ${ex.selected}
  63. FROM websit_goods_price a LEFT JOIN websit_goods b ON a.goods_id = b.goods_id
  64. ${ex.query}
  65. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  66. AND a.websit_id IN
  67. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  68. #{item}
  69. </foreach>
  70. </if>
  71. <if test="ex.orderBy == null or ex.orderBy ==''">
  72. ORDER BY a.create_time DESC
  73. </if>
  74. ${ex.orderBy}
  75. </select>
  76. <select id="websitPriceUpdPage" resultType="com.gree.mall.manager.bean.material.manage.WebsitPriceUpdVO">
  77. SELECT
  78. ${ex.selected}
  79. FROM websit_price_upd a
  80. <!-- LEFT JOIN websit_price_upd_item b ON a.sheet_id = b.sheet_id -->
  81. ${ex.query}
  82. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  83. AND a.websit_id IN
  84. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  85. #{item}
  86. </foreach>
  87. </if>
  88. <if test="ex.orderBy == null or ex.orderBy ==''">
  89. ORDER BY a.create_time DESC
  90. </if>
  91. ${ex.orderBy}
  92. </select>
  93. <select id="websitPurchasePage" resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseVO">
  94. SELECT
  95. ${ex.selected}
  96. FROM websit_purchase a LEFT JOIN storage b ON a.storage_id = b.storage_id
  97. ${ex.query}
  98. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  99. AND a.websit_id IN
  100. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  101. #{item}
  102. </foreach>
  103. </if>
  104. <if test="ex.orderBy == null or ex.orderBy ==''">
  105. ORDER BY a.create_time DESC
  106. </if>
  107. ${ex.orderBy}
  108. </select>
  109. <select id="websitPurchaseRetPage"
  110. resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseRetVO">
  111. SELECT
  112. ${ex.selected}
  113. FROM websit_purchase_ret a LEFT JOIN storage b ON a.storage_id = b.storage_id
  114. ${ex.query}
  115. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  116. AND a.websit_id IN
  117. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  118. #{item}
  119. </foreach>
  120. </if>
  121. <if test="ex.orderBy == null or ex.orderBy ==''">
  122. ORDER BY a.create_time DESC
  123. </if>
  124. ${ex.orderBy}
  125. </select>
  126. <select id="websitVenderPage" resultType="com.gree.mall.manager.bean.material.vender.WebsitVenderVO">
  127. SELECT
  128. ${ex.selected}
  129. FROM websit_vender a
  130. ${ex.query}
  131. <if test="ex.orderBy == null or ex.orderBy ==''">
  132. ORDER BY a.create_time DESC
  133. </if>
  134. ${ex.orderBy}
  135. </select>
  136. <select id="websitNormChargePage" resultType="com.gree.mall.manager.bean.material.base.WebsitNormChargeVO">
  137. SELECT
  138. ${ex.selected}
  139. FROM websit_norm_charge a LEFT JOIN websit_goods_category b ON a.category_id = b.category_id
  140. ${ex.query}
  141. <if test="ex.orderBy == null or ex.orderBy ==''">
  142. ORDER BY a.create_time DESC
  143. </if>
  144. ${ex.orderBy}
  145. </select>
  146. <select id="websitSalesPage" resultType="com.gree.mall.manager.bean.material.manage.WebsitSalesVO">
  147. SELECT
  148. ${ex.selected}
  149. FROM websit_sales a
  150. join websit_sales_item b on a.sales_id = b.sales_id
  151. LEFT JOIN storage c on a.storage_id = c.storage_id
  152. ${ex.query}
  153. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  154. AND a.websit_id IN
  155. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  156. #{item}
  157. </foreach>
  158. </if>
  159. <if test="goodsName != null and goodsName != ''">
  160. AND b.goods_name = #{goodsName}
  161. </if>
  162. <if test="goodsSpecification != null and goodsSpecification != ''">
  163. AND b.goods_specification = #{goodsSpecification}
  164. </if>
  165. <if test="isFilter != null and isFilter != ''">
  166. AND ( (a.goods_Type = 'M' and b.sales_qty != b.ret_qty) or
  167. (a.goods_Type = 'P' and (b.sales_qty != (b.ret_qty+ b.old_refund_qty)))
  168. )
  169. </if>
  170. GROUP BY a.sales_id
  171. <if test="ex.orderBy == null or ex.orderBy ==''">
  172. ORDER BY a.create_time DESC
  173. </if>
  174. ${ex.orderBy}
  175. </select>
  176. <select id="existStockCategory" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesCategoryVO">
  177. SELECT
  178. c.category_id,
  179. c.category_name,
  180. c.parent_category_id,
  181. c.parent_category_name
  182. FROM
  183. websit_stock a
  184. LEFT JOIN websit_goods b ON a.goods_id = b.goods_id
  185. LEFT JOIN websit_goods_category c ON b.goods_category_id = c.category_id
  186. WHERE
  187. a.company_wechat_id = #{companyWechatId}
  188. AND a.websit_id = #{websitId}
  189. AND a.goods_type = 'M'
  190. <!-- AND a.qty > 0 -->
  191. GROUP BY b.goods_category_id
  192. </select>
  193. <select id="existStockGoods" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO">
  194. SELECT
  195. a.goods_id,
  196. b.goods_name,
  197. <if test="goodsType=='M'.toString()">
  198. c.price,
  199. </if>
  200. <if test="goodsType=='P'.toString()">
  201. b.market_price AS price,
  202. </if>
  203. b.goods_code,
  204. b.goods_spell,
  205. b.goods_specification,
  206. b.goods_stock_unit,
  207. b.goods_sales_unit,
  208. b.brand_rela_name,
  209. b.product_rela_name,
  210. SUM(a.qty) AS qty,
  211. 'BASE' AS itemSourceType,
  212. a.goods_id AS itemSourceId,
  213. b.norm_type,
  214. b.material_group_name
  215. FROM
  216. websit_stock a
  217. JOIN websit_goods b ON
  218. <if test="goodsType!=null and goodsType!='' and goodsType=='M'.toString()">
  219. a.goods_id = b.goods_id
  220. </if>
  221. <if test="goodsType!=null and goodsType!='' and goodsType=='P'.toString()">
  222. a.goods_id = b.goods_code
  223. </if>
  224. <if test="goodsType=='M'.toString()">
  225. LEFT JOIN websit_goods_price c ON a.goods_id = c.goods_id AND a.websit_id = c.websit_id
  226. </if>
  227. WHERE
  228. a.company_wechat_id = #{companyWechatId}
  229. <if test="goodsType=='M'.toString() and categoryId!=null and categoryId!=''">
  230. AND b.goods_category_id = #{categoryId}
  231. </if>
  232. <if test="goodsName!=null and goodsName!=''">
  233. AND b.goods_name LIKE CONCAT('%',#{goodsName},'%')
  234. </if>
  235. <if test="goodsSpecification!=null and goodsSpecification!=''">
  236. AND b.goods_specification LIKE CONCAT('%',#{goodsSpecification},'%')
  237. </if>
  238. AND a.websit_id = #{websitId}
  239. <if test="goodsType!=null and goodsType!=''">
  240. AND a.goods_type = #{goodsType}
  241. </if>
  242. <!-- AND a.qty > 0 -->
  243. GROUP BY a.goods_id
  244. LIMIT 100
  245. </select>
  246. <select id="notStockGoods" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO">
  247. SELECT
  248. b.goods_id,
  249. b.goods_name,
  250. b.market_price AS price,
  251. b.goods_code,
  252. b.goods_spell,
  253. b.goods_specification,
  254. b.goods_stock_unit,
  255. b.goods_sales_unit,
  256. b.brand_rela_name,
  257. b.product_rela_name,
  258. b.convert_bit_scale,
  259. b.goods_sales_convert_qty,
  260. b.manage_worker_stock,
  261. b.part_type,
  262. 0 AS qty
  263. FROM
  264. websit_goods b
  265. WHERE
  266. b.company_wechat_id = #{companyWechatId}
  267. <if test="goodsName!=null and goodsName!=''">
  268. AND b.goods_name LIKE CONCAT('%',#{goodsName},'%')
  269. </if>
  270. AND b.goods_type = #{goodsType}
  271. AND b.norm_type = 'M'
  272. </select>
  273. <select id="websitTradePage" resultType="com.gree.mall.manager.bean.material.manage.WebsitTradeVO">
  274. SELECT
  275. ${ex.selected}
  276. FROM websit_sales_pay_order a
  277. ${ex.query}
  278. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  279. AND a.websit_id IN
  280. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  281. #{item}
  282. </foreach>
  283. </if>
  284. <if test="ex.orderBy == null or ex.orderBy ==''">
  285. ORDER BY a.create_time DESC
  286. </if>
  287. ${ex.orderBy}
  288. </select>
  289. <select id="mAlonePage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsAloneMVO">
  290. SELECT
  291. ${ex.selected}
  292. FROM websit_goods_alone a
  293. ${ex.query}
  294. AND a.goods_type = 'M'
  295. <if test="ex.orderBy == null or ex.orderBy ==''">
  296. ORDER BY a.create_time DESC
  297. </if>
  298. ${ex.orderBy}
  299. </select>
  300. <select id="pAlonePage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsAlonePVO">
  301. SELECT
  302. ${ex.selected}
  303. FROM websit_goods_alone a
  304. ${ex.query}
  305. AND a.goods_type = 'P'
  306. <if test="ex.orderBy == null or ex.orderBy ==''">
  307. ORDER BY a.create_time DESC
  308. </if>
  309. ${ex.orderBy}
  310. </select>
  311. <select id="enginPayManageList" resultType="com.gree.mall.manager.bean.engin.EnginPayManageVO">
  312. SELECT
  313. ${ex.selected},
  314. IF((a.total_sales_amount - a.total_pay_amount) <![CDATA[ < ]]> 0, 0, (a.total_sales_amount - a.total_pay_amount)) AS totalNotPayAmount
  315. FROM engin_pay_manage a
  316. ${ex.query}
  317. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  318. AND a.websit_id IN
  319. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  320. #{item}
  321. </foreach>
  322. </if>
  323. <if test="ex.orderBy == null or ex.orderBy ==''">
  324. ORDER BY a.create_time DESC
  325. </if>
  326. ${ex.orderBy}
  327. </select>
  328. <select id="enginPayManageGatherList" resultType="com.gree.mall.manager.bean.engin.EnginPayManageGatherVO">
  329. SELECT
  330. ${ex.selected},
  331. SUM(a.total_sales_amount) AS totalSalesAmount,
  332. SUM(a.total_pay_amount) AS totalPayAmount,
  333. IF((SUM(a.total_sales_amount) - SUM(a.total_pay_amount)) <![CDATA[ < ]]> 0, 0, (SUM(a.total_sales_amount) - SUM(a.total_pay_amount))) AS totalNotPayAmount
  334. FROM engin_pay_manage a
  335. ${ex.query}
  336. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  337. AND a.websit_id IN
  338. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  339. #{item}
  340. </foreach>
  341. </if>
  342. GROUP BY a.company_wechat_id, a.project_no
  343. </select>
  344. <select id="enginPayManageGatherLastUpdate" resultType="com.gree.mall.manager.bean.engin.EnginPayManageGatherVO">
  345. SELECT a.project_no, a.last_update_time, a.last_update_by
  346. FROM engin_pay_manage a
  347. INNER JOIN (SELECT project_no, MAX(last_update_time) AS max_time
  348. FROM engin_pay_manage
  349. WHERE
  350. company_wechat_id = #{companyWechatId}
  351. AND project_no IN
  352. <foreach item="item" index="index" collection="projectList" open="(" separator=","
  353. close=")">
  354. #{item}
  355. </foreach>
  356. GROUP BY project_no) b
  357. ON a.project_no = b.project_no AND a.last_update_time = b.max_time AND a.company_wechat_id = #{companyWechatId}
  358. </select>
  359. <select id="exportWorkerMaterialRela"
  360. resultType="com.gree.mall.manager.bean.material.base.WorkerGoodsRelaExportBean">
  361. SELECT
  362. a.company_wechat_id,
  363. a.company_wechat_name,
  364. a.goods_category_name,
  365. a.goods_id,
  366. a.goods_name,
  367. a.is_small,
  368. a.status,
  369. b.goods_category_name AS websitCategoryName,
  370. b.websit_goods_id,
  371. b.websit_goods_name,
  372. c.goods_specification AS specification,
  373. c.goods_sales_convert_qty,
  374. c.manage_worker_stock,
  375. c.status AS websitGoodsStatus
  376. FROM
  377. worker_goods a
  378. LEFT JOIN worker_goods_rela b ON a.company_wechat_id = b.company_wechat_id AND a.goods_id = b.worker_goods_id
  379. LEFT JOIN websit_goods c ON a.company_wechat_id = c.company_wechat_id AND b.websit_goods_id = c.goods_id
  380. <where>
  381. <if test="companyWechatId != null and companyWechatId != ''">
  382. AND a.company_wechat_id = #{companyWechatId}
  383. </if>
  384. </where>
  385. </select>
  386. <select id="websitVenderGoodsPage"
  387. resultType="com.gree.mall.manager.bean.material.vender.WebsitVenderGoodsVO">
  388. SELECT
  389. ${ex.selected}
  390. FROM websit_vender_goods a
  391. ${ex.query}
  392. <if test="ex.orderBy == null or ex.orderBy ==''">
  393. ORDER BY a.create_time DESC
  394. </if>
  395. ${ex.orderBy}
  396. </select>
  397. <select id="websitVenderGoodsRalaPage"
  398. resultType="com.gree.mall.manager.bean.material.vender.WebsitVenderGoodsRelaVO">
  399. SELECT
  400. ${ex.selected}
  401. FROM
  402. websit_vender_goods_rela a
  403. JOIN websit_goods b ON a.company_wechat_id = b.company_wechat_id AND a.goods_id = b.goods_id
  404. LEFT JOIN websit_goods_category c ON b.goods_category_id = c.category_id
  405. ${ex.query}
  406. <if test="ex.orderBy == null or ex.orderBy ==''">
  407. ORDER BY a.create_time DESC
  408. </if>
  409. ${ex.orderBy}
  410. </select>
  411. <select id="websitPurchaseApplyPage"
  412. resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseApplyVO">
  413. SELECT
  414. ${ex.selected}
  415. FROM
  416. websit_purchase a
  417. ${ex.query}
  418. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  419. AND a.websit_id IN
  420. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  421. #{item}
  422. </foreach>
  423. </if>
  424. AND a.flag IN ('SAVE', 'SUBMIT')
  425. AND a.is_recheck = 'NO'
  426. <if test="ex.orderBy == null or ex.orderBy ==''">
  427. ORDER BY a.create_time DESC
  428. </if>
  429. ${ex.orderBy}
  430. </select>
  431. <select id="websitPurchaseCheckPage"
  432. resultType="com.gree.mall.manager.bean.material.vender.WebsitPurchaseCheckVO">
  433. SELECT
  434. ${ex.selected}
  435. FROM
  436. websit_purchase a
  437. ${ex.query}
  438. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  439. AND a.websit_id IN
  440. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  441. #{item}
  442. </foreach>
  443. </if>
  444. AND a.flag IN ('SUBMIT', 'OK')
  445. <if test="ex.orderBy == null or ex.orderBy ==''">
  446. ORDER BY a.create_time DESC
  447. </if>
  448. ${ex.orderBy}
  449. </select>
  450. <select id="websitPurchaseOrderPage"
  451. resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseOrderVO">
  452. SELECT
  453. ${ex.selected}
  454. FROM
  455. websit_purchase a
  456. ${ex.query}
  457. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  458. AND a.websit_id IN
  459. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  460. #{item}
  461. </foreach>
  462. </if>
  463. AND a.flag IN ('SUBMIT', 'OK', 'CANCEL')
  464. AND a.is_recheck = 'YES'
  465. <if test="ex.orderBy == null or ex.orderBy ==''">
  466. ORDER BY a.create_time DESC
  467. </if>
  468. ${ex.orderBy}
  469. </select>
  470. <select id="websitPurchaseAdjustmentPage"
  471. resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseAdjustmentVO">
  472. SELECT
  473. ${ex.selected}
  474. FROM
  475. websit_purchase_adjustment a
  476. ${ex.query}
  477. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  478. AND a.websit_id IN
  479. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  480. #{item}
  481. </foreach>
  482. </if>
  483. <if test="ex.orderBy == null or ex.orderBy ==''">
  484. ORDER BY a.create_time DESC
  485. </if>
  486. ${ex.orderBy}
  487. </select>
  488. <select id="websitPartsNewInPage"
  489. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsNewInVO">
  490. SELECT
  491. ${ex.selected}
  492. FROM
  493. websit_parts_new_in_record a
  494. ${ex.query}
  495. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  496. AND a.receive_websit_id IN
  497. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  498. #{item}
  499. </foreach>
  500. </if>
  501. <if test="ex.orderBy == null or ex.orderBy ==''">
  502. ORDER BY a.create_time DESC
  503. </if>
  504. ${ex.orderBy}
  505. </select>
  506. <select id="websitPartsOldOutPage"
  507. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsOldOutVO">
  508. SELECT
  509. ${ex.selected}
  510. FROM
  511. websit_parts_old_out_record a
  512. ${ex.query}
  513. <if test="ex.receiveDate != null">
  514. AND a.receive_date IS NULL
  515. </if>
  516. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  517. AND a.send_websit_id IN
  518. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  519. #{item}
  520. </foreach>
  521. </if>
  522. <if test="ex.orderBy == null or ex.orderBy ==''">
  523. ORDER BY a.create_time DESC
  524. </if>
  525. ${ex.orderBy}
  526. </select>
  527. <select id="websitWorkSettlementPage"
  528. resultType="com.gree.mall.manager.bean.material.manage.WebsitWorkSettlementVO">
  529. SELECT
  530. ${ex.selected}
  531. FROM
  532. websit_parts_settlement_record a
  533. ${ex.query}
  534. <if test="ex.orderBy == null or ex.orderBy ==''">
  535. ORDER BY a.import_time DESC
  536. </if>
  537. ${ex.orderBy}
  538. </select>
  539. <select id="websitPartsConfigPage"
  540. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsConfigVO">
  541. SELECT
  542. ${ex.selected}
  543. FROM
  544. websit_parts_refund_config a LEFT JOIN material_config b ON a.company_wechat_id = b.company_wechat_id
  545. ${ex.query}
  546. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  547. AND a.websit_id IN
  548. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  549. #{item}
  550. </foreach>
  551. </if>
  552. <if test="ex.orderBy == null or ex.orderBy ==''">
  553. ORDER BY a.create_time DESC
  554. </if>
  555. ${ex.orderBy}
  556. </select>
  557. <select id="websitPartsSalesPage"
  558. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsSalesVO">
  559. SELECT
  560. ${ex.selected},
  561. CASE WHEN a.delivery_type = 0 AND a.buy_people = 'WORKER' AND a.websit_confirm_date IS NOT NULL THEN 1 ELSE 0 END AS deliveryConfirmFlag
  562. FROM
  563. websit_parts_sales a LEFT JOIN websit_parts_sales_item b ON a.id = b.sales_id
  564. ${ex.query}
  565. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  566. AND a.websit_id IN
  567. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  568. #{item}
  569. </foreach>
  570. </if>
  571. <if test="ex.orderBy == null or ex.orderBy ==''">
  572. ORDER BY a.create_time DESC
  573. </if>
  574. ${ex.orderBy}
  575. </select>
  576. <select id="websitPartsSalesWPage"
  577. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsSalesWVO">
  578. SELECT
  579. ${ex.selected},
  580. CASE WHEN a.delivery_type = 0 AND a.buy_people = 'WORKER' AND a.websit_confirm_date IS NOT NULL THEN 1 ELSE 0 END AS deliveryConfirmFlag
  581. FROM
  582. websit_parts_sales a
  583. ${ex.query}
  584. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  585. AND a.websit_id IN
  586. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  587. #{item}
  588. </foreach>
  589. </if>
  590. <if test="ex.orderBy == null or ex.orderBy ==''">
  591. ORDER BY a.create_time DESC
  592. </if>
  593. ${ex.orderBy}
  594. </select>
  595. <select id="selectItemBySalesOrderId"
  596. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsSalesItemBean">
  597. select
  598. a.id ,
  599. a.identity ,
  600. a.websit_id,
  601. a.parts_websit_id,
  602. a.parts_id,
  603. a.parts_number,
  604. a.parts_name,
  605. a.material_group_name,
  606. a.goods_stock_unit,
  607. a.sales_id,
  608. a.sales_price,
  609. a.market_price,
  610. a.second_price,
  611. IF(d.status = 'END', a.examine_qty, a.qty) AS qty,
  612. a.examine_qty,
  613. a.new_refund_qty,
  614. a.old_refund_qty ,
  615. a.total_amount,
  616. a.push_flag ,
  617. a.create_by ,
  618. a.create_time,
  619. a.update_by,
  620. a.update_time,
  621. IFNULL(c.qty, 0) stockQty
  622. FROM websit_parts_sales_item a JOIN websit_goods b ON a.parts_id = b.goods_id
  623. LEFT JOIN websit_stock c ON a.websit_id = c.websit_id AND a.parts_number = c.goods_id AND a.parts_websit_id = c.parts_websit_id
  624. JOIN websit_parts_sales d ON a.sales_id = d.id
  625. WHERE a.sales_id = #{id}
  626. </select>
  627. <select id="queryOldRefundRecordById"
  628. resultType="com.gree.mall.manager.bean.material.worker.OldRefundManageRecordBean">
  629. SELECT
  630. a.*
  631. FROM
  632. websit_parts_old_refund_manage_record a
  633. WHERE
  634. sales_id = #{id}
  635. </select>
  636. <select id="newRefundManagePage"
  637. resultType="com.gree.mall.manager.bean.material.worker.NewRefundManageVO">
  638. SELECT
  639. ${ex.selected}
  640. FROM
  641. websit_parts_new_refund_manage a
  642. ${ex.query}
  643. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  644. AND a.receive_websit_id IN
  645. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  646. #{item}
  647. </foreach>
  648. </if>
  649. <if test="ex.orderBy == null or ex.orderBy ==''">
  650. ORDER BY a.create_time DESC
  651. </if>
  652. ${ex.orderBy}
  653. </select>
  654. <select id="oldRefundManagePage" resultType="com.gree.mall.manager.bean.material.worker.OldRefundManageVO">
  655. SELECT
  656. ${ex.selected}
  657. FROM
  658. websit_parts_old_refund_manage a
  659. ${ex.query}
  660. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  661. AND a.receive_websit_id IN
  662. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  663. #{item}
  664. </foreach>
  665. </if>
  666. <if test="ex.orderBy == null or ex.orderBy ==''">
  667. ORDER BY a.create_time DESC
  668. </if>
  669. ${ex.orderBy}
  670. </select>
  671. <select id="websitPurchaseChangeSalesPage"
  672. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsChangeSalesVO">
  673. SELECT
  674. ${ex.selected}
  675. FROM
  676. websit_parts_change_sales a
  677. ${ex.query}
  678. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  679. AND a.websit_id IN
  680. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  681. #{item}
  682. </foreach>
  683. </if>
  684. <if test="ex.orderBy == null or ex.orderBy ==''">
  685. ORDER BY a.create_time DESC
  686. </if>
  687. ${ex.orderBy}
  688. </select>
  689. <select id="websitPartsRefundRecordPage"
  690. resultType="com.gree.mall.manager.bean.material.manage.WebsitPartsRefundRecordVO">
  691. SELECT
  692. ${ex.selected}
  693. FROM
  694. websit_parts_refund_record a
  695. ${ex.query}
  696. <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
  697. AND a.websit_id IN
  698. <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
  699. #{item}
  700. </foreach>
  701. </if>
  702. <if test="ex.orderBy == null or ex.orderBy ==''">
  703. ORDER BY a.create_time DESC
  704. </if>
  705. ${ex.orderBy}
  706. </select>
  707. </mapper>