MkActivitiesHalfPriceDao.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.MkActivitiesHalfPriceDao">
  4. <resultMap type="com.kmall.admin.entity.MkActivitiesHalfPriceEntity" id="mkActivitiesHalfPriceMap">
  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.MkActivitiesHalfPriceEntity">
  22. select
  23. m.mafr_id,
  24. goods.name as productName,
  25. m.shop_sn,
  26. m.goods_sn,
  27. m.barcode,
  28. m.product_brand,
  29. m.product_series,
  30. m.qualified_amount,
  31. m.deduction_amount,
  32. m.mka_id,
  33. m.deadline,
  34. m.create_time,
  35. m.creater_sn,
  36. m.moder_sn,
  37. m.update_time
  38. from mk_activities_full_reduction m ,
  39. mall_goods goods
  40. where m.mafr_id = #{id}
  41. </select>
  42. <select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
  43. select
  44. m.mafr_id,
  45. goods.name as productName,
  46. m.shop_sn,
  47. m.goods_sn,
  48. m.barcode,
  49. m.product_brand,
  50. m.product_series,
  51. m.qualified_amount,
  52. m.deduction_amount,
  53. m.mka_id,
  54. m.deadline,
  55. m.create_time,
  56. m.creater_sn,
  57. m.moder_sn,
  58. m.update_time
  59. from mk_activities_full_reduction m ,
  60. mall_goods goods
  61. WHERE 1=1 and
  62. m.goods_sn = goods.goods_sn
  63. <if test="name != null and name.trim() != ''">
  64. AND m.barcode LIKE concat('%',#{name},'%')
  65. </if>
  66. <if test="storeId != null and storeId.trim() != ''">
  67. AND m.shop_sn = #{storeId}
  68. </if>
  69. <if test="mkaId != null">
  70. AND m.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 m.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_reduction m ,
  86. mall_goods goods
  87. WHERE 1=1 and
  88. m.goods_sn = goods.goods_sn
  89. <if test="name != null and name.trim() != ''">
  90. AND m.barcode LIKE concat('%',#{name},'%')
  91. </if>
  92. <if test="storeId != null and storeId.trim() != ''">
  93. AND m.shop_sn = #{storeId}
  94. </if>
  95. <if test="mkaId != null">
  96. AND m.mka_id = #{mkaId}
  97. </if>
  98. </select>
  99. <insert id="save" parameterType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity" useGeneratedKeys="true" keyProperty="mafrId">
  100. insert into mk_activities_full_reduction(
  101. product_name,
  102. shop_sn,
  103. goods_sn,
  104. barcode,
  105. product_brand,
  106. product_series,
  107. qualified_amount,
  108. deduction_amount,
  109. mka_id,
  110. deadline,
  111. create_time,
  112. creater_sn,
  113. moder_sn,
  114. update_time)
  115. values(
  116. #{productName},
  117. #{shopSn},
  118. #{goodsSn},
  119. #{barcode},
  120. #{productBrand},
  121. #{productSeries},
  122. #{qualifiedAmount},
  123. #{deductionAmount},
  124. #{mkaId},
  125. #{deadline},
  126. #{createTime},
  127. #{createrSn},
  128. #{moderSn},
  129. #{updateTime})
  130. </insert>
  131. <update id="update" parameterType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
  132. update mk_activities_full_reduction
  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="deductionAmount != null">deduction_amount = #{deductionAmount}, </if>
  142. <if test="mkaId != null">mka_id = #{mkaId}, </if>
  143. <if test="deadline != null">deadline = #{deadline}, </if>
  144. <if test="createTime != null">create_time = #{createTime}, </if>
  145. <if test="createrSn != null">creater_sn = #{createrSn}, </if>
  146. <if test="moderSn != null">moder_sn = #{moderSn}, </if>
  147. <if test="updateTime != null">update_time = #{updateTime}</if>
  148. </set>
  149. where mafr_id = #{mafrId}
  150. </update>
  151. <delete id="delete">
  152. delete from mk_activities_full_reduction where mafr_id = #{value}
  153. </delete>
  154. <delete id="deleteBatch">
  155. delete from mk_activities_full_reduction where mafr_id in
  156. <foreach item="mafrId" collection="array" open="(" separator="," close=")">
  157. #{mafrId}
  158. </foreach>
  159. </delete>
  160. <select id="queryByCodeOrBrand" resultType="com.kmall.admin.entity.MkActivitiesHalfPriceEntity">
  161. select
  162. mafr_id,
  163. product_name,
  164. shop_sn,
  165. goods_sn,
  166. barcode,
  167. product_brand,
  168. product_series,
  169. qualified_amount,
  170. deduction_amount,
  171. mka_id,
  172. deadline,
  173. create_time,
  174. creater_sn,
  175. moder_sn,
  176. update_time
  177. from mk_activities_full_reduction
  178. where
  179. mka_id = #{mkaId}
  180. and barcode = #{prodBarcode}
  181. limit 1
  182. </select>
  183. </mapper>