MkActivitiesPromotionDao.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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.MkActivitiesPromotionDao">
  4. <resultMap type="com.kmall.admin.entity.MkActivitiesPromotionEntity" id="mkActivitiesPromotionMap">
  5. <result property="mapId" column="map_id"/>
  6. <result property="productName" column="product_name"/>
  7. <result property="activityPrice" column="activity_price"/>
  8. <result property="shopSn" column="shop_sn"/>
  9. <result property="goodsSn" column="goods_sn"/>
  10. <result property="barcode" column="barcode"/>
  11. <result property="productBrand" column="product_brand"/>
  12. <result property="productSeries" column="product_series"/>
  13. <result property="mkaId" column="mka_id"/>
  14. <result property="deadline" column="deadline"/>
  15. <result property="createTime" column="create_time"/>
  16. <result property="createrSn" column="creater_sn"/>
  17. <result property="moderSn" column="moder_sn"/>
  18. <result property="updateTime" column="update_time"/>
  19. </resultMap>
  20. <select id="queryObject" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
  21. select
  22. `map_id`,
  23. `product_name`,
  24. `activity_price`,
  25. `shop_sn`,
  26. `goods_sn`,
  27. `barcode`,
  28. `product_brand`,
  29. `product_series`,
  30. `mka_id`,
  31. `deadline`,
  32. `create_time`,
  33. `creater_sn`,
  34. `moder_sn`,
  35. `update_time`
  36. from mk_activities_promotion
  37. where map_id = #{id}
  38. </select>
  39. <select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
  40. select
  41. `map_id`,
  42. `product_name`,
  43. `activity_price`,
  44. `shop_sn`,
  45. `goods_sn`,
  46. `barcode`,
  47. `product_brand`,
  48. `product_series`,
  49. `mka_id`,
  50. `deadline`,
  51. `create_time`,
  52. `creater_sn`,
  53. `moder_sn`,
  54. `update_time`
  55. from mk_activities_promotion
  56. WHERE 1=1
  57. <if test="name != null and name.trim() != ''">
  58. AND barcode LIKE concat('%',#{name},'%')
  59. </if>
  60. <if test="storeId != null and storeId.trim() != ''">
  61. AND shop_sn = #{storeId}
  62. </if>
  63. <if test="mkaId != null">
  64. AND mka_id = #{mkaId}
  65. </if>
  66. <choose>
  67. <when test="sidx != null and sidx.trim() != ''">
  68. order by ${sidx} ${order}
  69. </when>
  70. <otherwise>
  71. order by map_id desc
  72. </otherwise>
  73. </choose>
  74. <if test="offset != null and limit != null">
  75. limit #{offset}, #{limit}
  76. </if>
  77. </select>
  78. <select id="queryTotal" resultType="int">
  79. select count(*) from mk_activities_promotion
  80. WHERE 1=1
  81. <if test="name != null and name.trim() != ''">
  82. AND barcode LIKE concat('%',#{name},'%')
  83. </if>
  84. <if test="storeId != null and storeId.trim() != ''">
  85. AND shop_sn = #{storeId}
  86. </if>
  87. <if test="mkaId != null">
  88. AND mka_id = #{mkaId}
  89. </if>
  90. </select>
  91. <insert id="save" parameterType="com.kmall.admin.entity.MkActivitiesPromotionEntity" useGeneratedKeys="true" keyProperty="mapId">
  92. insert into mk_activities_promotion(
  93. `product_name`,
  94. `activity_price`,
  95. `shop_sn`,
  96. `goods_sn`,
  97. `barcode`,
  98. `product_brand`,
  99. `product_series`,
  100. `mka_id`,
  101. `deadline`,
  102. `create_time`,
  103. `creater_sn`,
  104. `moder_sn`,
  105. `update_time`)
  106. values(
  107. #{productName},
  108. #{activityPrice},
  109. #{shopSn},
  110. #{goodsSn},
  111. #{barcode},
  112. #{productBrand},
  113. #{productSeries},
  114. #{mkaId},
  115. #{deadline},
  116. #{createTime},
  117. #{createrSn},
  118. #{moderSn},
  119. #{updateTime})
  120. </insert>
  121. <update id="update" parameterType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
  122. update mk_activities_promotion
  123. <set>
  124. <if test="productName != null">`product_name` = #{productName}, </if>
  125. <if test="activityPrice != null">`activity_price` = #{activityPrice}, </if>
  126. <if test="shopSn != null">`shop_sn` = #{shopSn}, </if>
  127. <if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
  128. <if test="barcode != null">`barcode` = #{barcode}, </if>
  129. <if test="productBrand != null">`product_brand` = #{productBrand}, </if>
  130. <if test="productSeries != null">`product_series` = #{productSeries}, </if>
  131. <if test="mkaId != null">`mka_id` = #{mkaId}, </if>
  132. <if test="deadline != null">`deadline` = #{deadline}, </if>
  133. <if test="createTime != null">`create_time` = #{createTime}, </if>
  134. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  135. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  136. <if test="updateTime != null">`update_time` = #{updateTime}</if>
  137. </set>
  138. where map_id = #{mapId}
  139. </update>
  140. <delete id="delete">
  141. delete from mk_activities_promotion where map_id = #{value}
  142. </delete>
  143. <delete id="deleteBatch">
  144. delete from mk_activities_promotion where map_id in
  145. <foreach item="mapId" collection="array" open="(" separator="," close=")">
  146. #{mapId}
  147. </foreach>
  148. </delete>
  149. <select id="queryByBarCode" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
  150. select
  151. `map_id`,
  152. `product_name`,
  153. `activity_price`,
  154. `shop_sn`,
  155. `goods_sn`,
  156. `barcode`,
  157. `product_brand`,
  158. `product_series`,
  159. `mka_id`,
  160. `deadline`,
  161. `create_time`,
  162. `creater_sn`,
  163. `moder_sn`,
  164. `update_time`
  165. from mk_activities_promotion
  166. where mka_id in (${mkaId})
  167. and barcode = #{prodBarcode}
  168. </select>
  169. <select id="queryByDateAndBarcode" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
  170. select
  171. pro.map_id,
  172. pro.product_name,
  173. pro.activity_price,
  174. pro.shop_sn,
  175. pro.goods_sn,
  176. pro.barcode,
  177. pro.product_brand,
  178. pro.product_series,
  179. pro.mka_id,
  180. pro.deadline,
  181. pro.create_time,
  182. pro.creater_sn,
  183. pro.moder_sn,
  184. pro.update_time
  185. from mk_activities_promotion pro,
  186. mk_activities activity
  187. where pro.mka_id = activity.mka_id
  188. and pro.barcode = #{prodBarcode}
  189. and activity.mka_start_time &lt; #{currentTime}
  190. and activity.mkd_end_time &gt; #{currentTime}
  191. and activity.mka_topic = #{topic}
  192. and activity.mka_status = 1
  193. and activity.mka_store_id = #{storeId}
  194. </select>
  195. <update id="updatePriceBySku" >
  196. update mk_activities_promotion set activity_price = #{updatePrice} where goods_sn = #{sku}
  197. and mka_id = #{mkaId}
  198. </update>
  199. </mapper>