TopicDao.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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.TopicDao">
  4. <resultMap type="com.kmall.admin.entity.TopicEntity" id="topicMap">
  5. <result property="id" column="id"/>
  6. <result property="title" column="title"/>
  7. <result property="content" column="content"/>
  8. <result property="itemPicUrl" column="item_pic_url"/>
  9. <result property="subtitle" column="subtitle"/>
  10. <result property="promTypeId" column="prom_type_id"/>
  11. <result property="priceInfo" column="price_info"/>
  12. <result property="readCount" column="read_count"/>
  13. <result property="scenePicUrl" column="scene_pic_url"/>
  14. <result property="topicTemplateId" column="topic_template_id"/>
  15. <result property="topicTagId" column="topic_tag_id"/>
  16. <result property="storeId" column="store_id"/>
  17. <result property="thirdMerchSn" column="third_merch_sn"/>
  18. <result property="isValid" column="is_valid"/>
  19. <result property="note" column="note"/>
  20. <result property="createrSn" column="creater_sn"/>
  21. <result property="createTime" column="create_time"/>
  22. <result property="moderSn" column="moder_sn"/>
  23. <result property="modTime" column="mod_time"/>
  24. <result property="tstm" column="tstm"/>
  25. </resultMap>
  26. <select id="queryObject" resultType="com.kmall.admin.entity.TopicEntity">
  27. select
  28. `id`,
  29. `title`,
  30. `content`,
  31. `item_pic_url`,
  32. `subtitle`,
  33. `prom_type_id`,
  34. `price_info`,
  35. `read_count`,
  36. `scene_pic_url`,
  37. `topic_template_id`,
  38. `topic_tag_id`,
  39. `store_id`,
  40. `third_merch_sn`,
  41. `is_valid`,
  42. `note`,
  43. `creater_sn`,
  44. `create_time`,
  45. `moder_sn`,
  46. `mod_time`,
  47. `tstm`
  48. from mall_topic
  49. where id = #{id}
  50. </select>
  51. <select id="queryList" resultType="com.kmall.admin.entity.TopicEntity">
  52. select
  53. `id`,
  54. `title`,
  55. `content`,
  56. `item_pic_url`,
  57. `subtitle`,
  58. `prom_type_id`,
  59. `price_info`,
  60. `read_count`,
  61. `scene_pic_url`,
  62. `topic_template_id`,
  63. `topic_tag_id`,
  64. `store_id`,
  65. `third_merch_sn`,
  66. `is_valid`,
  67. `note`,
  68. `creater_sn`,
  69. `create_time`,
  70. `moder_sn`,
  71. `mod_time`,
  72. `tstm`
  73. from mall_topic
  74. WHERE 1=1
  75. <if test="name != null and name.trim() != ''">
  76. AND name LIKE concat('%',#{name},'%')
  77. </if>
  78. <choose>
  79. <when test="sidx != null and sidx.trim() != ''">
  80. order by ${sidx} ${order}
  81. </when>
  82. <otherwise>
  83. order by id desc
  84. </otherwise>
  85. </choose>
  86. <if test="offset != null and limit != null">
  87. limit #{offset}, #{limit}
  88. </if>
  89. </select>
  90. <select id="queryTotal" resultType="int">
  91. select count(*) from mall_topic
  92. WHERE 1=1
  93. <if test="name != null and name.trim() != ''">
  94. AND name LIKE concat('%',#{name},'%')
  95. </if>
  96. </select>
  97. <insert id="save" parameterType="com.kmall.admin.entity.TopicEntity" useGeneratedKeys="true" keyProperty="id">
  98. insert into mall_topic(
  99. `title`,
  100. `content`,
  101. `item_pic_url`,
  102. `subtitle`,
  103. `prom_type_id`,
  104. `price_info`,
  105. `read_count`,
  106. `scene_pic_url`,
  107. `topic_template_id`,
  108. `topic_tag_id`,
  109. `store_id`,
  110. `third_merch_sn`,
  111. `is_valid`,
  112. `note`,
  113. `creater_sn`,
  114. `create_time`,
  115. `moder_sn`,
  116. `mod_time`,
  117. `tstm`)
  118. values(
  119. #{title},
  120. #{content},
  121. #{itemPicUrl},
  122. #{subtitle},
  123. #{promTypeId},
  124. #{priceInfo},
  125. #{readCount},
  126. #{scenePicUrl},
  127. #{topicTemplateId},
  128. #{topicTagId},
  129. #{storeId},
  130. #{thirdMerchSn},
  131. #{isValid},
  132. #{note},
  133. #{createrSn},
  134. #{createTime},
  135. #{moderSn},
  136. #{modTime},
  137. #{tstm})
  138. </insert>
  139. <update id="update" parameterType="com.kmall.admin.entity.TopicEntity">
  140. update mall_topic
  141. <set>
  142. <if test="title != null">`title` = #{title}, </if>
  143. <if test="content != null">`content` = #{content}, </if>
  144. <if test="itemPicUrl != null">`item_pic_url` = #{itemPicUrl}, </if>
  145. <if test="subtitle != null">`subtitle` = #{subtitle}, </if>
  146. <if test="promTypeId != null">`prom_type_id` = #{promTypeId}, </if>
  147. <if test="priceInfo != null">`price_info` = #{priceInfo}, </if>
  148. <if test="readCount != null">`read_count` = #{readCount}, </if>
  149. <if test="scenePicUrl != null">`scene_pic_url` = #{scenePicUrl}, </if>
  150. <if test="topicTemplateId != null">`topic_template_id` = #{topicTemplateId}, </if>
  151. <if test="topicTagId != null">`topic_tag_id` = #{topicTagId}, </if>
  152. <if test="storeId != null">`store_id` = #{storeId}, </if>
  153. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  154. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  155. <if test="note != null">`note` = #{note}, </if>
  156. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  157. <if test="createTime != null">`create_time` = #{createTime}, </if>
  158. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  159. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  160. <if test="tstm != null">`tstm` = #{tstm}</if>
  161. </set>
  162. where id = #{id}
  163. </update>
  164. <delete id="delete">
  165. delete from mall_topic where id = #{value}
  166. </delete>
  167. <delete id="deleteBatch">
  168. delete from mall_topic where id in
  169. <foreach item="id" collection="array" open="(" separator="," close=")">
  170. #{id}
  171. </foreach>
  172. </delete>
  173. </mapper>