|
|
@@ -13,13 +13,14 @@
|
|
|
<result column="source" jdbcType="VARCHAR" property="source" />
|
|
|
<result column="source_url" jdbcType="VARCHAR" property="sourceUrl" />
|
|
|
<result column="summary" jdbcType="VARCHAR" property="summary" />
|
|
|
+ <result column="news_date" jdbcType="TIMESTAMP" property="newsDate" />
|
|
|
</resultMap>
|
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.News">
|
|
|
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, create_time, edit_time, title, title_img, author, type, hot, source, source_url,
|
|
|
- summary
|
|
|
+ summary, newsDate
|
|
|
</sql>
|
|
|
<sql id="Blob_Column_List">
|
|
|
content
|
|
|
@@ -40,12 +41,13 @@
|
|
|
insert into news (id, create_time, edit_time,
|
|
|
title, title_img, author,
|
|
|
type, hot, source,
|
|
|
- source_url, summary, content
|
|
|
+ source_url, summary, content, news_date
|
|
|
)
|
|
|
values (#{id,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP},
|
|
|
#{title,jdbcType=VARCHAR}, #{titleImg,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR},
|
|
|
#{type,jdbcType=INTEGER}, #{hot,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR},
|
|
|
- #{sourceUrl,jdbcType=VARCHAR}, #{summary,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
|
|
|
+ #{sourceUrl,jdbcType=VARCHAR}, #{summary,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR},
|
|
|
+ #{newsDate,jdbcType=TIMESTAMP}
|
|
|
)
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.goafanti.common.model.News">
|
|
|
@@ -87,6 +89,9 @@
|
|
|
<if test="content != null">
|
|
|
content,
|
|
|
</if>
|
|
|
+ <if test="newsDate != null">
|
|
|
+ news_date,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">
|
|
|
@@ -125,6 +130,9 @@
|
|
|
<if test="content != null">
|
|
|
#{content,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
+ <if test="newsDate != null">
|
|
|
+ #{newsDate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.News">
|
|
|
@@ -163,6 +171,9 @@
|
|
|
<if test="content != null">
|
|
|
content = #{content,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
+ <if test="newsDate != null">
|
|
|
+ news_date = #{newsDate ,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=BIGINT}
|
|
|
</update>
|
|
|
@@ -178,7 +189,8 @@
|
|
|
source = #{source,jdbcType=VARCHAR},
|
|
|
source_url = #{sourceUrl,jdbcType=VARCHAR},
|
|
|
summary = #{summary,jdbcType=VARCHAR},
|
|
|
- content = #{content,jdbcType=LONGVARCHAR}
|
|
|
+ content = #{content,jdbcType=LONGVARCHAR},
|
|
|
+ news_date = #{newsDate ,jdbcType=TIMESTAMP}
|
|
|
where id = #{id,jdbcType=BIGINT}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.News">
|
|
|
@@ -192,7 +204,68 @@
|
|
|
hot = #{hot,jdbcType=INTEGER},
|
|
|
source = #{source,jdbcType=VARCHAR},
|
|
|
source_url = #{sourceUrl,jdbcType=VARCHAR},
|
|
|
- summary = #{summary,jdbcType=VARCHAR}
|
|
|
+ summary = #{summary,jdbcType=VARCHAR},
|
|
|
+ news_date = #{newsDate ,jdbcType=TIMESTAMP}
|
|
|
where id = #{id,jdbcType=BIGINT}
|
|
|
</update>
|
|
|
+
|
|
|
+ <select id="findNewsListByPage" parameterType="String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ id,
|
|
|
+ create_time,
|
|
|
+ title,
|
|
|
+ author,
|
|
|
+ type,
|
|
|
+ hot,
|
|
|
+ source
|
|
|
+ from news
|
|
|
+ where 1 =1
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="author != null">
|
|
|
+ and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="sDate != null">
|
|
|
+ and create_time <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="eDate != null">
|
|
|
+ and create_time <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ order by edit_time desc
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findNewsCount" parameterType="String" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from news
|
|
|
+ where 1 =1
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="author != null">
|
|
|
+ and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="sDate != null">
|
|
|
+ and create_time <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="eDate != null">
|
|
|
+ and create_time <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|