2024-05-23 17:24:41 +08:00
|
|
|
<?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" />
|
2024-06-12 15:32:32 +08:00
|
|
|
<result property="areaId" column="area_id" />
|
2024-05-23 17:24:41 +08:00
|
|
|
<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">
|
2024-06-12 15:32:32 +08:00
|
|
|
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
|
2024-05-23 17:24:41 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectAsArticleList" parameterType="EtArticle" resultMap="AsArticleResult">
|
2024-05-31 21:52:08 +08:00
|
|
|
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
|
2024-05-23 17:24:41 +08:00
|
|
|
left join et_article_classify ac on ac.classify_id = a.classify_id
|
2024-06-01 14:25:02 +08:00
|
|
|
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
|
2024-05-31 21:52:08 +08:00
|
|
|
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>
|
2024-06-13 15:03:23 +08:00
|
|
|
<if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if>
|
|
|
|
<if test="tag != null and tag != ''"> and a.tag = #{tag}</if>
|
2024-05-31 21:52:08 +08:00
|
|
|
<!-- 数据范围过滤 -->
|
|
|
|
${params.dataScope}
|
2024-05-23 17:24:41 +08:00
|
|
|
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>
|
2024-06-12 15:32:32 +08:00
|
|
|
<if test="areaId != null and areaId != ''">area_id,</if>
|
2024-05-23 17:24:41 +08:00
|
|
|
<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>
|
2024-06-12 15:32:32 +08:00
|
|
|
<if test="areaId != null and areaId != ''">#{areaId},</if>
|
2024-05-23 17:24:41 +08:00
|
|
|
<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>
|
2024-06-12 15:32:32 +08:00
|
|
|
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
|
2024-05-23 17:24:41 +08:00
|
|
|
<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>
|