|
@@ -1,49 +1,69 @@
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
<!DOCTYPE mapper
|
|
|
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.system.mapper.ColumnNewsMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="ColumnNews" id="ColumnNewsResult">
|
|
|
- <result property="newsId" column="news_id" />
|
|
|
- <result property="newsTitle" column="news_title" />
|
|
|
- <result property="columnId" column="column_id" />
|
|
|
- <result property="columnName" column="column_name" />
|
|
|
- <result property="newsContent" column="news_content" />
|
|
|
- <result property="status" column="status" />
|
|
|
- <result property="isDel" column="is_del" />
|
|
|
- <result property="reason" column="reason" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="remark" column="remark" />
|
|
|
+ <result property="newsId" column="news_id"/>
|
|
|
+ <result property="newsTitle" column="news_title"/>
|
|
|
+ <result property="columnId" column="column_id"/>
|
|
|
+ <result property="columnName" column="column_name"/>
|
|
|
+ <result property="newsContent" column="news_content"/>
|
|
|
+ <result property="isTop" column="is_top"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="isDel" column="is_del"/>
|
|
|
+ <result property="reason" column="reason"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectColumnNewsVo">
|
|
|
- select n.news_id, n.news_title, n.column_id, n.news_content, n.status, n.reason, n.create_by, n.create_time, n.update_by, n.update_time, n.remark,c.column_name from column_news n
|
|
|
+ select n.news_id, n.news_title, n.column_id, n.news_content,n.is_top, n.status, n.reason, n.create_by, n.create_time, n.update_by, n.update_time, n.remark,c.column_name from column_news n
|
|
|
left join column_navigation_bar c on n.column_id = c.column_id
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectColumnNewsList" parameterType="ColumnNews" resultMap="ColumnNewsResult">
|
|
|
<include refid="selectColumnNewsVo"/>
|
|
|
- <where>
|
|
|
- <if test="newsTitle != null and newsTitle != ''"> and n.news_title like concat('%', #{newsTitle}, '%')</if>
|
|
|
- <if test="newsContent != null and newsContent != ''"> and n.news_content like concat('%', #{newsContent}, '%')</if>
|
|
|
- <if test="status != null and status != ''"> and n.status = #{status}</if>
|
|
|
- <if test="isDel != null and isDel != ''"> and n.is_del = #{isDel}</if>
|
|
|
- <if test="columnName != null and columnName != ''"> and c.column_name = #{columnName}</if>
|
|
|
+ <where>
|
|
|
+ <if test="newsTitle != null and newsTitle != ''">and n.news_title like concat('%', #{newsTitle}, '%')</if>
|
|
|
+ <if test="newsContent != null and newsContent != ''">and n.news_content like concat('%', #{newsContent},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="status != null and status != ''">and n.status = #{status}</if>
|
|
|
+ <if test="isDel != null and isDel != ''">and n.is_del = #{isDel}</if>
|
|
|
+ <if test="columnName != null and columnName != ''">and c.column_name = #{columnName}</if>
|
|
|
+ <if test="isTop != null and isTop != ''">and n.is_top = #{isTop}</if>
|
|
|
</where>
|
|
|
+ order by n.create_time,n.update_time
|
|
|
</select>
|
|
|
|
|
|
<select id="selectColumnNewsListMenHu" parameterType="ColumnNews" resultMap="ColumnNewsResult">
|
|
|
select n.news_id, n.news_title, n.create_time from column_news n
|
|
|
- <where>
|
|
|
- <if test="newsTitle != null and newsTitle != ''"> and (n.news_title like concat('%', #{newsTitle}, '%') or n.news_content like concat('%', #{newsContent}, '%'))</if>
|
|
|
- <if test="columnId != null and columnId != ''"> and n.column_id = #{columnId}</if>
|
|
|
- </where>
|
|
|
+ where
|
|
|
+ n.status = '0'
|
|
|
+ and n.is_del = 'N'
|
|
|
+ <if test="newsTitle != null and newsTitle != ''">and (n.news_title like concat('%', #{newsTitle}, '%') or
|
|
|
+ n.news_content like concat('%', #{newsContent}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="columnId != null and columnId != ''">and n.column_id = #{columnId}</if>
|
|
|
+ <if test="isTop != null and isTop != ''">and n.is_top = #{isTop}</if>
|
|
|
+
|
|
|
+ order by n.create_time,n.update_time
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectColumnNewsListMenHuByColumnId" parameterType="Long" resultMap="ColumnNewsResult">
|
|
|
+ select n.news_id, n.news_title, n.create_time from column_news n
|
|
|
+ where
|
|
|
+ n.status = '0'
|
|
|
+ and n.is_del = 'N'
|
|
|
+ <if test="columnId != null and columnId != ''">and n.column_id = #{columnId}</if>
|
|
|
+ order by n.create_time,n.update_time limit 6
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectColumnNewsByNewsId" parameterType="Integer" resultMap="ColumnNewsResult">
|
|
|
<include refid="selectColumnNewsVo"/>
|
|
|
where n.news_id = #{newsId}
|
|
@@ -53,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
select n.news_id, n.news_title, n.column_id, n.news_content, n.status, n.reason, n.create_by, n.create_time, n.update_by, n.update_time, n.remark from column_news n
|
|
|
where n.news_id = #{newsId}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertColumnNews" parameterType="ColumnNews" useGeneratedKeys="true" keyProperty="newsId">
|
|
|
insert into column_news
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -61,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="columnId != null">column_id,</if>
|
|
|
<if test="newsContent != null and newsContent != ''">news_content,</if>
|
|
|
<if test="status != null">status,</if>
|
|
|
+ <if test="isTop != null">is_top,</if>
|
|
|
<if test="isDel != null">is_del,</if>
|
|
|
<if test="reason != null">reason,</if>
|
|
|
<if test="createBy != null">create_by,</if>
|
|
@@ -68,12 +89,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
<if test="remark != null">remark,</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="newsTitle != null and newsTitle != ''">#{newsTitle},</if>
|
|
|
<if test="columnId != null">#{columnId},</if>
|
|
|
<if test="newsContent != null and newsContent != ''">#{newsContent},</if>
|
|
|
<if test="status != null">#{status},</if>
|
|
|
+ <if test="isTop != null">#{isTop},</if>
|
|
|
<if test="isDel != null">#{isDel},</if>
|
|
|
<if test="reason != null">#{reason},</if>
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
@@ -81,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateColumnNews" parameterType="ColumnNews">
|
|
@@ -91,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="columnId != null">column_id = #{columnId},</if>
|
|
|
<if test="newsContent != null and newsContent != ''">news_content = #{newsContent},</if>
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
+ <if test="isTop != null">is_top = #{isTop},</if>
|
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
|
<if test="reason != null">reason = #{reason},</if>
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
@@ -107,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteColumnNewsByNewsIds" parameterType="String">
|
|
|
- delete from column_news where news_id in
|
|
|
+ delete from column_news where news_id in
|
|
|
<foreach item="newsId" collection="array" open="(" separator="," close=")">
|
|
|
#{newsId}
|
|
|
</foreach>
|