StoreMngChangeDao.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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="goodsName != null and goodsName != ''">
  88. AND g.name = #{goodsName}
  89. </if>
  90. <if test="storeId != null and storeId != ''">
  91. AND c.store_id = #{storeId}
  92. </if>
  93. <if test="changeType != null and changeType != ''">
  94. AND c.change_type = #{changeType}
  95. </if>
  96. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  97. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  98. </if>
  99. <choose>
  100. <when test="sidx != null and sidx.trim() != ''">
  101. order by ${sidx} ${order}
  102. </when>
  103. <otherwise>
  104. order by id desc
  105. </otherwise>
  106. </choose>
  107. <if test="offset != null and limit != null">
  108. limit #{offset}, #{limit}
  109. </if>
  110. </select>
  111. <select id="queryTotal" resultType="int">
  112. select count(*) from mall_store_mng_change c left join mall_merch m on c.merch_sn = m.merch_sn
  113. left join mall_store s on s.id = c.store_id
  114. left join mall_goods g on c.goods_id = g.id
  115. WHERE 1=1
  116. <if test="goodsId != null and goodsId != ''">
  117. AND c.goods_id = #{goodsId}
  118. </if>
  119. <if test="goodsName != null and goodsName != ''">
  120. AND g.name = #{goodsName}
  121. </if>
  122. <if test="storeId != null and storeId != ''">
  123. AND c.store_id = #{storeId}
  124. </if>
  125. <if test="changeType != null and changeType != ''">
  126. AND c.change_type = #{changeType}
  127. </if>
  128. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  129. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  130. </if>
  131. </select>
  132. <insert id="save" parameterType="com.kmall.admin.entity.StoreMngChangeEntity">
  133. insert into mall_store_mng_change(
  134. `store_change_num`,
  135. `store_original_num`,
  136. `store_valid_num`,
  137. `merch_sn`,
  138. `store_id`,
  139. `goods_id`,
  140. `is_valid`,
  141. `change_type`,
  142. `change_reason`,
  143. `creater_sn`,
  144. `create_time`,
  145. `moder_sn`,
  146. `mod_time`,
  147. `tstm`,
  148. order_sn)
  149. values(
  150. #{storeChangeNum},
  151. #{storeOriginalNum},
  152. #{storeValidNum},
  153. #{merchSn},
  154. #{storeId},
  155. #{goodsId},
  156. #{isValid},
  157. #{changeType},
  158. #{changeReason},
  159. #{createrSn},
  160. #{createTime},
  161. #{moderSn},
  162. #{modTime},
  163. #{tstm},
  164. #{orderSn})
  165. </insert>
  166. <update id="update" parameterType="com.kmall.admin.entity.StoreMngChangeEntity">
  167. update mall_store_mng_change
  168. <set>
  169. <if test="storeChangeNum != null">`store_change_num` = #{storeChangeNum}, </if>
  170. <if test="storeOriginalNum != null">`store_original_num` = #{storeOriginalNum}, </if>
  171. <if test="storeValidNum != null">`store_valid_num` = #{storeValidNum}, </if>
  172. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  173. <if test="storeId != null">`store_id` = #{storeId}, </if>
  174. <if test="goodsId != null">`goods_id` = #{goodsId}, </if>
  175. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  176. <if test="changeType != null">`change_type` = #{changeType}, </if>
  177. <if test="changeReason != null">`change_reason` = #{changeReason}, </if>
  178. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  179. <if test="createTime != null">`create_time` = #{createTime}, </if>
  180. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  181. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  182. <if test="tstm != null">`tstm` = #{tstm}</if>
  183. </set>
  184. where id = #{id}
  185. </update>
  186. <delete id="delete">
  187. delete from mall_store_mng_change where id = #{value}
  188. </delete>
  189. <delete id="deleteBatch">
  190. delete from mall_store_mng_change where id in
  191. <foreach item="id" collection="array" open="(" separator="," close=")">
  192. #{id}
  193. </foreach>
  194. </delete>
  195. </mapper>