StoreMngChangeDao.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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.admin.dao.StoreMngChangeDao">
  4. <resultMap type="com.kmall.admin.entity.StoreMngChangeEntity" 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.admin.entity.StoreMngChangeEntity">
  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="queryObjectByGoodsIdAndType" resultType="com.kmall.admin.entity.StoreMngChangeEntity">
  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
  59. where change_type = #{changeType} and goods_id = #{goodsId}
  60. </select>
  61. <select id="queryList" resultType="com.kmall.admin.entity.StoreMngChangeEntity">
  62. select
  63. c.`id`,
  64. c.`store_change_num`,
  65. c.`store_original_num`,
  66. c.`store_valid_num`,
  67. c.`merch_sn`,
  68. c.`store_id`,
  69. c.`goods_id`,
  70. c.`is_valid`,
  71. c.`change_type`,
  72. c.`change_reason`,
  73. c.`creater_sn`,
  74. c.`create_time`,
  75. c.`moder_sn`,
  76. c.`mod_time`,
  77. s.store_name storeName,
  78. g.name goodsName,
  79. m.merch_name merchName
  80. from mall_store_mng_change c left join mall_merch m on c.merch_sn = m.merch_sn
  81. left join mall_store s on s.id = c.store_id
  82. left join mall_goods g on c.goods_id = g.id
  83. WHERE 1=1
  84. <if test="goodsId != null and goodsId != ''">
  85. AND c.goods_id = #{goodsId}
  86. </if>
  87. <if test="storeId != null and storeId != ''">
  88. AND c.store_id = #{storeId}
  89. </if>
  90. <if test="changeType != null and changeType != ''">
  91. AND c.change_type = #{changeType}
  92. </if>
  93. <choose>
  94. <when test="sidx != null and sidx.trim() != ''">
  95. order by ${sidx} ${order}
  96. </when>
  97. <otherwise>
  98. order by id desc
  99. </otherwise>
  100. </choose>
  101. <if test="offset != null and limit != null">
  102. limit #{offset}, #{limit}
  103. </if>
  104. </select>
  105. <select id="queryTotal" resultType="int">
  106. select count(*) from mall_store_mng_change
  107. WHERE 1=1
  108. <if test="name != null and name.trim() != ''">
  109. AND name LIKE concat('%',#{name},'%')
  110. </if>
  111. </select>
  112. <insert id="save" parameterType="com.kmall.admin.entity.StoreMngChangeEntity">
  113. insert into mall_store_mng_change(
  114. `store_change_num`,
  115. `store_original_num`,
  116. `store_valid_num`,
  117. `merch_sn`,
  118. `store_id`,
  119. `goods_id`,
  120. `is_valid`,
  121. `change_type`,
  122. `change_reason`,
  123. `creater_sn`,
  124. `create_time`,
  125. `moder_sn`,
  126. `mod_time`,
  127. `tstm`)
  128. values(
  129. #{storeChangeNum},
  130. #{storeOriginalNum},
  131. #{storeValidNum},
  132. #{merchSn},
  133. #{storeId},
  134. #{goodsId},
  135. #{isValid},
  136. #{changeType},
  137. #{changeReason},
  138. #{createrSn},
  139. #{createTime},
  140. #{moderSn},
  141. #{modTime},
  142. #{tstm})
  143. </insert>
  144. <update id="update" parameterType="com.kmall.admin.entity.StoreMngChangeEntity">
  145. update mall_store_mng_change
  146. <set>
  147. <if test="storeChangeNum != null">`store_change_num` = #{storeChangeNum}, </if>
  148. <if test="storeOriginalNum != null">`store_original_num` = #{storeOriginalNum}, </if>
  149. <if test="storeValidNum != null">`store_valid_num` = #{storeValidNum}, </if>
  150. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  151. <if test="storeId != null">`store_id` = #{storeId}, </if>
  152. <if test="goodsId != null">`goods_id` = #{goodsId}, </if>
  153. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  154. <if test="changeType != null">`change_type` = #{changeType}, </if>
  155. <if test="changeReason != null">`change_reason` = #{changeReason}, </if>
  156. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  157. <if test="createTime != null">`create_time` = #{createTime}, </if>
  158. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  159. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  160. <if test="tstm != null">`tstm` = #{tstm}</if>
  161. </set>
  162. where id = #{id}
  163. </update>
  164. <delete id="delete">
  165. delete from mall_store_mng_change where id = #{value}
  166. </delete>
  167. <delete id="deleteBatch">
  168. delete from mall_store_mng_change where id in
  169. <foreach item="id" collection="array" open="(" separator="," close=")">
  170. #{id}
  171. </foreach>
  172. </delete>
  173. </mapper>