167 lines
7.9 KiB
XML
167 lines
7.9 KiB
XML
<?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">
|
|
<mapper namespace="com.ruoyi.portal.back.mapper.NdNewMapper">
|
|
|
|
<resultMap type="NdNew" id="NdNewResult">
|
|
<result property="id" column="id" />
|
|
<result property="firstType" column="first_type" />
|
|
<result property="firstTypeStr" column="first_type_str" />
|
|
<result property="newType" column="new_type" />
|
|
<result property="newTypeStr" column="new_type_str" />
|
|
<result property="type" column="type" />
|
|
<result property="title" column="title" />
|
|
<result property="sourceAuthor" column="source_author" />
|
|
<result property="abstracts" column="abstracts" />
|
|
<result property="imagePath" column="image_path" />
|
|
<result property="publishTime" column="publish_time" />
|
|
<result property="content" column="content" />
|
|
<result property="linkUrl" column="link_url" />
|
|
<result property="sort" column="sort" />
|
|
<result property="clickRate" column="click_rate" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<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="filePath" column="file_path" />
|
|
</resultMap>
|
|
|
|
<sql id="selectNdNewVo">
|
|
select
|
|
a.id,
|
|
b.parent_id as first_type,
|
|
c.name as first_type_str,
|
|
a.new_type,
|
|
b.name as new_type_str,
|
|
a.type,
|
|
a.title,
|
|
a.source_author,
|
|
a.abstracts,
|
|
a.image_path,
|
|
a.publish_time,
|
|
a.content,
|
|
a.link_url,
|
|
a.sort,
|
|
a.click_rate,
|
|
a.del_flag,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.remark,
|
|
a.file_path
|
|
from nd_new a
|
|
inner join nd_new_type b on a.new_type = b.id
|
|
inner join nd_new_type c on b.parent_id = c.id
|
|
</sql>
|
|
|
|
<select id="selectNdNewList" parameterType="NdNew" resultMap="NdNewResult">
|
|
<include refid="selectNdNewVo"/>
|
|
<where>
|
|
<if test="firstType != null and firstType != ''"> and b.parent_id = #{firstType}</if>
|
|
<if test="newType != null and newType != ''"> and a.new_type = #{newType}</if>
|
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
|
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
|
|
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
|
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and a.publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
|
|
</where>
|
|
order by a.publish_time desc,a.create_time desc
|
|
<if test="paramLimitno != null and paramLimitno != ''"> limit ${paramLimitno}</if>
|
|
</select>
|
|
|
|
<select id="selectNdNewById" parameterType="Long" resultMap="NdNewResult">
|
|
<include refid="selectNdNewVo"/>
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertNdNew" parameterType="NdNew" useGeneratedKeys="true" keyProperty="id">
|
|
insert into nd_new
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="newType != null">new_type,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="title != null">title,</if>
|
|
<if test="sourceAuthor != null">source_author,</if>
|
|
<if test="abstracts != null">abstracts,</if>
|
|
<if test="imagePath != null">image_path,</if>
|
|
<if test="publishTime != null">publish_time,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="linkUrl != null">link_url,</if>
|
|
<if test="sort != null">sort,</if>
|
|
<if test="clickRate != null">click_rate,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="filePath != null">file_path,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="newType != null">#{newType},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="title != null">#{title},</if>
|
|
<if test="sourceAuthor != null">#{sourceAuthor},</if>
|
|
<if test="abstracts != null">#{abstracts},</if>
|
|
<if test="imagePath != null">#{imagePath},</if>
|
|
<if test="publishTime != null">#{publishTime},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="linkUrl != null">#{linkUrl},</if>
|
|
<if test="sort != null">#{sort},</if>
|
|
<if test="clickRate != null">#{clickRate},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="filePath != null">#{filePath},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateNdNew" parameterType="NdNew">
|
|
update nd_new
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="newType != null">new_type = #{newType},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="title != null">title = #{title},</if>
|
|
<if test="sourceAuthor != null">source_author = #{sourceAuthor},</if>
|
|
<if test="abstracts != null">abstracts = #{abstracts},</if>
|
|
<if test="imagePath != null">image_path = #{imagePath},</if>
|
|
<if test="publishTime != null">publish_time = #{publishTime},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="linkUrl != null">link_url = #{linkUrl},</if>
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
<if test="clickRate != null">click_rate = #{clickRate},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="filePath != null">file_path = #{filePath},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteNdNewById" parameterType="Long">
|
|
delete from nd_new where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteNdNewByIds" parameterType="String">
|
|
delete from nd_new where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="getNewsTypes" parameterType="Long" resultType="com.ruoyi.common.core.domain.CxSelect">
|
|
select id as v, name as n,id,name
|
|
from nd_new_type
|
|
where parent_id = #{parentId}
|
|
order by sort
|
|
</select>
|
|
|
|
</mapper> |