1
0

MkStoreCampMinusDao.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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.MkStoreCampMinusDao">
  4. <resultMap type="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity" id="mkStoreCampMinusMap">
  5. <result property="campMinusId" column="camp_minus_id"/>
  6. <result property="campName" column="camp_name"/>
  7. <result property="thirdMerchSn" column="third_merch_sn"/>
  8. <result property="storeId" column="store_id"/>
  9. <result property="storeTopicId" column="store_topic_id"/>
  10. <result property="campBegTime" column="camp_beg_time"/>
  11. <result property="campEndTime" column="camp_end_time"/>
  12. <result property="campMinusType" column="camp_minus_type"/>
  13. <result property="minusMode" column="minus_mode"/>
  14. <result property="applyType" column="apply_type"/>
  15. <result property="advImgUrl" column="adv_img_url"/>
  16. <result property="advDesc" column="adv_desc"/>
  17. <result property="isValid" column="is_valid"/>
  18. <result property="isPast" column="is_past"/>
  19. <result property="isStoreShow" column="is_store_show"/>
  20. <result property="note" column="note"/>
  21. <result property="createrSn" column="creater_sn"/>
  22. <result property="createTime" column="create_time"/>
  23. <result property="moderSn" column="moder_sn"/>
  24. <result property="modTime" column="mod_time"/>
  25. <result property="tstm" column="tstm"/>
  26. <result property="goodsBizType" column="goods_biz_type"/>
  27. </resultMap>
  28. <select id="queryObject" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
  29. select
  30. `camp_minus_id`,
  31. `camp_name`,
  32. `third_merch_sn`,
  33. `store_id`,
  34. `store_topic_id`,
  35. `camp_beg_time`,
  36. `camp_end_time`,
  37. `camp_minus_type`,
  38. `minus_mode`,
  39. `apply_type`,
  40. `adv_img_url`,
  41. `adv_desc`,
  42. `is_valid`,
  43. `is_past`,
  44. `is_store_show`,
  45. `note`,
  46. `creater_sn`,
  47. `create_time`,
  48. `moder_sn`,
  49. `mod_time`,
  50. `tstm`,
  51. `goods_biz_type`
  52. from mk_store_camp_minus
  53. where camp_minus_id = #{id}
  54. </select>
  55. <select id="queryList" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
  56. SELECT
  57. s.store_name 'storeName',
  58. t.submit_order_num 'submitNum',
  59. t.browse_num 'browseNum',
  60. t.act_money 'actMoney',
  61. m.`camp_minus_id`,
  62. m.`camp_name`,
  63. m.`third_merch_sn`,
  64. m.`store_id`,
  65. m.`store_topic_id`,
  66. m.`camp_beg_time`,
  67. m.`camp_end_time`,
  68. m.`camp_minus_type`,
  69. m.`minus_mode`,
  70. m.`apply_type`,
  71. m.`adv_img_url`,
  72. m.`adv_desc`,
  73. m.`is_valid`,
  74. m.`is_past`,
  75. m.`is_store_show`,
  76. m.`note`,
  77. m.`creater_sn`,
  78. m.`create_time`,
  79. m.`moder_sn`,
  80. m.`mod_time`,
  81. m.`tstm`,
  82. m.`goods_biz_type`
  83. FROM
  84. mk_store_camp_minus m
  85. LEFT JOIN mall_store s ON m.store_id = s.id
  86. LEFT JOIN mk_store_topic_stat t ON t.store_topic_id = m.store_topic_id
  87. LEFT JOIN third_merchant_biz tb ON s.third_party_merch_code = tb.third_party_merch_code
  88. WHERE 1=1
  89. <if test="campName != null and campName.trim() != ''">
  90. AND m.camp_name LIKE concat('%',#{campName},'%')
  91. </if>
  92. <if test="isPast != null and isPast != ''">
  93. AND m.is_past = #{isPast}
  94. </if>
  95. <if test="storeId != null and storeId != ''">
  96. AND t.store_id = #{storeId}
  97. </if>
  98. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  99. AND s.third_merch_sn = #{thirdMerchSn}
  100. </if>
  101. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  102. AND tb.third_party_merch_code = #{thirdPartyMerchCode}
  103. </if>
  104. <choose>
  105. <when test="sidx != null and sidx.trim() != ''">
  106. order by ${sidx} ${order}
  107. </when>
  108. <otherwise>
  109. order by camp_minus_id desc
  110. </otherwise>
  111. </choose>
  112. <if test="offset != null and limit != null">
  113. limit #{offset}, #{limit}
  114. </if>
  115. </select>
  116. <select id="queryTotal" resultType="int">
  117. SELECT count(*)
  118. FROM
  119. mk_store_camp_minus m
  120. LEFT JOIN mall_store s ON m.store_id = s.id
  121. LEFT JOIN mk_store_topic_stat t ON t.store_topic_id = m.store_topic_id
  122. LEFT JOIN third_merchant_biz tb ON s.third_party_merch_code = tb.third_party_merch_code
  123. WHERE 1=1
  124. <if test="campName != null and campName.trim() != ''">
  125. AND m.camp_name LIKE concat('%',#{campName},'%')
  126. </if>
  127. <if test="isPast != null and isPast != ''">
  128. AND m.is_past = #{isPast}
  129. </if>
  130. <if test="storeId != null and storeId != ''">
  131. AND t.store_id = #{storeId}
  132. </if>
  133. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  134. AND s.third_merch_sn = #{thirdMerchSn}
  135. </if>
  136. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  137. AND tb.third_party_merch_code = #{thirdPartyMerchCode}
  138. </if>
  139. </select>
  140. <insert id="save" parameterType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity" useGeneratedKeys="true" keyProperty="campMinusId">
  141. insert into mk_store_camp_minus(
  142. `camp_name`,
  143. `third_merch_sn`,
  144. `store_id`,
  145. `store_topic_id`,
  146. `camp_beg_time`,
  147. `camp_end_time`,
  148. `camp_minus_type`,
  149. `minus_mode`,
  150. `apply_type`,
  151. `adv_img_url`,
  152. `adv_desc`,
  153. `is_valid`,
  154. `is_past`,
  155. `is_store_show`,
  156. `note`,
  157. `creater_sn`,
  158. `create_time`,
  159. `moder_sn`,
  160. `mod_time`,
  161. `tstm`,
  162. `goods_biz_type`)
  163. values(
  164. #{campName},
  165. #{thirdMerchSn},
  166. #{storeId},
  167. #{storeTopicId},
  168. #{campBegTime},
  169. #{campEndTime},
  170. #{campMinusType},
  171. #{minusMode},
  172. #{applyType},
  173. #{advImgUrl},
  174. #{advDesc},
  175. #{isValid},
  176. #{isPast},
  177. #{isStoreShow},
  178. #{note},
  179. #{createrSn},
  180. #{createTime},
  181. #{moderSn},
  182. #{modTime},
  183. #{tstm},
  184. #{goodsBizType})
  185. </insert>
  186. <update id="update" parameterType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
  187. update mk_store_camp_minus
  188. <set>
  189. <if test="campName != null">`camp_name` = #{campName}, </if>
  190. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  191. <if test="storeId != null">`store_id` = #{storeId}, </if>
  192. <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId}, </if>
  193. <if test="campBegTime != null">`camp_beg_time` = #{campBegTime}, </if>
  194. <if test="campEndTime != null">`camp_end_time` = #{campEndTime}, </if>
  195. <if test="campMinusType != null">`camp_minus_type` = #{campMinusType}, </if>
  196. <if test="minusMode != null">`minus_mode` = #{minusMode}, </if>
  197. <if test="applyType != null">`apply_type` = #{applyType}, </if>
  198. <if test="advImgUrl != null">`adv_img_url` = #{advImgUrl}, </if>
  199. <if test="advDesc != null">`adv_desc` = #{advDesc}, </if>
  200. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  201. <if test="isPast != null">`is_past` = #{isPast}, </if>
  202. <if test="isStoreShow != null">`is_store_show` = #{isStoreShow}, </if>
  203. <if test="note != null">`note` = #{note}, </if>
  204. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  205. <if test="createTime != null">`create_time` = #{createTime}, </if>
  206. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  207. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  208. <if test="tstm != null">`tstm` = #{tstm}, </if>
  209. <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType}</if>
  210. </set>
  211. where camp_minus_id = #{campMinusId}
  212. </update>
  213. <delete id="delete">
  214. delete from mk_store_camp_minus where camp_minus_id = #{value}
  215. </delete>
  216. <delete id="deleteBatch">
  217. delete from mk_store_camp_minus where camp_minus_id in
  218. <foreach item="campMinusId" collection="array" open="(" separator="," close=")">
  219. #{campMinusId}
  220. </foreach>
  221. </delete>
  222. <select id="queryByGoodsId" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusLevelEntity">
  223. select distinct
  224. mscml.camp_minus_level_id,
  225. mscml.camp_minus_type,
  226. mscml.camp_minus_id,
  227. mscml.minus_mode,
  228. mscml.yuan_minus_cond,
  229. mscml.yuan_minus_pref,
  230. mscml.piece_minus_conf,
  231. mscml.piece_minus_pref,
  232. mscml.piece_minus_each_disc,
  233. mscml.yuan_disc_cond,
  234. mscml.yuan_disc_pref,
  235. mscml.piece_disc_conf,
  236. mscml.piece_disc_pref,
  237. mscml.is_valid,
  238. mscml.note,
  239. mscml.creater_sn,
  240. mscml.create_time,
  241. mscml.moder_sn,
  242. mscml.mod_time,
  243. mscml.tstm
  244. from mk_store_camp_minus mscm
  245. left join mk_store_camp_minus_goods mscmg on mscmg.camp_minus_id = mscm.camp_minus_id
  246. left join mk_store_camp_minus_level mscml on mscml.camp_minus_id = mscm.camp_minus_id
  247. and mscmg.camp_minus_id = mscml.camp_minus_id
  248. left join mall_product_store_rela rela on mscmg.store_rela_id = rela.id
  249. where rela.goods_id = #{goodsId} and mscm.camp_beg_time &lt; now() and mscm.camp_end_time &gt; now() and mscm.apply_type != '02'
  250. </select>
  251. <select id="queryByStoreId" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
  252. select
  253. camp_minus_id,
  254. camp_name,
  255. third_merch_sn,
  256. store_id,
  257. store_topic_id,
  258. camp_beg_time,
  259. camp_end_time,
  260. camp_minus_type,
  261. minus_mode,
  262. apply_type,
  263. adv_img_url,
  264. adv_desc,
  265. is_valid,
  266. is_past,
  267. is_store_show,
  268. note,
  269. creater_sn,
  270. create_time,
  271. moder_sn,
  272. mod_time,
  273. tstm,
  274. goods_biz_type
  275. from mk_store_camp_minus mscm
  276. where mscm.store_id = #{storeId}
  277. </select>
  278. </mapper>