NewsMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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.goafanti.common.dao.NewsMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.News">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  7. <result column="edit_time" jdbcType="TIMESTAMP" property="editTime" />
  8. <result column="title" jdbcType="VARCHAR" property="title" />
  9. <result column="title_img" jdbcType="VARCHAR" property="titleImg" />
  10. <result column="author" jdbcType="VARCHAR" property="author" />
  11. <result column="type" jdbcType="INTEGER" property="type" />
  12. <result column="hot" jdbcType="INTEGER" property="hot" />
  13. <result column="source" jdbcType="VARCHAR" property="source" />
  14. <result column="source_url" jdbcType="VARCHAR" property="sourceUrl" />
  15. <result column="summary" jdbcType="VARCHAR" property="summary" />
  16. <result column="jmrh_flag" jdbcType="INTEGER" property="jmrhFlag" />
  17. <result column="province_id" jdbcType="INTEGER" property="provinceId" />
  18. </resultMap>
  19. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.News">
  20. <result column="content" jdbcType="LONGVARCHAR" property="content" />
  21. </resultMap>
  22. <sql id="Base_Column_List">
  23. id, create_time, edit_time, title, title_img, author, type, hot, source, source_url,
  24. summary,jmrh_flag,province_id
  25. </sql>
  26. <sql id="Blob_Column_List">
  27. content
  28. </sql>
  29. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
  30. select
  31. <include refid="Base_Column_List" />
  32. ,
  33. <include refid="Blob_Column_List" />
  34. from news
  35. where id = #{id,jdbcType=BIGINT}
  36. </select>
  37. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  38. delete from news
  39. where id = #{id,jdbcType=BIGINT}
  40. </delete>
  41. <insert id="insert" parameterType="com.goafanti.common.model.News">
  42. insert into news (id, create_time, edit_time,
  43. title, title_img, author,
  44. type, hot, source,
  45. source_url, summary, content,jmrh_flag,province_id
  46. )
  47. values (#{id,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP},
  48. #{title,jdbcType=VARCHAR}, #{titleImg,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR},
  49. #{type,jdbcType=INTEGER}, #{hot,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR},
  50. #{sourceUrl,jdbcType=VARCHAR}, #{summary,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR},
  51. #{jmrhFlag,jdbcType=INTEGER}, #{provinceId,jdbcType=INTEGER}
  52. )
  53. </insert>
  54. <insert id="insertSelective" parameterType="com.goafanti.common.model.News">
  55. insert into news
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="id != null">
  58. id,
  59. </if>
  60. <if test="createTime != null">
  61. create_time,
  62. </if>
  63. <if test="editTime != null">
  64. edit_time,
  65. </if>
  66. <if test="title != null">
  67. title,
  68. </if>
  69. <if test="titleImg != null">
  70. title_img,
  71. </if>
  72. <if test="author != null">
  73. author,
  74. </if>
  75. <if test="type != null">
  76. type,
  77. </if>
  78. <if test="hot != null">
  79. hot,
  80. </if>
  81. <if test="source != null">
  82. source,
  83. </if>
  84. <if test="sourceUrl != null">
  85. source_url,
  86. </if>
  87. <if test="summary != null">
  88. summary,
  89. </if>
  90. <if test="content != null">
  91. content,
  92. </if>
  93. <if test="jmrhFlag != null">
  94. jmrh_flag,
  95. </if>
  96. <if test="provinceId != null">
  97. province_id,
  98. </if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="id != null">
  102. #{id,jdbcType=BIGINT},
  103. </if>
  104. <if test="createTime != null">
  105. #{createTime,jdbcType=TIMESTAMP},
  106. </if>
  107. <if test="editTime != null">
  108. #{editTime,jdbcType=TIMESTAMP},
  109. </if>
  110. <if test="title != null">
  111. #{title,jdbcType=VARCHAR},
  112. </if>
  113. <if test="titleImg != null">
  114. #{titleImg,jdbcType=VARCHAR},
  115. </if>
  116. <if test="author != null">
  117. #{author,jdbcType=VARCHAR},
  118. </if>
  119. <if test="type != null">
  120. #{type,jdbcType=INTEGER},
  121. </if>
  122. <if test="hot != null">
  123. #{hot,jdbcType=INTEGER},
  124. </if>
  125. <if test="source != null">
  126. #{source,jdbcType=VARCHAR},
  127. </if>
  128. <if test="sourceUrl != null">
  129. #{sourceUrl,jdbcType=VARCHAR},
  130. </if>
  131. <if test="summary != null">
  132. #{summary,jdbcType=VARCHAR},
  133. </if>
  134. <if test="content != null">
  135. #{content,jdbcType=LONGVARCHAR},
  136. </if>
  137. <if test="jmrhFlag != null">
  138. #{jmrhFlag,jdbcType=INTEGER},
  139. </if>
  140. <if test="provinceId != null">
  141. #{provinceId,jdbcType=INTEGER},
  142. </if>
  143. </trim>
  144. </insert>
  145. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.News">
  146. update news
  147. <set>
  148. <if test="createTime != null">
  149. create_time = #{createTime,jdbcType=TIMESTAMP},
  150. </if>
  151. <if test="editTime != null">
  152. edit_time = #{editTime,jdbcType=TIMESTAMP},
  153. </if>
  154. <if test="title != null">
  155. title = #{title,jdbcType=VARCHAR},
  156. </if>
  157. <if test="titleImg != null">
  158. title_img = #{titleImg,jdbcType=VARCHAR},
  159. </if>
  160. <if test="author != null">
  161. author = #{author,jdbcType=VARCHAR},
  162. </if>
  163. <if test="type != null">
  164. type = #{type,jdbcType=INTEGER},
  165. </if>
  166. <if test="hot != null">
  167. hot = #{hot,jdbcType=INTEGER},
  168. </if>
  169. <if test="source != null">
  170. source = #{source,jdbcType=VARCHAR},
  171. </if>
  172. <if test="sourceUrl != null">
  173. source_url = #{sourceUrl,jdbcType=VARCHAR},
  174. </if>
  175. <if test="summary != null">
  176. summary = #{summary,jdbcType=VARCHAR},
  177. </if>
  178. <if test="content != null">
  179. content = #{content,jdbcType=LONGVARCHAR},
  180. </if>
  181. <if test="jmrhFlag != null">
  182. content = #{jmrhFlag,jdbcType=INTEGER},
  183. </if>
  184. </set>
  185. where id = #{id,jdbcType=BIGINT}
  186. </update>
  187. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.News">
  188. update news
  189. set create_time = #{createTime,jdbcType=TIMESTAMP},
  190. edit_time = #{editTime,jdbcType=TIMESTAMP},
  191. title = #{title,jdbcType=VARCHAR},
  192. title_img = #{titleImg,jdbcType=VARCHAR},
  193. author = #{author,jdbcType=VARCHAR},
  194. type = #{type,jdbcType=INTEGER},
  195. hot = #{hot,jdbcType=INTEGER},
  196. source = #{source,jdbcType=VARCHAR},
  197. source_url = #{sourceUrl,jdbcType=VARCHAR},
  198. summary = #{summary,jdbcType=VARCHAR},
  199. content = #{content,jdbcType=LONGVARCHAR},
  200. jmrh_flag = #{jmrhFlag,jdbcType=INTEGER},
  201. province_id = #{provinceId,jdbcType=INTEGER}
  202. where id = #{id,jdbcType=BIGINT}
  203. </update>
  204. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.News">
  205. update news
  206. set create_time = #{createTime,jdbcType=TIMESTAMP},
  207. edit_time = #{editTime,jdbcType=TIMESTAMP},
  208. title = #{title,jdbcType=VARCHAR},
  209. title_img = #{titleImg,jdbcType=VARCHAR},
  210. author = #{author,jdbcType=VARCHAR},
  211. type = #{type,jdbcType=INTEGER},
  212. hot = #{hot,jdbcType=INTEGER},
  213. source = #{source,jdbcType=VARCHAR},
  214. source_url = #{sourceUrl,jdbcType=VARCHAR},
  215. summary = #{summary,jdbcType=VARCHAR},
  216. jmrh_flag = #{jmrhFlag,jdbcType=INTEGER},
  217. province_id = #{provinceId,jdbcType=INTEGER}
  218. where id = #{id,jdbcType=BIGINT}
  219. </update>
  220. </mapper>