MkDistChnlDao.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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.MkDistChnlDao">
  4. <resultMap type="com.kmall.admin.entity.mk.dist.MkDistChnlEntity" id="mkDistChnlMap">
  5. <result property="distChnlId" column="dist_chnl_id"/>
  6. <result property="distFlag" column="dist_flag"/>
  7. <result property="partType" column="part_type"/>
  8. <result property="thirdMerchSn" column="third_merch_sn"/>
  9. <result property="supplierId" column="supplier_id"/>
  10. <result property="sortOrder" column="sort_order"/>
  11. <result property="isValid" column="is_valid"/>
  12. <result property="note" column="note"/>
  13. <result property="createrSn" column="creater_sn"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="moderSn" column="moder_sn"/>
  16. <result property="modTime" column="mod_time"/>
  17. <result property="tstm" column="tstm"/>
  18. </resultMap>
  19. <select id="queryObject" resultType="com.kmall.admin.entity.mk.dist.MkDistChnlEntity">
  20. select
  21. `dist_chnl_id`,
  22. `dist_flag`,
  23. `part_type`,
  24. `third_merch_sn`,
  25. `supplier_id`,
  26. `sort_order`,
  27. `is_valid`,
  28. `note`,
  29. `creater_sn`,
  30. `create_time`,
  31. `moder_sn`,
  32. `mod_time`,
  33. `tstm`
  34. from mk_dist_chnl
  35. where dist_chnl_id = #{id}
  36. </select>
  37. <select id="queryObjectByDistFlag" resultType="com.kmall.admin.entity.mk.dist.MkDistChnlEntity">
  38. select
  39. `dist_chnl_id`,
  40. `dist_flag`,
  41. `part_type`,
  42. `third_merch_sn`,
  43. `supplier_id`,
  44. `sort_order`,
  45. `is_valid`,
  46. `note`,
  47. `creater_sn`,
  48. `create_time`,
  49. `moder_sn`,
  50. `mod_time`,
  51. `tstm`
  52. from mk_dist_chnl
  53. where dist_flag = #{distFlag}
  54. </select>
  55. <select id="queryList" resultType="com.kmall.admin.entity.mk.dist.MkDistChnlEntity">
  56. select
  57. d.`dist_chnl_id`,
  58. d.`dist_flag`,
  59. d.`part_type`,
  60. d.`third_merch_sn`,
  61. d.`supplier_id`,
  62. d.`sort_order`,
  63. d.`is_valid`,
  64. d.`note`,
  65. d.`creater_sn`,
  66. d.`create_time`,
  67. d.`moder_sn`,
  68. d.`mod_time`,
  69. d.`tstm`,t.third_party_merch_name thirdPartyMerchName,s.child_supplier_name childSupplierName
  70. from mk_dist_chnl d left join third_merchant_biz t on d.third_merch_sn = t.third_merch_sn
  71. left join mall_supplier s on d.supplier_id = s.id
  72. WHERE 1=1
  73. <if test="distFlag != null and distFlag.trim() != ''">
  74. AND d.dist_flag LIKE concat('%',#{distFlag},'%')
  75. </if>
  76. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  77. AND d.third_merch_sn = #{thirdMerchSn}
  78. </if>
  79. <if test="merchSn != null and merchSn != ''">
  80. AND t.merch_sn = #{merchSn}
  81. </if>
  82. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  83. AND t.third_party_merch_code = #{thirdPartyMerchCode}
  84. </if>
  85. <if test="storeId != null and storeId != ''">
  86. AND d.dist_chnl_id in (select dist_chnl_id from mk_dist_hier h left join mk_dist d
  87. on h.dist_id = d.dist_id left join mall_store s on d.store_id = s.id where s.id = #{storeId})
  88. </if>
  89. <choose>
  90. <when test="sidx != null and sidx.trim() != ''">
  91. order by ${sidx} ${order}
  92. </when>
  93. <otherwise>
  94. order by d.dist_chnl_id desc
  95. </otherwise>
  96. </choose>
  97. <if test="offset != null and limit != null">
  98. limit #{offset}, #{limit}
  99. </if>
  100. </select>
  101. <select id="queryTotal" resultType="int">
  102. select count(*) from mk_dist_chnl d left join third_merchant_biz t on d.third_merch_sn = t.third_merch_sn
  103. left join mall_supplier s on d.supplier_id = s.id
  104. WHERE 1=1
  105. <if test="distFlag != null and distFlag.trim() != ''">
  106. AND d.dist_flag LIKE concat('%',#{distFlag},'%')
  107. </if>
  108. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  109. AND d.third_merch_sn = #{thirdMerchSn}
  110. </if>
  111. <if test="merchSn != null and merchSn != ''">
  112. AND t.merch_sn = #{merchSn}
  113. </if>
  114. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  115. AND t.third_party_merch_code = #{thirdPartyMerchCode}
  116. </if>
  117. <if test="storeId != null and storeId != ''">
  118. AND d.dist_chnl_id in (select dist_chnl_id from mk_dist_hier h left join mk_dist d
  119. on h.dist_id = d.dist_id left join mall_store s on d.store_id = s.id where s.id = #{storeId})
  120. </if>
  121. </select>
  122. <insert id="save" parameterType="com.kmall.admin.entity.mk.dist.MkDistChnlEntity" useGeneratedKeys="true" keyProperty="distChnlId">
  123. insert into mk_dist_chnl(
  124. `dist_flag`,
  125. `part_type`,
  126. `third_merch_sn`,
  127. `supplier_id`,
  128. `sort_order`,
  129. `is_valid`,
  130. `note`,
  131. `creater_sn`,
  132. `create_time`,
  133. `moder_sn`,
  134. `mod_time`,
  135. `tstm`)
  136. values(
  137. #{distFlag},
  138. #{partType},
  139. #{thirdMerchSn},
  140. #{supplierId},
  141. #{sortOrder},
  142. #{isValid},
  143. #{note},
  144. #{createrSn},
  145. #{createTime},
  146. #{moderSn},
  147. #{modTime},
  148. #{tstm})
  149. </insert>
  150. <update id="update" parameterType="com.kmall.admin.entity.mk.dist.MkDistChnlEntity">
  151. update mk_dist_chnl
  152. <set>
  153. <if test="distFlag != null">`dist_flag` = #{distFlag}, </if>
  154. <if test="partType != null">`part_type` = #{partType}, </if>
  155. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  156. <if test="supplierId != null">`supplier_id` = #{supplierId}, </if>
  157. <if test="sortOrder != null">`sort_order` = #{sortOrder}, </if>
  158. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  159. <if test="note != null">`note` = #{note}, </if>
  160. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  161. <if test="createTime != null">`create_time` = #{createTime}, </if>
  162. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  163. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  164. <if test="tstm != null">`tstm` = #{tstm}</if>
  165. </set>
  166. where dist_chnl_id = #{distChnlId}
  167. </update>
  168. <delete id="delete">
  169. delete from mk_dist_chnl where dist_chnl_id = #{value}
  170. </delete>
  171. <delete id="deleteBatch">
  172. delete from mk_dist_chnl where dist_chnl_id in
  173. <foreach item="distChnlId" collection="array" open="(" separator="," close=")">
  174. #{distChnlId}
  175. </foreach>
  176. </delete>
  177. </mapper>