Mk2GoodsTopicPriceDao.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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.mk.Mk2GoodsTopicPriceDao">
  4. <resultMap type="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity" id="mk2GoodsTopicPriceMap">
  5. <result property="mgthpId" column="mgthp_id"/>
  6. <result property="topicId" column="topic_id"/>
  7. <result property="topicType" column="topic_type"/>
  8. <result property="topicPrice" column="topic_price"/>
  9. <result property="topicName" column="topic_name"/>
  10. <result property="topicContent" column="topic_content"/>
  11. <result property="topicGoodsSku" column="topic_goods_sku"/>
  12. <result property="topicBeginTime" column="topic_begin_time"/>
  13. <result property="topicEndTime" column="topic_end_time"/>
  14. <result property="importTime" column="import_time"/>
  15. <result property="createrSn" column="creater_sn"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="moderSn" column="moder_sn"/>
  18. <result property="modTime" column="mod_time"/>
  19. <result property="tstm" column="tstm"/>
  20. </resultMap>
  21. <select id="queryObject" resultType="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity">
  22. select
  23. `mgthp_id`,
  24. `topic_id`,
  25. `topic_type`,
  26. `topic_price`,
  27. `topic_name`,
  28. `topic_content`,
  29. `topic_goods_sku`,
  30. `topic_begin_time`,
  31. `topic_end_time`,
  32. `import_time`,
  33. `creater_sn`,
  34. `create_time`,
  35. `moder_sn`,
  36. `mod_time`,
  37. `tstm`
  38. from mk2_goods_topic_price
  39. where mgthp_id = #{id}
  40. </select>
  41. <select id="queryList" resultType="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity">
  42. select
  43. mk2.mgthp_id,
  44. mk2.topic_id,
  45. mk2.topic_type,
  46. mk2.topic_price,
  47. mk2.topic_name,
  48. mk2.topic_content,
  49. mk2.topic_goods_sku,
  50. mk2.topic_begin_time,
  51. mk2.topic_end_time,
  52. mk2.import_time,
  53. mk2.creater_sn,
  54. mk2.create_time,
  55. mk2.moder_sn,
  56. mk2.mod_time,
  57. mk2.tstm,
  58. goods.name as goodsName
  59. from mk2_goods_topic_price mk2
  60. left join mall_goods goods on mk2.topic_goods_sku = goods.sku
  61. WHERE 1=1
  62. <if test=" topicName != null and topicName.trim() != ''">
  63. AND mk2.topic_name LIKE concat('%',#{topicName},'%')
  64. </if>
  65. <choose>
  66. <when test="sidx != null and sidx.trim() != ''">
  67. order by ${sidx} ${order}
  68. </when>
  69. <otherwise>
  70. order by mgthp_id desc
  71. </otherwise>
  72. </choose>
  73. <if test="offset != null and limit != null">
  74. limit #{offset}, #{limit}
  75. </if>
  76. </select>
  77. <select id="queryTotal" resultType="int">
  78. select count(*) from mk2_goods_topic_price
  79. WHERE 1=1
  80. <if test=" topicName != null and topicName.trim() != ''">
  81. AND topic_name LIKE concat('%',#{topicName},'%')
  82. </if>
  83. </select>
  84. <insert id="save" parameterType="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity" useGeneratedKeys="true" keyProperty="id">
  85. insert into mk2_goods_topic_price(
  86. `mgthp_id`,
  87. `topic_id`,
  88. `topic_type`,
  89. `topic_price`,
  90. `topic_name`,
  91. `topic_content`,
  92. `topic_goods_sku`,
  93. `topic_begin_time`,
  94. `topic_end_time`,
  95. `import_time`,
  96. `creater_sn`,
  97. `create_time`,
  98. `moder_sn`,
  99. `mod_time`,
  100. `tstm`)
  101. values(
  102. #{mgthpId},
  103. #{topicId},
  104. #{topicType},
  105. #{topicPrice},
  106. #{topicName},
  107. #{topicContent},
  108. #{topicGoodsSku},
  109. #{topicBeginTime},
  110. #{topicEndTime},
  111. #{importTime},
  112. #{createrSn},
  113. #{createTime},
  114. #{moderSn},
  115. #{modTime},
  116. #{tstm})
  117. </insert>
  118. <update id="update" parameterType="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity">
  119. update mk2_goods_topic_price
  120. <set>
  121. <if test="topicId != null">`topic_id` = #{topicId}, </if>
  122. <if test="topicType != null">`topic_type` = #{topicType}, </if>
  123. <if test="topicPrice != null">`topic_price` = #{topicPrice}, </if>
  124. <if test="topicName != null">`topic_name` = #{topicName}, </if>
  125. <if test="topicContent != null">`topic_content` = #{topicContent}, </if>
  126. <if test="topicGoodsSku != null">`topic_goods_sku` = #{topicGoodsSku}, </if>
  127. <if test="topicBeginTime != null">`topic_begin_time` = #{topicBeginTime}, </if>
  128. <if test="topicEndTime != null">`topic_end_time` = #{topicEndTime}, </if>
  129. <if test="importTime != null">`import_time` = #{importTime}, </if>
  130. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  131. <if test="createTime != null">`create_time` = #{createTime}, </if>
  132. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  133. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  134. <if test="tstm != null">`tstm` = #{tstm}</if>
  135. </set>
  136. where mgthp_id = #{mgthpId}
  137. </update>
  138. <delete id="delete">
  139. delete from mk2_goods_topic_price where mgthp_id = #{value}
  140. </delete>
  141. <delete id="deleteBatch">
  142. delete from mk2_goods_topic_price where mgthp_id in
  143. <foreach item="mgthpId" collection="array" open="(" separator="," close=")">
  144. #{mgthpId}
  145. </foreach>
  146. </delete>
  147. <select id="queryByTopicIdAndGoodsId" resultType="com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity">
  148. select
  149. `mgthp_id`,
  150. `topic_id`,
  151. `topic_type`,
  152. `topic_price`,
  153. `topic_name`,
  154. `topic_content`,
  155. `topic_goods_sku`,
  156. `topic_begin_time`,
  157. `topic_end_time`,
  158. `import_time`,
  159. `creater_sn`,
  160. `create_time`,
  161. `moder_sn`,
  162. `mod_time`,
  163. `tstm`
  164. from mk2_goods_topic_price
  165. where topic_id = #{mgthpId} and topic_goods_sku = #{sku}
  166. </select>
  167. <insert id="saveBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  168. insert into mk2_goods_topic_price(
  169. `mgthp_id`,
  170. `topic_id`,
  171. `topic_type`,
  172. `topic_price`,
  173. `topic_name`,
  174. `topic_content`,
  175. `topic_goods_sku`,
  176. `topic_begin_time`,
  177. `topic_end_time`,
  178. `import_time`,
  179. `creater_sn`,
  180. `create_time`,
  181. `moder_sn`,
  182. `mod_time`,
  183. `tstm`)
  184. values
  185. <foreach collection="list" index="index" item="item" separator=",">
  186. (
  187. #{item.mgthpId},
  188. #{item.topicId},
  189. #{item.topicType},
  190. #{item.topicPrice},
  191. #{item.topicName},
  192. #{item.topicContent},
  193. #{item.topicGoodsSku},
  194. #{item.topicBeginTime},
  195. #{item.topicEndTime},
  196. #{item.importTime},
  197. #{item.createrSn},
  198. #{item.createTime},
  199. #{item.moderSn},
  200. #{item.modTime},
  201. #{item.tstm}
  202. )
  203. </foreach>
  204. </insert>
  205. </mapper>