ProdInventoryMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.xingxi.business.ProdInventory.mapper.ProdInventoryMapper">
  4. <resultMap type="ProdInventory" id="ProdInventoryResult">
  5. <result property="prodInventoryId" column="prodInventoryId" />
  6. <result property="prodId" column="prodId" />
  7. <result property="prodAttrId" column="prodAttrId" />
  8. <result property="mercId" column="mercId" />
  9. <result property="quantity" column="quantity" />
  10. <result property="availQty" column="availQty" />
  11. <result property="delFlag" column="delFlag" />
  12. <result property="createUser" column="createUser" />
  13. <result property="createTime" column="createTime" />
  14. <result property="updateUser" column="updateUser" />
  15. <result property="updateTime" column="updateTime" />
  16. </resultMap>
  17. <sql id="selectProdInventory">
  18. select prodInventoryId, prodId, prodAttrId, mercId, quantity, availQty, delFlag, createUser, createTime, updateUser, updateTime from t_prod_inventory
  19. </sql>
  20. <sql id="selectProdInventoryExt">
  21. select
  22. ${tableAlias}.prodInventoryId,
  23. ${tableAlias}.prodId,
  24. ${tableAlias}.prodAttrId,
  25. ${tableAlias}.mercId,
  26. ${tableAlias}.quantity,
  27. ${tableAlias}.availQty,
  28. ${tableAlias}.delFlag,
  29. ${tableAlias}.createUser,
  30. ${tableAlias}.createTime,
  31. ${tableAlias}.updateUser,
  32. ${tableAlias}.updateTime
  33. from t_prod_inventory ${tableAlias}
  34. </sql>
  35. <select id="selectProdInventoryList" parameterType="ProdInventory" resultMap="ProdInventoryResult">
  36. <include refid="selectProdInventory"/>
  37. <where>
  38. <if test="prodId != null "> and prodId = #{prodId}</if>
  39. <if test="prodAttrId != null "> and prodAttrId = #{prodAttrId}</if>
  40. <if test="mercId != null "> and mercId = #{mercId}</if>
  41. <if test="quantity != null "> and quantity = #{quantity}</if>
  42. <if test="availQty != null "> and availQty = #{availQty}</if>
  43. <if test="delFlag != null and delFlag != ''"> and delFlag = #{delFlag}</if>
  44. <if test="createUser != null and createUser != ''"> and createUser = #{createUser}</if>
  45. <if test="createTime != null "> and createTime = #{createTime}</if>
  46. <if test="updateUser != null and updateUser != ''"> and updateUser = #{updateUser}</if>
  47. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  48. </where>
  49. </select>
  50. <select id="selectProdInventoryByProdInventoryId" parameterType="Long" resultMap="ProdInventoryResult">
  51. <include refid="selectProdInventory"/>
  52. where prodInventoryId = #{prodInventoryId}
  53. </select>
  54. <insert id="insertProdInventory" parameterType="ProdInventory" useGeneratedKeys="true" keyProperty="prodInventoryId">
  55. insert into t_prod_inventory
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="prodId != null">prodId,</if>
  58. <if test="prodAttrId != null">prodAttrId,</if>
  59. <if test="mercId != null">mercId,</if>
  60. <if test="quantity != null">quantity,</if>
  61. <if test="availQty != null">availQty,</if>
  62. <if test="delFlag != null">delFlag,</if>
  63. <if test="createUser != null">createUser,</if>
  64. <if test="createTime != null">createTime,</if>
  65. <if test="updateUser != null">updateUser,</if>
  66. <if test="updateTime != null">updateTime,</if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="prodId != null">#{prodId},</if>
  70. <if test="prodAttrId != null">#{prodAttrId},</if>
  71. <if test="mercId != null">#{mercId},</if>
  72. <if test="quantity != null">#{quantity},</if>
  73. <if test="availQty != null">#{availQty},</if>
  74. <if test="delFlag != null">#{delFlag},</if>
  75. <if test="createUser != null">#{createUser},</if>
  76. <if test="createTime != null">#{createTime},</if>
  77. <if test="updateUser != null">#{updateUser},</if>
  78. <if test="updateTime != null">#{updateTime},</if>
  79. </trim>
  80. </insert>
  81. <insert id="batchInsertProdInventory">
  82. insert into t_prod_inventory( prodId, prodAttrId, mercId, quantity, availQty, delFlag, createUser, createTime, updateUser, updateTime) values
  83. <foreach item="item" index="index" collection="list" separator=",">
  84. ( #{item.prodId}, #{item.prodAttrId}, #{item.mercId}, #{item.quantity}, #{item.availQty}, #{item.delFlag}, #{item.createUser}, #{item.createTime}, #{item.updateUser}, #{item.updateTime})
  85. </foreach>
  86. </insert>
  87. <update id="updateProdInventory" parameterType="ProdInventory">
  88. update t_prod_inventory
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="prodId != null">prodId = #{prodId},</if>
  91. <if test="prodAttrId != null">prodAttrId = #{prodAttrId},</if>
  92. <if test="mercId != null">mercId = #{mercId},</if>
  93. <if test="quantity != null">quantity = #{quantity},</if>
  94. <if test="availQty != null">availQty = #{availQty},</if>
  95. <if test="delFlag != null">delFlag = #{delFlag},</if>
  96. <if test="createUser != null">createUser = #{createUser},</if>
  97. <if test="createTime != null">createTime = #{createTime},</if>
  98. <if test="updateUser != null">updateUser = #{updateUser},</if>
  99. <if test="updateTime != null">updateTime = #{updateTime},</if>
  100. </trim>
  101. where prodInventoryId = #{prodInventoryId}
  102. </update>
  103. <delete id="deleteProdInventoryByProdInventoryId" parameterType="Long">
  104. delete from t_prod_inventory where prodInventoryId = #{prodInventoryId}
  105. </delete>
  106. <delete id="deleteProdInventoryByProdInventoryIds" parameterType="String">
  107. delete from t_prod_inventory where prodInventoryId in
  108. <foreach item="prodInventoryId" collection="array" open="(" separator="," close=")">
  109. #{prodInventoryId}
  110. </foreach>
  111. </delete>
  112. <update id="logicDeleteProdInventoryByProdInventoryId" parameterType="Long">
  113. update t_prod_inventory
  114. set delFlag = '1'
  115. where prodInventoryId = #{prodInventoryId}
  116. </update>
  117. <update id="logicDeleteProdInventoryByProdInventoryIds" parameterType="String">
  118. update t_prod_inventory
  119. set delFlag = '1'
  120. where prodInventoryId in
  121. <foreach item="prodInventoryId" collection="array" open="(" separator="," close=")">
  122. #{prodInventoryId}
  123. </foreach>
  124. </update>
  125. <update id="logicDeleteProdInventoryByCondition" parameterType="ProdInventory">
  126. update t_prod_inventory
  127. set delFlag = '1'
  128. <where>
  129. <if test="prodId != null "> and prodId = #{prodId}</if>
  130. <if test="prodAttrId != null "> and prodAttrId = #{prodAttrId}</if>
  131. <if test="mercId != null "> and mercId = #{mercId}</if>
  132. <if test="quantity != null "> and quantity = #{quantity}</if>
  133. <if test="availQty != null "> and availQty = #{availQty}</if>
  134. <if test="delFlag != null and delFlag != ''"> and delFlag = #{delFlag}</if>
  135. <if test="createUser != null and createUser != ''"> and createUser = #{createUser}</if>
  136. <if test="createTime != null "> and createTime = #{createTime}</if>
  137. <if test="updateUser != null and updateUser != ''"> and updateUser = #{updateUser}</if>
  138. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  139. </where>
  140. </update>
  141. </mapper>