JtNewsMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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.JtNewsMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtNews">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="title" jdbcType="VARCHAR" property="title" />
  7. <result column="publisher" jdbcType="VARCHAR" property="publisher" />
  8. <result column="type" jdbcType="INTEGER" property="type" />
  9. <result column="picture_url" jdbcType="VARCHAR" property="pictureUrl" />
  10. <result column="status" jdbcType="INTEGER" property="status" />
  11. <result column="sort" jdbcType="INTEGER" property="sort" />
  12. <result column="content" jdbcType="VARCHAR" property="content" />
  13. <result column="release_status" jdbcType="INTEGER" property="releaseStatus" />
  14. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  15. <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
  16. </resultMap>
  17. <sql id="Base_Column_List">
  18. id, title, publisher, `type`, picture_url, `status`, sort, content, release_status,
  19. create_time, release_time
  20. </sql>
  21. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  22. select
  23. <include refid="Base_Column_List" />
  24. from jt_news
  25. where id = #{id,jdbcType=INTEGER}
  26. </select>
  27. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  28. delete from jt_news
  29. where id = #{id,jdbcType=INTEGER}
  30. </delete>
  31. <insert id="insert" parameterType="com.goafanti.common.model.JtNews">
  32. insert into jt_news (id, title, publisher,
  33. `type`, picture_url, `status`,
  34. sort, content, release_status,
  35. create_time, release_time)
  36. values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{publisher,jdbcType=VARCHAR},
  37. #{type,jdbcType=INTEGER}, #{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
  38. #{sort,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{releaseStatus,jdbcType=INTEGER},
  39. #{createTime,jdbcType=TIMESTAMP}, #{releaseTime,jdbcType=TIMESTAMP})
  40. </insert>
  41. <insert id="insertSelective" parameterType="com.goafanti.common.model.JtNews">
  42. insert into jt_news
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="id != null">
  45. id,
  46. </if>
  47. <if test="title != null">
  48. title,
  49. </if>
  50. <if test="publisher != null">
  51. publisher,
  52. </if>
  53. <if test="type != null">
  54. `type`,
  55. </if>
  56. <if test="pictureUrl != null">
  57. picture_url,
  58. </if>
  59. <if test="status != null">
  60. `status`,
  61. </if>
  62. <if test="sort != null">
  63. sort,
  64. </if>
  65. <if test="content != null">
  66. content,
  67. </if>
  68. <if test="releaseStatus != null">
  69. release_status,
  70. </if>
  71. <if test="createTime != null">
  72. create_time,
  73. </if>
  74. <if test="releaseTime != null">
  75. release_time,
  76. </if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="id != null">
  80. #{id,jdbcType=INTEGER},
  81. </if>
  82. <if test="title != null">
  83. #{title,jdbcType=VARCHAR},
  84. </if>
  85. <if test="publisher != null">
  86. #{publisher,jdbcType=VARCHAR},
  87. </if>
  88. <if test="type != null">
  89. #{type,jdbcType=INTEGER},
  90. </if>
  91. <if test="pictureUrl != null">
  92. #{pictureUrl,jdbcType=VARCHAR},
  93. </if>
  94. <if test="status != null">
  95. #{status,jdbcType=INTEGER},
  96. </if>
  97. <if test="sort != null">
  98. #{sort,jdbcType=INTEGER},
  99. </if>
  100. <if test="content != null">
  101. #{content,jdbcType=VARCHAR},
  102. </if>
  103. <if test="releaseStatus != null">
  104. #{releaseStatus,jdbcType=INTEGER},
  105. </if>
  106. <if test="createTime != null">
  107. #{createTime,jdbcType=TIMESTAMP},
  108. </if>
  109. <if test="releaseTime != null">
  110. #{releaseTime,jdbcType=TIMESTAMP},
  111. </if>
  112. </trim>
  113. </insert>
  114. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtNews">
  115. update jt_news
  116. <set>
  117. <if test="title != null">
  118. title = #{title,jdbcType=VARCHAR},
  119. </if>
  120. <if test="publisher != null">
  121. publisher = #{publisher,jdbcType=VARCHAR},
  122. </if>
  123. <if test="type != null">
  124. `type` = #{type,jdbcType=INTEGER},
  125. </if>
  126. <if test="pictureUrl != null">
  127. picture_url = #{pictureUrl,jdbcType=VARCHAR},
  128. </if>
  129. <if test="status != null">
  130. `status` = #{status,jdbcType=INTEGER},
  131. </if>
  132. <if test="sort != null">
  133. sort = #{sort,jdbcType=INTEGER},
  134. </if>
  135. <if test="content != null">
  136. content = #{content,jdbcType=VARCHAR},
  137. </if>
  138. <if test="releaseStatus != null">
  139. release_status = #{releaseStatus,jdbcType=INTEGER},
  140. </if>
  141. <if test="createTime != null">
  142. create_time = #{createTime,jdbcType=TIMESTAMP},
  143. </if>
  144. <if test="releaseTime != null">
  145. release_time = #{releaseTime,jdbcType=TIMESTAMP},
  146. </if>
  147. </set>
  148. where id = #{id,jdbcType=INTEGER}
  149. </update>
  150. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtNews">
  151. update jt_news
  152. set title = #{title,jdbcType=VARCHAR},
  153. publisher = #{publisher,jdbcType=VARCHAR},
  154. `type` = #{type,jdbcType=INTEGER},
  155. picture_url = #{pictureUrl,jdbcType=VARCHAR},
  156. `status` = #{status,jdbcType=INTEGER},
  157. sort = #{sort,jdbcType=INTEGER},
  158. content = #{content,jdbcType=VARCHAR},
  159. release_status = #{releaseStatus,jdbcType=INTEGER},
  160. create_time = #{createTime,jdbcType=TIMESTAMP},
  161. release_time = #{releaseTime,jdbcType=TIMESTAMP}
  162. where id = #{id,jdbcType=INTEGER}
  163. </update>
  164. <select id="findNewsList" resultType="com.goafanti.news.bo.OutJtNews">
  165. select id,title,publisher,`type`,picture_url pictureUrl,status,sort,content,release_status releaseStatus,
  166. date_format(create_time,'%Y-%m-%d %H:%i:%S' ) as createTimes,date_format(release_time,'%Y-%m-%d %H:%i:%S' ) as releaseTimes,
  167. create_time createTime ,release_time releaseTime
  168. from jt_news where 1=1
  169. <if test="n.id!=null">
  170. and id = #{n.id}
  171. </if>
  172. <if test="n.title!=null">
  173. and title like concat('%',#{n.title},'%')
  174. </if>
  175. <if test="n.releaseStatus!=null">
  176. and release_status = #{n.releaseStatus}
  177. </if>
  178. <if test="n.status!=null">
  179. and status = #{n.status}
  180. </if>
  181. <if test="n.type!=null">
  182. and type = #{n.type}
  183. </if>
  184. order by releaseStatus desc,sort desc,id desc
  185. <if test="page_sql!=null">
  186. ${page_sql}
  187. </if>
  188. </select>
  189. <select id="findNewsCount" resultType="java.lang.Integer">
  190. select count(*)
  191. from jt_news where 1=1
  192. <if test="n.id!=null">
  193. and id = #{n.id}
  194. </if>
  195. <if test="n.title!=null">
  196. and title like concat('%',#{n.title},'%')
  197. </if>
  198. <if test="n.releaseStatus!=null">
  199. and release_status = #{n.releaseStatus}
  200. </if>
  201. <if test="n.status!=null">
  202. and status = #{n.status}
  203. </if>
  204. <if test="n.type!=null">
  205. and type = #{n.type}
  206. </if>
  207. </select>
  208. <select id="selectByid" resultType="com.goafanti.news.bo.OutJtNews">
  209. select id, title, publisher, type, picture_url pictureUrl, status, sort, release_status releaseStatus,content,
  210. date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimes,create_time createTime,
  211. date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimes ,release_time releaseTime
  212. from jt_news where id = #{id,jdbcType=INTEGER}
  213. </select>
  214. </mapper>