|
|
@@ -14,10 +14,11 @@
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
<result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
|
|
|
<result column="keywords" jdbcType="VARCHAR" property="keywords" />
|
|
|
+ <result column="hot" jdbcType="BIGINT" property="hot" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, title, publisher, `type`, picture_url, `status`, sort, content, release_status,
|
|
|
- create_time, release_time, keywords
|
|
|
+ create_time, release_time, keywords, hot
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
@@ -29,24 +30,21 @@
|
|
|
delete from news
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
- <insert id="insert" parameterType="com.kede.common.model.News">
|
|
|
- insert into news (id, title, publisher,
|
|
|
- `type`, picture_url, `status`,
|
|
|
- sort, content, release_status,
|
|
|
- create_time, release_time, keywords
|
|
|
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.News" useGeneratedKeys="true">
|
|
|
+ insert into news (title, publisher, `type`,
|
|
|
+ picture_url, `status`, sort,
|
|
|
+ content, release_status, create_time,
|
|
|
+ release_time, keywords, hot
|
|
|
)
|
|
|
- values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{publisher,jdbcType=VARCHAR},
|
|
|
- #{type,jdbcType=INTEGER}, #{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
|
|
|
- #{sort,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{releaseStatus,jdbcType=INTEGER},
|
|
|
- #{createTime,jdbcType=TIMESTAMP}, #{releaseTime,jdbcType=TIMESTAMP}, #{keywords,jdbcType=VARCHAR}
|
|
|
+ values (#{title,jdbcType=VARCHAR}, #{publisher,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
|
|
|
+ #{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
|
|
|
+ #{content,jdbcType=VARCHAR}, #{releaseStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ #{releaseTime,jdbcType=TIMESTAMP}, #{keywords,jdbcType=VARCHAR}, #{hot,jdbcType=BIGINT}
|
|
|
)
|
|
|
</insert>
|
|
|
- <insert id="insertSelective" parameterType="com.kede.common.model.News">
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.News" useGeneratedKeys="true">
|
|
|
insert into news
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- id,
|
|
|
- </if>
|
|
|
<if test="title != null">
|
|
|
title,
|
|
|
</if>
|
|
|
@@ -80,11 +78,11 @@
|
|
|
<if test="keywords != null">
|
|
|
keywords,
|
|
|
</if>
|
|
|
+ <if test="hot != null">
|
|
|
+ hot,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- #{id,jdbcType=INTEGER},
|
|
|
- </if>
|
|
|
<if test="title != null">
|
|
|
#{title,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
@@ -118,6 +116,9 @@
|
|
|
<if test="keywords != null">
|
|
|
#{keywords,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="hot != null">
|
|
|
+ #{hot,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.News">
|
|
|
@@ -156,6 +157,9 @@
|
|
|
<if test="keywords != null">
|
|
|
keywords = #{keywords,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="hot != null">
|
|
|
+ hot = #{hot,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
@@ -171,19 +175,20 @@
|
|
|
release_status = #{releaseStatus,jdbcType=INTEGER},
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
release_time = #{releaseTime,jdbcType=TIMESTAMP},
|
|
|
- keywords = #{keywords,jdbcType=VARCHAR}
|
|
|
+ keywords = #{keywords,jdbcType=VARCHAR},
|
|
|
+ hot = #{hot,jdbcType=BIGINT}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
<select id="selectByid" resultType="com.kede.news.bo.OutNews">
|
|
|
select id, title, publisher, type, picture_url pictureUrl, status, sort, release_status releaseStatus,content,
|
|
|
- date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert,create_time createTime,keywords,
|
|
|
+ date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert,create_time createTime,keywords,hot,
|
|
|
date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimeConvert ,release_time releaseTime
|
|
|
from news where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<select id="findNewsList" resultType="com.kede.news.bo.OutNews">
|
|
|
select id, title, publisher, type, picture_url pictureUrl, status, sort, release_status releaseStatus,content,
|
|
|
- date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert,create_time createTime,
|
|
|
+ date_format(create_time,'%Y-%m-%d %H:%i:%S') as createTimeConvert,create_time createTime,hot,keywords,
|
|
|
date_format(release_time,'%Y-%m-%d %H:%i:%S') as releaseTimeConvert ,release_time releaseTime
|
|
|
from news where 1=1
|
|
|
<if test="n.id!=null">
|
|
|
@@ -201,7 +206,11 @@
|
|
|
<if test="n.type!=null">
|
|
|
and type = #{n.type}
|
|
|
</if>
|
|
|
- order by releaseStatus desc,sort desc,id desc
|
|
|
+ order by
|
|
|
+ <if test="n.hot ==1">
|
|
|
+ hot desc,
|
|
|
+ </if>
|
|
|
+ releaseStatus desc,sort desc
|
|
|
<if test="page_sql!=null">
|
|
|
${page_sql}
|
|
|
</if>
|