1
0

MkDistSellAllocationDao.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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.mk.dist.MkDistSellAllocationDao">
  4. <resultMap type="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity" id="mkDistSellAllocationMap">
  5. <result property="sellAllocId" column="sell_alloc_id"/>
  6. <result property="distChnlId" column="dist_chnl_id"/>
  7. <result property="distFlag" column="dist_flag"/>
  8. <result property="thirdMerchSn" column="third_merch_sn"/>
  9. <result property="supplierId" column="supplier_id"/>
  10. <result property="distId" column="dist_id"/>
  11. <result property="goodsId" column="goods_id"/>
  12. <result property="allocType" column="alloc_type"/>
  13. <result property="expendDistIds" column="expend_dist_ids"/>
  14. <result property="expendDistLines" column="expend_dist_lines"/>
  15. <result property="isValid" column="is_valid"/>
  16. <result property="note" column="note"/>
  17. <result property="createrSn" column="creater_sn"/>
  18. <result property="createTime" column="create_time"/>
  19. <result property="moderSn" column="moder_sn"/>
  20. <result property="modTime" column="mod_time"/>
  21. <result property="tstm" column="tstm"/>
  22. <result property="storeId" column="store_id"/>
  23. <result property="distName" column="distName"/>
  24. <result property="storeName" column="storeName"/>
  25. <result property="goodsName" column="goodsName"/>
  26. <result property="sellAllocHistoryId" column="sell_alloc_history_id"/>
  27. </resultMap>
  28. <select id="queryObject" resultType="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity">
  29. select
  30. `sell_alloc_id`,
  31. `dist_flag`,
  32. `third_merch_sn`,
  33. `supplier_id`,
  34. `dist_id`,
  35. `goods_id`,
  36. `alloc_type`,
  37. `expend_dist_ids`,
  38. `expend_dist_lines`,
  39. `is_valid`,
  40. `note`,
  41. `creater_sn`,
  42. `create_time`,
  43. `moder_sn`,
  44. `mod_time`,
  45. `tstm`,
  46. store_id,dist_chnl_id,sell_alloc_history_id
  47. from mk_dist_sell_allocation
  48. where sell_alloc_id = #{id}
  49. </select>
  50. <select id="queryList" resultType="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity">
  51. select
  52. a.`sell_alloc_id`,
  53. c.`dist_flag`,
  54. a.`third_merch_sn`,
  55. a.`supplier_id`,
  56. a.`dist_id`,
  57. a.`goods_id`,
  58. a.`alloc_type`,
  59. a.`expend_dist_ids`,
  60. a.`expend_dist_lines`,
  61. a.`is_valid`,
  62. a.`note`,
  63. a.`creater_sn`,
  64. a.`create_time`,
  65. a.`moder_sn`,
  66. a.`mod_time`,
  67. a.`tstm`,a.store_id,a.dist_chnl_id,a.sell_alloc_history_id,
  68. d.dist_name distName,s.store_name storeName,g.name goodsName,
  69. t.third_party_merch_name thirdPartyMerchName,ss.child_supplier_name childSupplierName
  70. from mk_dist_sell_allocation a
  71. left join mk_dist_chnl c on a.dist_chnl_id = c.dist_chnl_id
  72. left join mk_dist d on a.dist_id = d.dist_id
  73. left join mall_store s on a.store_id = s.id
  74. left join mall_goods g on a.goods_id = g.id
  75. left join third_merchant_biz t on a.third_merch_sn = t.third_merch_sn
  76. left join mall_supplier ss on a.supplier_id = ss.id
  77. WHERE 1=1
  78. <if test="distChnlId != null and distChnlId != ''">
  79. AND a.dist_chnl_id = #{distChnlId}
  80. </if>
  81. <if test="storeId != null and storeId != ''">
  82. AND a.store_id = #{storeId}
  83. </if>
  84. <if test="distId != null and distId != ''">
  85. AND a.dist_id = #{distId}
  86. </if>
  87. <if test="goodsId != null and goodsId != ''">
  88. AND a.goods_id = #{goodsId}
  89. </if>
  90. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  91. AND a.third_merch_sn = #{thirdMerchSn}
  92. </if>
  93. <if test="merchSn != null and merchSn != ''">
  94. AND t.merch_sn = #{merchSn}
  95. </if>
  96. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  97. AND t.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 a.sell_alloc_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 mk_dist_sell_allocation a
  113. left join mk_dist_chnl c on a.dist_chnl_id = c.dist_chnl_id
  114. left join mk_dist d on a.dist_id = d.dist_id
  115. left join mall_store s on a.store_id = s.id
  116. left join mall_goods g on a.goods_id = g.id
  117. left join third_merchant_biz t on a.third_merch_sn = t.third_merch_sn
  118. left join mall_supplier ss on a.supplier_id = ss.id
  119. WHERE 1=1
  120. <if test="distChnlId != null and distChnlId != ''">
  121. AND a.dist_chnl_id = #{distChnlId}
  122. </if>
  123. <if test="storeId != null and storeId != ''">
  124. AND a.store_id = #{storeId}
  125. </if>
  126. <if test="distId != null and distId != ''">
  127. AND a.dist_id = #{distId}
  128. </if>
  129. <if test="goodsId != null and goodsId != ''">
  130. AND a.goods_id = #{goodsId}
  131. </if>
  132. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  133. AND a.third_merch_sn = #{thirdMerchSn}
  134. </if>
  135. <if test="merchSn != null and merchSn != ''">
  136. AND t.merch_sn = #{merchSn}
  137. </if>
  138. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  139. AND t.third_party_merch_code = #{thirdPartyMerchCode}
  140. </if>
  141. </select>
  142. <select id="queryAllocationByMap" resultType="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity">
  143. SELECT
  144. a.*,
  145. h.pdist_id
  146. FROM
  147. mk_dist_sell_allocation a
  148. LEFT JOIN mk_dist_hier h ON a.dist_id = h.dist_id
  149. AND a.dist_chnl_id = h.dist_chnl_id
  150. WHERE 1=1
  151. <if test="distId != null and distId != ''">
  152. AND h.dist_id = #{distId}
  153. </if>
  154. <if test="distChnlId != null and distChnlId != ''">
  155. AND h.dist_chnl_id = #{distChnlId}
  156. </if>
  157. <if test="goodsId != null and goodsId != ''">
  158. AND a.goods_id = #{goodsId}
  159. </if>
  160. <if test="storeId != null and storeId != ''">
  161. AND a.store_id = #{storeId}
  162. </if>
  163. <if test="sellAllocId != null and sellAllocId != ''">
  164. AND a.sell_alloc_id != #{sellAllocId}
  165. </if>
  166. </select>
  167. <insert id="save" parameterType="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity" useGeneratedKeys="true" keyProperty="sellAllocId">
  168. insert into mk_dist_sell_allocation(
  169. `dist_flag`,
  170. `third_merch_sn`,
  171. `supplier_id`,
  172. `dist_id`,
  173. dist_chnl_id,
  174. store_id,
  175. `goods_id`,
  176. `alloc_type`,
  177. `expend_dist_ids`,
  178. `expend_dist_lines`,
  179. `is_valid`,
  180. sell_alloc_history_id,
  181. `note`,
  182. `creater_sn`,
  183. `create_time`,
  184. `moder_sn`,
  185. `mod_time`,
  186. `tstm`)
  187. values(
  188. #{distFlag},
  189. #{thirdMerchSn},
  190. #{supplierId},
  191. #{distId},
  192. #{distChnlId},
  193. #{storeId},
  194. #{goodsId},
  195. #{allocType},
  196. #{expendDistIds},
  197. #{expendDistLines},
  198. #{isValid},
  199. #{sellAllocHistoryId},
  200. #{note},
  201. #{createrSn},
  202. #{createTime},
  203. #{moderSn},
  204. #{modTime},
  205. #{tstm})
  206. </insert>
  207. <update id="update" parameterType="com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity">
  208. update mk_dist_sell_allocation
  209. <set>
  210. <if test="distFlag != null">`dist_flag` = #{distFlag}, </if>
  211. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  212. <if test="supplierId != null">`supplier_id` = #{supplierId}, </if>
  213. <if test="distId != null">`dist_id` = #{distId}, </if>
  214. <if test="distChnlId != null">`dist_chnl_id` = #{distChnlId}, </if>
  215. <if test="storeId != null">`store_id` = #{storeId}, </if>
  216. <if test="goodsId != null">`goods_id` = #{goodsId}, </if>
  217. <if test="allocType != null">`alloc_type` = #{allocType}, </if>
  218. <if test="expendDistIds != null">`expend_dist_ids` = #{expendDistIds}, </if>
  219. <if test="expendDistLines != null">`expend_dist_lines` = #{expendDistLines}, </if>
  220. <if test="sellAllocHistoryId != null">`sell_alloc_history_id` = #{sellAllocHistoryId}, </if>
  221. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  222. <if test="note != null">`note` = #{note}, </if>
  223. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  224. <if test="createTime != null">`create_time` = #{createTime}, </if>
  225. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  226. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  227. <if test="tstm != null">`tstm` = #{tstm}</if>
  228. </set>
  229. where sell_alloc_id = #{sellAllocId}
  230. </update>
  231. <delete id="delete">
  232. delete from mk_dist_sell_allocation where sell_alloc_id = #{value}
  233. </delete>
  234. <delete id="deleteBatch">
  235. delete from mk_dist_sell_allocation where sell_alloc_id in
  236. <foreach item="sellAllocId" collection="array" open="(" separator="," close=")">
  237. #{sellAllocId}
  238. </foreach>
  239. </delete>
  240. </mapper>