1
0

MkActivitiesFullGiftDao.xml 5.6 KB

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