InventoryDataMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. <resultMap id="inventoryDataDTO" type="com.emato.biz.domain.mall.InventoryDataDTO">
  16. <result column="prod_barcode" property="barcode" />
  17. <result column="sku" property="sku" />
  18. <result column="plu" property="plu" />
  19. <result column="mychem_id" property="mychemId" />
  20. <result column="name" property="productName"/>
  21. <result column="shop_sn" property="shopSn" />
  22. <result column="shop_inve" property="shopInvent" />
  23. <result column="valid_num" property="eMatou" />
  24. </resultMap>
  25. <!-- 查询库存数据 -->
  26. <select id="selectInventoryData" parameterType="com.emato.biz.domain.mall.InventoryReqVO" resultMap="inventoryDataDTO">
  27. SELECT
  28. t1.prod_barcode,
  29. t1.sku,
  30. t1.plu,
  31. t1.mychem_id,
  32. t1.name,
  33. t.shop_sn,
  34. t.shop_inve,
  35. t2.valid_num
  36. FROM
  37. wb_merch_shop_inve t
  38. INNER JOIN mall_goods t1 ON t.sku = t1.sku
  39. AND t.is_valid = '0'
  40. AND t1.is_delete = '0'
  41. LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
  42. AND t2.inve_status = '0'
  43. AND t2.is_valid = '0'
  44. <if test="pageIndex != null and pageSize != null">
  45. limit #{pageIndex}, #{pageSize}
  46. </if>
  47. </select>
  48. <!-- 查询库存数据总条数 -->
  49. <select id="selectInventoryTotal" resultType="int">
  50. SELECT
  51. count( 1 )
  52. FROM
  53. wb_merch_shop_inve t
  54. INNER JOIN mall_goods t1 ON t.sku = t1.sku
  55. AND t.is_valid = '0'
  56. AND t1.is_delete = '0'
  57. LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
  58. AND t2.inve_status = '0'
  59. AND t2.is_valid = '0'
  60. </select>
  61. <select id="getInventoryTotal" resultType="java.lang.Integer">
  62. SELECT
  63. count(*)
  64. FROM
  65. o_inventory_data
  66. </select>
  67. <insert id="inserInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo" >
  68. insert into o_inventory_data
  69. <trim prefix="(" suffix=")" suffixOverrides="," >
  70. <if test="barcode != null" >
  71. bar_code,
  72. </if>
  73. <if test="productName != null" >
  74. product_name,
  75. </if>
  76. <if test="shopCode != null" >
  77. shop_code,
  78. </if>
  79. <if test="shopName != null" >
  80. shop_name,
  81. </if>
  82. <if test="shopInvent != null" >
  83. shop_invent,
  84. </if>
  85. <if test="eMatou != null" >
  86. e_matou,
  87. </if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides="," >
  90. <if test="barcode != null" >
  91. #{barcode},
  92. </if>
  93. <if test="productName != null" >
  94. #{productName},
  95. </if>
  96. <if test="shopCode != null" >
  97. #{shopCode},
  98. </if>
  99. <if test="shopName != null" >
  100. #{shopName},
  101. </if>
  102. <if test="shopInvent != null" >
  103. #{shopInvent},
  104. </if>
  105. <if test="eMatou != null" >
  106. #{eMatou},
  107. </if>
  108. </trim>
  109. </insert>
  110. <update id="updateInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo">
  111. update o_inventory_data
  112. <trim prefix="SET" suffixOverrides=",">
  113. <if test="shopInvent != null">shop_invent = #{shopInvent},</if>
  114. <if test="eMatou != null">e_matou = #{eMatou},</if>
  115. </trim>
  116. where bar_code = #{barcode} and shop_code = #{shopCode}
  117. </update>
  118. <select id="queryOneInventory" parameterType="com.emato.biz.domain.mall.InventoryDataVo" resultType="java.lang.Integer">
  119. select count(*) from o_inventory_data oid where bar_code = #{barcode} and shop_code = #{shopCode}
  120. </select>
  121. </mapper>