StoreMngChangeDao.xml 6.2 KB

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