ApiStoreMngChangeMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.kmall.api.dao.ApiStoreMngChangeMapper">
  4. <resultMap type="com.kmall.api.entity.StoreMngChangeVo" id="storeMngChangeMap">
  5. <result property="id" column="id"/>
  6. <result property="storeChangeNum" column="store_change_num"/>
  7. <result property="storeOriginalNum" column="store_original_num"/>
  8. <result property="storeValidNum" column="store_valid_num"/>
  9. <result property="merchSn" column="merch_sn"/>
  10. <result property="storeId" column="store_id"/>
  11. <result property="goodsId" column="goods_id"/>
  12. <result property="isValid" column="is_valid"/>
  13. <result property="changeType" column="change_type"/>
  14. <result property="changeReason" column="change_reason"/>
  15. <result property="createrSn" column="creater_sn"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="moderSn" column="moder_sn"/>
  18. <result property="modTime" column="mod_time"/>
  19. <result property="tstm" column="tstm"/>
  20. </resultMap>
  21. <select id="queryObject" resultType="com.kmall.api.entity.StoreMngChangeVo">
  22. select
  23. `id`,
  24. `store_change_num`,
  25. `store_original_num`,
  26. `store_valid_num`,
  27. `merch_sn`,
  28. `store_id`,
  29. `goods_id`,
  30. `is_valid`,
  31. `change_type`,
  32. `change_reason`,
  33. `creater_sn`,
  34. `create_time`,
  35. `moder_sn`,
  36. `mod_time`,
  37. `tstm`
  38. from mall_store_mng_change
  39. where id = #{id}
  40. </select>
  41. <select id="queryList" resultType="com.kmall.api.entity.StoreMngChangeVo">
  42. select
  43. `id`,
  44. `store_change_num`,
  45. `store_original_num`,
  46. `store_valid_num`,
  47. `merch_sn`,
  48. `store_id`,
  49. `goods_id`,
  50. `is_valid`,
  51. `change_type`,
  52. `change_reason`,
  53. `creater_sn`,
  54. `create_time`,
  55. `moder_sn`,
  56. `mod_time`,
  57. `tstm`
  58. from mall_store_mng_change c left join mall_merch m on c.merch_sn = m.merch_sn
  59. left join mall_store s on s.id = c.store_id
  60. left join mall_goods g on c.goods_id = g.id
  61. WHERE 1=1
  62. <if test="goodsId != null and goodsId != ''">
  63. AND c.goods_id = #{goodsId}
  64. </if>
  65. <if test="storeId != null and storeId != ''">
  66. AND c.store_id = #{storeId}
  67. </if>
  68. <choose>
  69. <when test="sidx != null and sidx.trim() != ''">
  70. order by ${sidx} ${order}
  71. </when>
  72. <otherwise>
  73. order by id desc
  74. </otherwise>
  75. </choose>
  76. <if test="offset != null and limit != null">
  77. limit #{offset}, #{limit}
  78. </if>
  79. </select>
  80. <select id="queryTotal" resultType="int">
  81. select count(*) from mall_store_mng_change
  82. WHERE 1=1
  83. <if test="name != null and name.trim() != ''">
  84. AND name LIKE concat('%',#{name},'%')
  85. </if>
  86. </select>
  87. <insert id="save" parameterType="com.kmall.api.entity.StoreMngChangeVo">
  88. insert into mall_store_mng_change(
  89. `store_change_num`,
  90. `store_original_num`,
  91. `store_valid_num`,
  92. `merch_sn`,
  93. `store_id`,
  94. `goods_id`,
  95. `is_valid`,
  96. `change_type`,
  97. `change_reason`,
  98. `creater_sn`,
  99. `create_time`,
  100. `moder_sn`,
  101. `mod_time`,
  102. `tstm`)
  103. values(
  104. #{storeChangeNum},
  105. #{storeOriginalNum},
  106. #{storeValidNum},
  107. #{merchSn},
  108. #{storeId},
  109. #{goodsId},
  110. #{isValid},
  111. #{changeType},
  112. #{changeReason},
  113. #{createrSn},
  114. #{createTime},
  115. #{moderSn},
  116. #{modTime},
  117. #{tstm})
  118. </insert>
  119. <update id="update" parameterType="com.kmall.api.entity.StoreMngChangeVo">
  120. update mall_store_mng_change
  121. <set>
  122. <if test="storeChangeNum != null">`store_change_num` = #{storeChangeNum}, </if>
  123. <if test="storeOriginalNum != null">`store_original_num` = #{storeOriginalNum}, </if>
  124. <if test="storeValidNum != null">`store_valid_num` = #{storeValidNum}, </if>
  125. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  126. <if test="storeId != null">`store_id` = #{storeId}, </if>
  127. <if test="goodsId != null">`goods_id` = #{goodsId}, </if>
  128. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  129. <if test="changeType != null">`change_type` = #{changeType}, </if>
  130. <if test="changeReason != null">`change_reason` = #{changeReason}, </if>
  131. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  132. <if test="createTime != null">`create_time` = #{createTime}, </if>
  133. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  134. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  135. <if test="tstm != null">`tstm` = #{tstm}</if>
  136. </set>
  137. where id = #{id}
  138. </update>
  139. <delete id="delete">
  140. delete from mall_store_mng_change where id = #{value}
  141. </delete>
  142. <delete id="deleteBatch">
  143. delete from mall_store_mng_change where id in
  144. <foreach item="id" collection="array" open="(" separator="," close=")">
  145. #{id}
  146. </foreach>
  147. </delete>
  148. </mapper>