1
0

MkStorePromChnlDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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.store.MkStorePromChnlDao">
  4. <resultMap type="com.kmall.admin.entity.mk.store.MkStorePromChnlEntity" id="mkStorePromChnlMap">
  5. <result property="promChnlId" column="prom_chnl_id"/>
  6. <result property="promChnName" column="prom_chn_name"/>
  7. <result property="storeId" column="store_id"/>
  8. <result property="isValid" column="is_valid"/>
  9. <result property="note" column="note"/>
  10. <result property="createrSn" column="creater_sn"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="moderSn" column="moder_sn"/>
  13. <result property="modTime" column="mod_time"/>
  14. <result property="tstm" column="tstm"/>
  15. </resultMap>
  16. <select id="queryObject" resultType="com.kmall.admin.entity.mk.store.MkStorePromChnlEntity">
  17. select
  18. `prom_chnl_id`,
  19. `prom_chn_name`,
  20. `store_id`,
  21. `is_valid`,
  22. `note`,
  23. `creater_sn`,
  24. `create_time`,
  25. `moder_sn`,
  26. `mod_time`,
  27. `tstm`
  28. from mk_store_prom_chnl
  29. where prom_chnl_id = #{id}
  30. </select>
  31. <select id="queryList" resultType="com.kmall.admin.entity.mk.store.MkStorePromChnlEntity">
  32. select
  33. d.`prom_chnl_id`,
  34. d.`prom_chn_name`,
  35. d.`store_id`,
  36. d.`is_valid`,
  37. d.`note`,
  38. d.`creater_sn`,
  39. d.`create_time`,
  40. d.`moder_sn`,
  41. d.`mod_time`,
  42. d.`tstm`
  43. from mk_store_prom_chnl d left join mall_store s on d.store_id = s.id
  44. left join third_merchant_biz t on s.third_party_merch_code = t.third_party_merch_code
  45. WHERE 1=1
  46. <if test="name != null and name.trim() != ''">
  47. AND prom_chn_name LIKE concat('%',#{name},'%')
  48. </if>
  49. <if test="storeId != null and storeId != ''">
  50. and d.store_id = #{storeId}
  51. </if>
  52. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  53. and t.third_merch_sn = #{thirdMerchSn}
  54. </if>
  55. <if test="merchSn != null and merchSn != ''">
  56. and t.merch_sn = #{merchSn}
  57. </if>
  58. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  59. AND t.third_party_merch_code = #{thirdPartyMerchCode}
  60. </if>
  61. <choose>
  62. <when test="sidx != null and sidx.trim() != ''">
  63. order by ${sidx} ${order}
  64. </when>
  65. <otherwise>
  66. order by d.prom_chnl_id desc
  67. </otherwise>
  68. </choose>
  69. <if test="offset != null and limit != null">
  70. limit #{offset}, #{limit}
  71. </if>
  72. </select>
  73. <select id="queryTotal" resultType="int">
  74. select count(*)
  75. from mk_store_prom_chnl d left join mall_store s on d.store_id = s.id
  76. left join third_merchant_biz t on s.third_merch_sn = t.third_merch_sn
  77. WHERE 1=1
  78. <if test="name != null and name.trim() != ''">
  79. AND prom_chn_name LIKE concat('%',#{name},'%')
  80. </if>
  81. <if test="storeId != null and storeId != ''">
  82. and d.store_id = #{storeId}
  83. </if>
  84. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  85. and t.third_merch_sn = #{thirdMerchSn}
  86. </if>
  87. <if test="merchSn != null and merchSn != ''">
  88. and t.merch_sn = #{merchSn}
  89. </if>
  90. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  91. AND t.third_party_merch_code = #{thirdPartyMerchCode}
  92. </if>
  93. </select>
  94. <insert id="save" parameterType="com.kmall.admin.entity.mk.store.MkStorePromChnlEntity">
  95. insert into mk_store_prom_chnl(
  96. `prom_chnl_id`,
  97. `prom_chn_name`,
  98. `store_id`,
  99. `is_valid`,
  100. `note`,
  101. `creater_sn`,
  102. `create_time`,
  103. `moder_sn`,
  104. `mod_time`,
  105. `tstm`)
  106. values(
  107. #{promChnlId},
  108. #{promChnName},
  109. #{storeId},
  110. #{isValid},
  111. #{note},
  112. #{createrSn},
  113. #{createTime},
  114. #{moderSn},
  115. #{modTime},
  116. #{tstm})
  117. </insert>
  118. <update id="update" parameterType="com.kmall.admin.entity.mk.store.MkStorePromChnlEntity">
  119. update mk_store_prom_chnl
  120. <set>
  121. <if test="promChnName != null">`prom_chn_name` = #{promChnName}, </if>
  122. <if test="storeId != null">`store_id` = #{storeId}, </if>
  123. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  124. <if test="note != null">`note` = #{note}, </if>
  125. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  126. <if test="createTime != null">`create_time` = #{createTime}, </if>
  127. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  128. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  129. <if test="tstm != null">`tstm` = #{tstm}</if>
  130. </set>
  131. where prom_chnl_id = #{promChnlId}
  132. </update>
  133. <delete id="delete">
  134. delete from mk_store_prom_chnl where prom_chnl_id = #{value}
  135. </delete>
  136. <delete id="deleteBatch">
  137. delete from mk_store_prom_chnl where prom_chnl_id in
  138. <foreach item="promChnlId" collection="array" open="(" separator="," close=")">
  139. #{promChnlId}
  140. </foreach>
  141. </delete>
  142. </mapper>