Mall2LowPriceWarningDao.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.alarm.Mall2LowPriceWarningDao">
  4. <resultMap type="com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity" id="mall2LowPriceWarningMap">
  5. <result property="mlrwId" column="mlrw_id"/>
  6. <result property="salePrice" column="sale_price"/>
  7. <result property="warningPrice" column="warning_price"/>
  8. <result property="warningType" column="warning_type"/>
  9. <result property="sku" column="sku"/>
  10. <result property="storeId" column="store_id"/>
  11. <result property="activityId" column="activity_id"/>
  12. <result property="createrSn" column="creater_sn"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="moderSn" column="moder_sn"/>
  15. <result property="modTime" column="mod_time"/>
  16. <result property="tstm" column="tstm"/>
  17. <result property="viewed" column="viewed"/>
  18. </resultMap>
  19. <select id="queryObject" resultType="com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity">
  20. select
  21. `mlrw_id`,
  22. `sale_price`,
  23. `warning_price`,
  24. `warning_type`,
  25. `sku`,
  26. `store_id`,
  27. `activity_id`,
  28. `creater_sn`,
  29. `create_time`,
  30. `moder_sn`,
  31. `mod_time`,
  32. `tstm`,
  33. `viewed`
  34. from mall2_low_price_warning
  35. where mlrw_id = #{id}
  36. </select>
  37. <select id="queryList" resultType="com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity">
  38. select
  39. warning.mlrw_id,
  40. warning.sale_price,
  41. warning.warning_price,
  42. warning.warning_type,
  43. warning.sku,
  44. warning.store_id,
  45. warning.activity_id,
  46. warning.creater_sn,
  47. warning.create_time,
  48. warning.moder_sn,
  49. warning.mod_time,
  50. warning.tstm,
  51. warning.viewed,
  52. goods.name as goodsName,
  53. store.store_name as storeName,
  54. p.title as storeTopicName
  55. from mall2_low_price_warning warning
  56. left join mall_goods goods on goods.sku = warning.sku
  57. left join mall_store store on store.id = warning.store_id
  58. LEFT JOIN mall_store_topic p ON p.id = warning.activity_id
  59. WHERE 1=1
  60. <if test="name != null and name.trim() != ''">
  61. AND name LIKE concat('%',#{name},'%')
  62. </if>
  63. <choose>
  64. <when test="sidx != null and sidx.trim() != ''">
  65. order by ${sidx} ${order}
  66. </when>
  67. <otherwise>
  68. order by mlrw_id desc
  69. </otherwise>
  70. </choose>
  71. <if test="offset != null and limit != null">
  72. limit #{offset}, #{limit}
  73. </if>
  74. </select>
  75. <select id="queryTotal" resultType="int">
  76. select count(*) from mall2_low_price_warning
  77. WHERE 1=1
  78. <if test="name != null and name.trim() != ''">
  79. AND name LIKE concat('%',#{name},'%')
  80. </if>
  81. </select>
  82. <insert id="save" parameterType="com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity" useGeneratedKeys="true" keyProperty="mlrwId">
  83. insert into mall2_low_price_warning(
  84. `sale_price`,
  85. `warning_price`,
  86. `warning_type`,
  87. `sku`,
  88. `store_id`,
  89. `activity_id`,
  90. `creater_sn`,
  91. `create_time`,
  92. `moder_sn`,
  93. `mod_time`,
  94. `tstm`,
  95. `viewed`)
  96. values(
  97. #{salePrice},
  98. #{warningPrice},
  99. #{warningType},
  100. #{sku},
  101. #{storeId},
  102. #{activityId},
  103. #{createrSn},
  104. #{createTime},
  105. #{moderSn},
  106. #{modTime},
  107. #{tstm},
  108. #{viewed})
  109. </insert>
  110. <update id="update" parameterType="com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity">
  111. update mall2_low_price_warning
  112. <set>
  113. <if test="salePrice != null">`sale_price` = #{salePrice}, </if>
  114. <if test="warningPrice != null">`warning_price` = #{warningPrice}, </if>
  115. <if test="warningType != null">`warning_type` = #{warningType}, </if>
  116. <if test="sku != null">`sku` = #{sku}, </if>
  117. <if test="storeId != null">`store_id` = #{storeId}, </if>
  118. <if test="activityId != null">`activity_id` = #{activityId}, </if>
  119. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  120. <if test="createTime != null">`create_time` = #{createTime}, </if>
  121. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  122. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  123. <if test="tstm != null">`tstm` = #{tstm}, </if>
  124. <if test="viewed != null">`viewed` = #{viewed}</if>
  125. </set>
  126. where mlrw_id = #{mlrwId}
  127. </update>
  128. <delete id="delete">
  129. delete from mall2_low_price_warning where mlrw_id = #{value}
  130. </delete>
  131. <delete id="deleteBatch">
  132. delete from mall2_low_price_warning where mlrw_id in
  133. <foreach item="mlrwId" collection="array" open="(" separator="," close=")">
  134. #{mlrwId}
  135. </foreach>
  136. </delete>
  137. </mapper>