InventoryDataMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.emato.biz.mapper.mall.InventoryDataMapper">
  6. <resultMap id="inventoryDataVO" type="com.emato.biz.domain.mall.InventoryDataPushVo">
  7. <result column="prod_barcode" property="barcode" />
  8. <result column="plu" property="plu" />
  9. <result column="mychem_id" property="mychemId" />
  10. <result column="name" property="productName"/>
  11. <result column="shop_sn" property="shopSn" />
  12. <result column="shop_inve" property="shopInvent" />
  13. <result column="valid_num" property="eMatou" />
  14. </resultMap>
  15. <!-- 查询库存数据 -->
  16. <select id="selectInventoryData" parameterType="com.emato.biz.domain.mall.InventoryReqVO" resultMap="inventoryDataVO">
  17. SELECT
  18. t.prod_barcode,
  19. t.plu,
  20. t.mychem_id,
  21. t.name,
  22. t1.shop_sn,
  23. t1.shop_inve,
  24. t2.valid_num
  25. FROM
  26. mall_goods t
  27. LEFT JOIN wb_merch_shop_inve t1 ON t.sku = t1.sku
  28. LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
  29. <where>
  30. t1.is_valid = 0
  31. AND t2.inve_status = 0
  32. AND t2.is_valid = 0
  33. </where>
  34. <if test="pageIndex != null and pageSize != null">
  35. limit #{pageIndex}, #{pageSize}
  36. </if>
  37. </select>
  38. <!-- 查询库存数据总条数 -->
  39. <select id="selectInventoryTotal" resultType="int">
  40. SELECT
  41. COUNT(1)
  42. FROM
  43. mall_goods t
  44. LEFT JOIN wb_merch_shop_inve t1 ON t.sku = t1.sku
  45. LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
  46. <where>
  47. t1.is_valid = 0
  48. AND t2.inve_status = 0
  49. AND t2.is_valid = 0
  50. </where>
  51. </select>
  52. <select id="getInventoryTotal" resultType="java.lang.Integer">
  53. SELECT
  54. count(*)
  55. FROM
  56. o_inventory_data
  57. </select>
  58. <insert id="inserInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo" >
  59. insert into o_inventory_data
  60. <trim prefix="(" suffix=")" suffixOverrides="," >
  61. <if test="barcode != null" >
  62. bar_code,
  63. </if>
  64. <if test="productName != null" >
  65. product_name,
  66. </if>
  67. <if test="shopCode != null" >
  68. shop_code,
  69. </if>
  70. <if test="shopName != null" >
  71. shop_name,
  72. </if>
  73. <if test="shopInvent != null" >
  74. shop_invent,
  75. </if>
  76. <if test="eMatou != null" >
  77. e_matou,
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides="," >
  81. <if test="barcode != null" >
  82. #{barcode},
  83. </if>
  84. <if test="productName != null" >
  85. #{productName},
  86. </if>
  87. <if test="shopCode != null" >
  88. #{shopCode},
  89. </if>
  90. <if test="shopName != null" >
  91. #{shopName},
  92. </if>
  93. <if test="shopInvent != null" >
  94. #{shopInvent},
  95. </if>
  96. <if test="eMatou != null" >
  97. #{eMatou},
  98. </if>
  99. </trim>
  100. </insert>
  101. <update id="updateInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo">
  102. update o_inventory_data
  103. <trim prefix="SET" suffixOverrides=",">
  104. <if test="shopInvent != null">shop_invent = #{shopInvent},</if>
  105. <if test="eMatou != null">e_matou = #{eMatou},</if>
  106. </trim>
  107. where bar_code = #{barcode} and shop_code = #{shopCode}
  108. </update>
  109. <select id="queryOneInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo" resultType="java.lang.Integer">
  110. select count(*) from o_inventory_data oid where bar_code = #{barcode} and shop_code = #{shopCode}
  111. </select>
  112. </mapper>