2024-07-22 11:21:29 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper
|
2024-07-22 17:30:34 +08:00
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2024-07-22 11:21:29 +08:00
|
|
|
<mapper namespace="com.ruoyi.cms.mapper.CmsContentMapper">
|
2024-07-22 17:30:34 +08:00
|
|
|
|
2024-07-22 11:21:29 +08:00
|
|
|
<resultMap type="CmsContent" id="CmsContentResult">
|
2024-07-29 19:21:36 +08:00
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="categoryId" column="category_id"/>
|
|
|
|
<result property="contentType" column="content_type"/>
|
|
|
|
<result property="contentTitle" column="content_title"/>
|
|
|
|
<result property="contentImg" column="content_img"/>
|
|
|
|
<result property="contentDetail" column="content_detail"/>
|
|
|
|
<result property="source" column="source"/>
|
|
|
|
<result property="sourceUrl" column="source_url"/>
|
|
|
|
<result property="original" column="original"/>
|
|
|
|
<result property="author" column="author"/>
|
2024-08-21 18:47:25 +08:00
|
|
|
<result property="sortNum" column="sort_num"/>
|
2024-07-29 19:21:36 +08:00
|
|
|
<result property="editor" column="editor"/>
|
|
|
|
<result property="summary" column="summary"/>
|
2024-08-19 18:02:03 +08:00
|
|
|
<result property="tagName" column="tag_name"/>
|
2024-07-29 19:21:36 +08:00
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="publishDate" column="publish_date"/>
|
|
|
|
<result property="offlineDate" column="offline_date"/>
|
|
|
|
<result property="isAccessory" column="is_accessory"/>
|
|
|
|
<result property="accessoryUrl" column="accessory_url" javaType="java.util.List"
|
|
|
|
typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/>
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
<result property="imageUrl" column="image_url" javaType="java.util.List"
|
|
|
|
typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/>
|
|
|
|
<result property="videoUrl" column="video_url" javaType="java.util.List"
|
|
|
|
typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/>
|
2024-08-01 19:21:05 +08:00
|
|
|
<result property="linkType" column="link_type" />
|
|
|
|
<result property="link" column="link" />
|
2024-08-01 21:33:13 +08:00
|
|
|
<result property="count" column="count" />
|
2024-07-22 11:21:29 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectCmsContentVo">
|
2024-07-29 19:21:36 +08:00
|
|
|
select id,
|
|
|
|
category_id,
|
|
|
|
content_type,
|
|
|
|
image_url,
|
|
|
|
video_url,
|
|
|
|
content_title,
|
|
|
|
content_img,
|
|
|
|
content_detail,
|
|
|
|
source,
|
|
|
|
source_url,
|
|
|
|
original,
|
|
|
|
author,
|
2024-08-21 18:47:25 +08:00
|
|
|
sort_num,
|
2024-07-29 19:21:36 +08:00
|
|
|
editor,
|
|
|
|
summary,
|
2024-08-19 18:02:03 +08:00
|
|
|
tag_name,
|
2024-07-29 19:21:36 +08:00
|
|
|
status,
|
|
|
|
publish_date,
|
|
|
|
offline_date,
|
|
|
|
is_accessory,
|
|
|
|
accessory_url,
|
|
|
|
remark,
|
|
|
|
del_flag,
|
|
|
|
create_time,
|
|
|
|
create_by,
|
|
|
|
update_time,
|
2024-08-01 19:21:05 +08:00
|
|
|
update_by,
|
|
|
|
link_type,
|
2024-08-01 21:33:13 +08:00
|
|
|
link,
|
|
|
|
count
|
2024-07-29 19:21:36 +08:00
|
|
|
from cms_content
|
2024-07-22 11:21:29 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectCmsContentList" parameterType="CmsContent" resultMap="CmsContentResult">
|
2024-08-21 18:47:25 +08:00
|
|
|
select id,
|
|
|
|
category_id,
|
|
|
|
content_type,
|
|
|
|
image_url,
|
|
|
|
video_url,
|
|
|
|
content_title,
|
|
|
|
content_img,
|
|
|
|
content_detail,
|
|
|
|
source,
|
|
|
|
source_url,
|
|
|
|
original,
|
|
|
|
author,
|
|
|
|
sort_num,
|
|
|
|
editor,
|
|
|
|
summary,
|
|
|
|
tag_name,
|
|
|
|
status,
|
|
|
|
publish_date,
|
|
|
|
offline_date,
|
|
|
|
is_accessory,
|
|
|
|
accessory_url,
|
|
|
|
remark,
|
|
|
|
del_flag,
|
|
|
|
create_time,
|
|
|
|
create_by,
|
|
|
|
update_time,
|
|
|
|
update_by,
|
|
|
|
link_type,
|
|
|
|
link,
|
|
|
|
count
|
|
|
|
from cms_content
|
2024-07-22 17:30:34 +08:00
|
|
|
<where>
|
2024-07-29 19:21:36 +08:00
|
|
|
<if test="categoryId != null ">and category_id = #{categoryId}</if>
|
|
|
|
<if test="contentType != null ">and content_type = #{contentType}</if>
|
|
|
|
<if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle},
|
|
|
|
'%')
|
|
|
|
</if>
|
|
|
|
<if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if>
|
|
|
|
<if test="contentDetail != null and contentDetail != ''">and content_detail = #{contentDetail}</if>
|
|
|
|
<if test="source != null and source != ''">and source = #{source}</if>
|
|
|
|
<if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if>
|
|
|
|
<if test="original != null ">and original = #{original}</if>
|
|
|
|
<if test="author != null and author != ''">and author = #{author}</if>
|
|
|
|
<if test="editor != null and editor != ''">and editor = #{editor}</if>
|
|
|
|
<if test="summary != null and summary != ''">and summary = #{summary}</if>
|
|
|
|
<if test="status != null ">and status = #{status}</if>
|
|
|
|
<if test="publishDate != null ">and publish_date = #{publishDate}</if>
|
|
|
|
<if test="offlineDate != null ">and offline_date = #{offlineDate}</if>
|
|
|
|
<if test="isAccessory != null ">and is_accessory = #{isAccessory}</if>
|
|
|
|
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
|
|
|
|
<if test="delFlag != null">and del_flag = #{delFlag}</if>
|
2024-07-22 11:21:29 +08:00
|
|
|
</where>
|
2024-08-21 18:47:25 +08:00
|
|
|
order by sort_num ASC, create_time desc, update_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="contentList" parameterType="CmsContent" resultMap="CmsContentResult">
|
|
|
|
select id,
|
|
|
|
category_id,
|
|
|
|
content_type,
|
|
|
|
image_url,
|
|
|
|
video_url,
|
|
|
|
content_title,
|
|
|
|
content_img,
|
|
|
|
source,
|
|
|
|
source_url,
|
|
|
|
original,
|
|
|
|
author,
|
|
|
|
sort_num,
|
|
|
|
editor,
|
|
|
|
summary,
|
|
|
|
tag_name,
|
|
|
|
status,
|
|
|
|
publish_date,
|
|
|
|
offline_date,
|
|
|
|
is_accessory,
|
|
|
|
accessory_url,
|
|
|
|
remark,
|
|
|
|
del_flag,
|
|
|
|
create_time,
|
|
|
|
create_by,
|
|
|
|
update_time,
|
|
|
|
update_by,
|
|
|
|
link_type,
|
|
|
|
link,
|
|
|
|
count
|
|
|
|
from cms_content
|
|
|
|
<where>
|
|
|
|
<if test="categoryId != null ">and category_id = #{categoryId}</if>
|
|
|
|
<if test="contentType != null ">and content_type = #{contentType}</if>
|
|
|
|
<if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle},
|
|
|
|
'%')
|
|
|
|
</if>
|
|
|
|
<if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if>
|
|
|
|
<if test="contentDetail != null and contentDetail != ''">and content_detail = #{contentDetail}</if>
|
|
|
|
<if test="source != null and source != ''">and source = #{source}</if>
|
|
|
|
<if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if>
|
|
|
|
<if test="original != null ">and original = #{original}</if>
|
|
|
|
<if test="author != null and author != ''">and author = #{author}</if>
|
|
|
|
<if test="editor != null and editor != ''">and editor = #{editor}</if>
|
|
|
|
<if test="summary != null and summary != ''">and summary = #{summary}</if>
|
|
|
|
<if test="status != null ">and status = #{status}</if>
|
|
|
|
<if test="publishDate != null ">and publish_date = #{publishDate}</if>
|
|
|
|
<if test="offlineDate != null ">and offline_date = #{offlineDate}</if>
|
|
|
|
<if test="isAccessory != null ">and is_accessory = #{isAccessory}</if>
|
|
|
|
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
|
|
|
|
<if test="delFlag != null">and del_flag = #{delFlag}</if>
|
|
|
|
</where>
|
|
|
|
order by sort_num ASC, create_time desc, update_time desc
|
2024-07-22 11:21:29 +08:00
|
|
|
</select>
|
2024-07-22 17:30:34 +08:00
|
|
|
|
2024-07-22 11:21:29 +08:00
|
|
|
<select id="selectCmsContentById" parameterType="Long" resultMap="CmsContentResult">
|
|
|
|
<include refid="selectCmsContentVo"/>
|
|
|
|
where id = #{id}
|
|
|
|
</select>
|
|
|
|
|
2024-08-05 17:47:11 +08:00
|
|
|
<sql id="selectCmsContentVoNew">
|
|
|
|
select id,
|
|
|
|
category_id,
|
|
|
|
content_type,
|
|
|
|
image_url,
|
|
|
|
video_url,
|
|
|
|
content_title,
|
|
|
|
content_img,
|
|
|
|
source,
|
|
|
|
source_url,
|
2024-08-19 18:02:03 +08:00
|
|
|
tag_name,
|
2024-08-05 17:47:11 +08:00
|
|
|
original,
|
|
|
|
author,
|
2024-08-21 18:47:25 +08:00
|
|
|
sort_num,
|
2024-08-05 17:47:11 +08:00
|
|
|
editor,
|
|
|
|
summary,
|
|
|
|
status,
|
|
|
|
publish_date,
|
|
|
|
offline_date,
|
|
|
|
is_accessory,
|
|
|
|
accessory_url,
|
|
|
|
remark,
|
|
|
|
del_flag,
|
|
|
|
create_time,
|
|
|
|
create_by,
|
|
|
|
update_time,
|
|
|
|
update_by,
|
|
|
|
link_type,
|
|
|
|
link,
|
|
|
|
count
|
|
|
|
from cms_content
|
|
|
|
</sql>
|
|
|
|
<select id="selectCmsContentPart" resultMap="CmsContentResult">
|
|
|
|
<include refid="selectCmsContentVoNew"></include>
|
|
|
|
<where>
|
|
|
|
<if test="categoryId != null ">and category_id = #{categoryId}</if>
|
|
|
|
<if test="contentType != null ">and content_type = #{contentType}</if>
|
|
|
|
<if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle},
|
|
|
|
'%')
|
|
|
|
</if>
|
|
|
|
<if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if>
|
|
|
|
<if test="source != null and source != ''">and source = #{source}</if>
|
|
|
|
<if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if>
|
|
|
|
<if test="original != null ">and original = #{original}</if>
|
|
|
|
<if test="author != null and author != ''">and author = #{author}</if>
|
|
|
|
<if test="editor != null and editor != ''">and editor = #{editor}</if>
|
|
|
|
<if test="summary != null and summary != ''">and summary = #{summary}</if>
|
|
|
|
<if test="status != null ">and status = #{status}</if>
|
|
|
|
<if test="publishDate != null ">and publish_date = #{publishDate}</if>
|
|
|
|
<if test="offlineDate != null ">and offline_date = #{offlineDate}</if>
|
|
|
|
<if test="isAccessory != null ">and is_accessory = #{isAccessory}</if>
|
|
|
|
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
|
|
|
|
<if test="delFlag != null">and del_flag = #{delFlag}</if>
|
|
|
|
</where>
|
2024-08-21 18:47:25 +08:00
|
|
|
order by sort_num ASC, create_time desc, update_time desc
|
|
|
|
</select>
|
|
|
|
<select id="selectCmsContentByContentTitle" resultType="com.ruoyi.cms.domain.CmsContent"
|
|
|
|
parameterType="java.lang.String">
|
|
|
|
select * from cms_content where content_title = #{contentTitle}
|
2024-08-05 17:47:11 +08:00
|
|
|
</select>
|
|
|
|
|
2024-07-22 11:21:29 +08:00
|
|
|
<insert id="insertCmsContent" parameterType="CmsContent">
|
|
|
|
insert into cms_content
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
<if test="categoryId != null">category_id,</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
<if test="contentType != null">content_type,</if>
|
2024-07-22 11:21:29 +08:00
|
|
|
<if test="contentTitle != null and contentTitle != ''">content_title,</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="contentImg != null and contentImg != ''">content_img,</if>
|
|
|
|
<if test="contentDetail != null and contentDetail != ''">content_detail,</if>
|
|
|
|
<if test="source != null and source != ''">source,</if>
|
|
|
|
<if test="sourceUrl != null and sourceUrl != ''">source_url,</if>
|
|
|
|
<if test="original != null and original != ''">original,</if>
|
|
|
|
<if test="author != null and author != ''">author,</if>
|
2024-08-21 18:47:25 +08:00
|
|
|
<if test="sortNum != null and sortNum != ''">sort_num,</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="editor != null and editor != ''">editor,</if>
|
2024-08-19 18:02:03 +08:00
|
|
|
<if test="tagName != null and tagName != ''">tag_name,</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="summary != null and summary != ''">summary,</if>
|
|
|
|
<if test="status != null and status != ''">status,</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
<if test="publishDate != null">publish_date,</if>
|
|
|
|
<if test="offlineDate != null">offline_date,</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="isAccessory != null and isAccessory != ''">is_accessory,</if>
|
|
|
|
<if test="accessoryUrl != null and accessoryUrl.size() != 0">accessory_url,</if>
|
2024-07-22 11:21:29 +08:00
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
2024-08-01 19:21:05 +08:00
|
|
|
<if test="linkType != null">link_type,</if>
|
|
|
|
<if test="link != null">link,</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="imageUrl != null and imageUrl.size() != 0">image_url,</if>
|
|
|
|
<if test="videoUrl != null and videoUrl.size() != 0">video_url,</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
</trim>
|
2024-07-22 11:21:29 +08:00
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
<if test="categoryId != null">#{categoryId},</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
<if test="contentType != null">#{contentType},</if>
|
2024-07-22 11:21:29 +08:00
|
|
|
<if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="contentImg != null and contentImg != ''">#{contentImg},</if>
|
|
|
|
<if test="contentDetail != null and contentDetail != ''">#{contentDetail},</if>
|
|
|
|
<if test="source != null and source != ''">#{source},</if>
|
|
|
|
<if test="sourceUrl != null and sourceUrl != ''">#{sourceUrl},</if>
|
|
|
|
<if test="original != null and original != ''">#{original},</if>
|
|
|
|
<if test="author != null and author != ''">#{author},</if>
|
2024-08-21 18:47:25 +08:00
|
|
|
<if test="sortNum != null and sortNum != ''">#{sortNum},</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="editor != null and editor != ''">#{editor},</if>
|
2024-08-19 18:02:03 +08:00
|
|
|
<if test="tagName != null and tagName != ''">#{tagName},</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="summary != null and summary != ''">#{summary},</if>
|
|
|
|
<if test="status != null and status != ''">#{status},</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
<if test="publishDate != null">#{publishDate},</if>
|
|
|
|
<if test="offlineDate != null">#{offlineDate},</if>
|
2024-07-25 20:56:17 +08:00
|
|
|
<if test="isAccessory != null and isAccessory != ''">#{isAccessory},</if>
|
2024-07-29 19:21:36 +08:00
|
|
|
<if test="accessoryUrl != null and accessoryUrl.size() != 0">
|
|
|
|
#{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
|
|
|
</if>
|
2024-07-22 11:21:29 +08:00
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
2024-08-01 19:21:05 +08:00
|
|
|
<if test="linkType != null">#{linkType},</if>
|
|
|
|
<if test="link != null">#{link},</if>
|
2024-07-29 19:21:36 +08:00
|
|
|
<if test="imageUrl != null and imageUrl.size() != 0">
|
|
|
|
#{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
|
|
|
</if>
|
|
|
|
<if test="videoUrl != null and videoUrl.size() != 0">
|
|
|
|
#{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
|
|
|
</if>
|
2024-07-22 17:30:34 +08:00
|
|
|
</trim>
|
2024-07-22 11:21:29 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateCmsContent" parameterType="CmsContent">
|
|
|
|
update cms_content
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
2024-07-29 19:21:36 +08:00
|
|
|
category_id = #{categoryId},
|
|
|
|
content_type = #{contentType},
|
|
|
|
content_title = #{contentTitle},
|
|
|
|
content_img = #{contentImg},
|
|
|
|
content_detail = #{contentDetail},
|
|
|
|
source = #{source},
|
|
|
|
source_url = #{sourceUrl},
|
|
|
|
original = #{original},
|
|
|
|
author = #{author},
|
2024-08-19 18:02:03 +08:00
|
|
|
tag_name = #{tagName},
|
2024-07-29 19:21:36 +08:00
|
|
|
editor = #{editor},
|
2024-08-21 18:47:25 +08:00
|
|
|
sort_num = #{sortNum},
|
2024-07-29 19:21:36 +08:00
|
|
|
summary = #{summary},
|
|
|
|
status = #{status},
|
|
|
|
publish_date = #{publishDate},
|
|
|
|
offline_date = #{offlineDate},
|
|
|
|
is_accessory = #{isAccessory},
|
|
|
|
accessory_url = #{accessoryUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
|
|
|
remark = #{remark},
|
|
|
|
del_flag = #{delFlag},
|
|
|
|
create_time = #{createTime},
|
|
|
|
create_by = #{createBy},
|
|
|
|
update_time = #{updateTime},
|
|
|
|
update_by = #{updateBy},
|
2024-08-01 19:21:05 +08:00
|
|
|
link_type = #{linkType},
|
|
|
|
link = #{link},
|
2024-07-29 19:21:36 +08:00
|
|
|
image_url = #{imageUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
|
|
|
video_url = #{videoUrl,jdbcType=OTHER,typeHandler=com.ruoyi.system.handler.MysqlTypeHandler},
|
2024-07-22 11:21:29 +08:00
|
|
|
</trim>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
2024-08-01 21:33:13 +08:00
|
|
|
<update id="updateCount" parameterType="Long">
|
|
|
|
update cms_content set count = count + 1 where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
2024-07-22 11:21:29 +08:00
|
|
|
<delete id="deleteCmsContentById" parameterType="Long">
|
2024-07-29 19:21:36 +08:00
|
|
|
delete
|
|
|
|
from cms_content
|
|
|
|
where id = #{id}
|
2024-07-22 11:21:29 +08:00
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteCmsContentByIds" parameterType="String">
|
2024-07-22 17:30:34 +08:00
|
|
|
delete from cms_content where id in
|
2024-07-22 11:21:29 +08:00
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
2024-07-25 20:56:17 +08:00
|
|
|
|
|
|
|
|
2024-07-22 11:21:29 +08:00
|
|
|
</mapper>
|