NewsMapper.xml 7.2 KB

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