188 lines
8.6 KiB
XML
188 lines
8.6 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.system.mapper.AsArticleMapper">
|
|
|
|
<resultMap type="EtArticle" id="AsArticleResult">
|
|
<result property="articleId" column="article_id" />
|
|
<result property="classifyId" column="classify_id" />
|
|
<result property="title" column="title" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="logo" column="logo" />
|
|
<result property="masterPicture" column="master_picture" />
|
|
<result property="tag" column="tag" />
|
|
<result property="isHot" column="is_hot" />
|
|
<result property="introduction" column="introduction" />
|
|
<result property="content" column="content" />
|
|
<result property="author" column="author" />
|
|
<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" />
|
|
<association property="classify" javaType="AsArticleClassify" resultMap="classifyResult" />
|
|
</resultMap>
|
|
|
|
<resultMap id="classifyResult" type="AsArticleClassify">
|
|
<id property="classifyId" column="classify_id" />
|
|
<result property="parentId" column="parent_id" />
|
|
<result property="classifyName" column="classify_name" />
|
|
<result property="ancestors" column="ancestors" />
|
|
<result property="orderNum" column="order_num" />
|
|
<result property="status" column="dept_status" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAsArticleVo">
|
|
select article_id, classify_id, title, area_id, logo, master_picture, tag, is_hot, introduction, content, author, create_by, create_time, update_by, update_time, remark from et_article
|
|
</sql>
|
|
|
|
<select id="selectAsArticleList" parameterType="EtArticle" resultMap="AsArticleResult">
|
|
SELECT
|
|
a.article_id,
|
|
a.area_id,
|
|
a.classify_id,
|
|
a.title,
|
|
a.logo,
|
|
a.master_picture,
|
|
a.tag,
|
|
a.is_hot,
|
|
a.introduction,
|
|
-- a.content,
|
|
a.author,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.remark,
|
|
ac.classify_name
|
|
FROM
|
|
et_article a
|
|
LEFT JOIN et_article_classify ac ON ac.classify_id = a.classify_id
|
|
LEFT JOIN et_area_dept ad ON ad.area_id = a.area_id
|
|
LEFT JOIN sys_dept d ON d.dept_id = ad.dept_id
|
|
where (1 = 1
|
|
<if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if>
|
|
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
|
<if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if>
|
|
<if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if>
|
|
<if test="tag != null and tag != ''"> and a.tag = #{tag}</if>
|
|
<!-- 数据范围过滤 -->
|
|
${params.dataScope}) or ac.parent_id = 111 or ac.classify_id = 111
|
|
order by a.create_time desc
|
|
</select>
|
|
|
|
<select id="selectAsArticleListByApp" parameterType="EtArticle" resultMap="AsArticleResult">
|
|
SELECT
|
|
a.article_id,
|
|
a.area_id,
|
|
a.classify_id,
|
|
a.title,
|
|
a.logo,
|
|
a.master_picture,
|
|
a.tag,
|
|
a.is_hot,
|
|
a.introduction,
|
|
-- a.content,
|
|
a.author,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.remark,
|
|
ac.classify_name
|
|
FROM
|
|
et_article a
|
|
LEFT JOIN et_article_classify ac ON ac.classify_id = a.classify_id
|
|
LEFT JOIN et_area_dept ad ON ad.area_id = a.area_id
|
|
LEFT JOIN sys_dept d ON d.dept_id = ad.dept_id
|
|
where 1 = 1
|
|
<if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if>
|
|
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
|
|
<if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if>
|
|
<if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if>
|
|
<if test="tag != null and tag != ''"> and a.tag = #{tag}</if>
|
|
order by a.create_time desc
|
|
</select>
|
|
|
|
<select id="selectAsArticleByArticleId" parameterType="Long" resultMap="AsArticleResult">
|
|
<include refid="selectAsArticleVo"/>
|
|
where article_id = #{articleId}
|
|
</select>
|
|
|
|
<insert id="insertAsArticle" parameterType="EtArticle">
|
|
insert into et_article
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="articleId != null">article_id,</if>
|
|
<if test="classifyId != null and classifyId != ''">classify_id,</if>
|
|
<if test="title != null and title != ''">title,</if>
|
|
<if test="areaId != null and areaId != ''">area_id,</if>
|
|
<if test="logo != null">logo,</if>
|
|
<if test="masterPicture != null">master_picture,</if>
|
|
<if test="tag != null">tag,</if>
|
|
<if test="isHot != null">is_hot,</if>
|
|
<if test="introduction != null">introduction,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="author != null">author,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="articleId != null">#{articleId},</if>
|
|
<if test="classifyId != null and classifyId != ''">#{classifyId},</if>
|
|
<if test="title != null and title != ''">#{title},</if>
|
|
<if test="areaId != null and areaId != ''">#{areaId},</if>
|
|
<if test="logo != null">#{logo},</if>
|
|
<if test="masterPicture != null">#{masterPicture},</if>
|
|
<if test="tag != null">#{tag},</if>
|
|
<if test="isHot != null">#{isHot},</if>
|
|
<if test="introduction != null">#{introduction},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="author != null">#{author},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAsArticle" parameterType="EtArticle">
|
|
update et_article
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="classifyId != null and classifyId != ''">classify_id = #{classifyId},</if>
|
|
<if test="title != null and title != ''">title = #{title},</if>
|
|
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
|
|
<if test="logo != null">logo = #{logo},</if>
|
|
<if test="masterPicture != null">master_picture = #{masterPicture},</if>
|
|
<if test="tag != null">tag = #{tag},</if>
|
|
<if test="isHot != null">is_hot = #{isHot},</if>
|
|
<if test="introduction != null">introduction = #{introduction},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="author != null">author = #{author},</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>
|
|
</trim>
|
|
where article_id = #{articleId}
|
|
</update>
|
|
|
|
<delete id="deleteAsArticleByArticleId" parameterType="Long">
|
|
delete from et_article where article_id = #{articleId}
|
|
</delete>
|
|
|
|
<delete id="deleteAsArticleByArticleIds" parameterType="String">
|
|
delete from et_article where article_id in
|
|
<foreach item="articleId" collection="array" open="(" separator="," close=")">
|
|
#{articleId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
</mapper>
|