WorkerStockCMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.miniapp.commonmapper.stock.MaterialGoodsStockCMapper">
  4. <select id="queryWebsitGoodsCategoryList" resultType="com.gree.mall.miniapp.plus.entity.WebsitGoodsCategory">
  5. select
  6. distinct
  7. a.*
  8. from websit_goods_category a
  9. join worker_goods b on a.category_id = b.goods_category_id
  10. join worker_stock c on c.goods_id = b.goods_id
  11. <where>
  12. <if test="goodsType != null and goodsType !=''">
  13. and c.goods_type = #{goodsType}
  14. </if>
  15. <if test="websitId != null and websitId !=''">
  16. and c.websit_id = #{websitId}
  17. </if>
  18. and c.identity = #{user.idCard}
  19. </where>
  20. </select>
  21. <select id="queryWorkerStockList" resultType="com.gree.mall.miniapp.bean.material.stock.WorkerStockBean">
  22. select
  23. a.*,
  24. <if test="goodsType != null and goodsType == 'M'.toString()">
  25. c.category_name,
  26. </if>
  27. b.goods_category_id
  28. from worker_stock a
  29. join worker_goods b on a.goods_id=b.goods_id
  30. <if test="goodsType != null and goodsType == 'M'.toString()">
  31. join websit_goods_category c on c.category_id = b.goods_category_id
  32. </if>
  33. <where>
  34. <if test="goodsType != null and goodsType !=''">
  35. and a.goods_type = #{goodsType}
  36. </if>
  37. <if test="websitId != null and websitId !=''">
  38. and a.websit_id = #{websitId}
  39. </if>
  40. and a.identity = #{user.idCard}
  41. <if test="goodsType == null">
  42. and a.worker_id = ''
  43. </if>
  44. <if test="categoryId != null and categoryId !=''">
  45. and b.goods_category_id = #{categoryId}
  46. </if>
  47. </where>
  48. </select>
  49. <select id="queryExistWebsitStockList" resultType="com.gree.mall.miniapp.plus.entity.WebsitStock">
  50. SELECT
  51. *
  52. FROM
  53. websit_stock
  54. WHERE
  55. company_wechat_id = #{companyWechatId}
  56. AND
  57. websit_id = #{websitId}
  58. AND
  59. storage_id = #{storageId}
  60. AND
  61. goods_id IN
  62. <foreach item="item" index="index" collection="stockList" open="(" separator=","
  63. close=")">
  64. #{item.goodsId}
  65. </foreach>
  66. FOR UPDATE
  67. </select>
  68. <select id="queryExistWorkerStockList" resultType="com.gree.mall.miniapp.plus.entity.WorkerStock">
  69. SELECT
  70. *
  71. FROM
  72. worker_stock
  73. WHERE
  74. company_wechat_id = #{dto.companyWechatId}
  75. AND identity = #{dto.identity}
  76. AND goods_id IN
  77. <foreach item="item" index="index" collection="stockList" open="(" separator=","
  78. close=")">
  79. #{item.goodsId}
  80. </foreach>
  81. FOR UPDATE
  82. </select>
  83. </mapper>