MkActivitiesDiscountDao.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.MkActivitiesDiscountDao">
  4. <resultMap type="com.kmall.admin.entity.MkActivitiesDiscountEntity" id="mkActivitiesDiscountMap">
  5. <result property="madId" column="mad_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="discount" column="discount"/>
  14. <result property="mkaId" column="mka_id"/>
  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.MkActivitiesDiscountEntity">
  21. select
  22. `mad_id`,
  23. `product_name`,
  24. `activity_price`,
  25. `shop_sn`,
  26. `goods_sn`,
  27. `barcode`,
  28. `product_brand`,
  29. `product_series`,
  30. `discount`,
  31. `mka_id`,
  32. `create_time`,
  33. `creater_sn`,
  34. `moder_sn`,
  35. `update_time`
  36. from mk_activities_discount
  37. where mad_id = #{id}
  38. </select>
  39. <select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesDiscountEntity">
  40. select
  41. `mad_id`,
  42. `product_name`,
  43. `activity_price`,
  44. `shop_sn`,
  45. `goods_sn`,
  46. `barcode`,
  47. `product_brand`,
  48. `product_series`,
  49. `discount`,
  50. `mka_id`,
  51. `create_time`,
  52. `creater_sn`,
  53. `moder_sn`,
  54. `update_time`
  55. from mk_activities_discount
  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 mad_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_discount
  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.MkActivitiesDiscountEntity" useGeneratedKeys="true" keyProperty="madId">
  92. insert into mk_activities_discount(
  93. `product_name`,
  94. `activity_price`,
  95. `shop_sn`,
  96. `goods_sn`,
  97. `barcode`,
  98. `product_brand`,
  99. `product_series`,
  100. `discount`,
  101. `mka_id`,
  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. #{discount},
  115. #{mkaId},
  116. #{createTime},
  117. #{createrSn},
  118. #{moderSn},
  119. #{updateTime})
  120. </insert>
  121. <update id="update" parameterType="com.kmall.admin.entity.MkActivitiesDiscountEntity">
  122. update mk_activities_discount
  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="discount != null">`discount` = #{discount}, </if>
  132. <if test="mkaId != null">`mka_id` = #{mkaId}, </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 mad_id = #{madId}
  139. </update>
  140. <delete id="delete">
  141. delete from mk_activities_discount where mad_id = #{value}
  142. </delete>
  143. <delete id="deleteBatch">
  144. delete from mk_activities_discount where mad_id in
  145. <foreach item="madId" collection="array" open="(" separator="," close=")">
  146. #{madId}
  147. </foreach>
  148. </delete>
  149. <select id="queryByBarCode" resultType="com.kmall.admin.entity.MkActivitiesDiscountEntity">
  150. select
  151. mad_id,
  152. product_name,
  153. activity_price,
  154. shop_sn,
  155. goods_sn,
  156. barcode,
  157. product_brand,
  158. product_series,
  159. discount,
  160. mka_id,
  161. create_time,
  162. creater_sn,
  163. moder_sn,
  164. update_time
  165. from mk_activities_discount
  166. where mka_id = #{mkaId}
  167. and barcode = #{prodBarcode}
  168. </select>
  169. </mapper>