1
0

MkActivitiesFullReductionDao.xml 5.6 KB

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