238 lines
9.1 KiB
XML
238 lines
9.1 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.zhwl.cms.mapper.ZdyCmsArticleCommentMapper">
|
|
|
|
<resultMap type="ZdyCmsArticleComment" id="ZdyCmsArticleCommentResult">
|
|
<result property="id" column="id"/>
|
|
<result property="articleId" column="article_id"/>
|
|
<result property="zdyUserId" column="zdy_user_id"/>
|
|
<result property="parentCommentId" column="parent_comment_id"/>
|
|
<result property="content" column="content"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="ZdyCmsArticleCommentVO" id="ZdyCmsArticleCommentVOResult">
|
|
<result property="id" column="id"/>
|
|
<result property="articleId" column="article_id"/>
|
|
<result property="zdyUserId" column="zdy_user_id"/>
|
|
<result property="parentCommentId" column="parent_comment_id"/>
|
|
<result property="content" column="content"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
<result property="avatar" column="avatar"/>
|
|
<result property="nickname" column="nickname"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="ZdyCmsArchives" id="ZdyCmsArchivesResult">
|
|
<result property="id" column="id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="channelId" column="channel_id"/>
|
|
<result property="modelId" column="model_id"/>
|
|
<result property="title" column="title"/>
|
|
<result property="flag" column="flag"/>
|
|
<result property="style" column="style"/>
|
|
<result property="image" column="image"/>
|
|
<result property="keywords" column="keywords"/>
|
|
<result property="description" column="description"/>
|
|
<result property="tags" column="tags"/>
|
|
<result property="weigh" column="weigh"/>
|
|
<result property="views" column="views"/>
|
|
<result property="collects" column="collects"/>
|
|
<result property="comments" column="comments"/>
|
|
<result property="likes" column="likes"/>
|
|
<result property="dislikes" column="dislikes"/>
|
|
<result property="diyname" column="diyname"/>
|
|
<result property="createtime" column="createtime"/>
|
|
<result property="updatetime" column="updatetime"/>
|
|
<result property="publishtime" column="publishtime"/>
|
|
<result property="deletetime" column="deletetime"/>
|
|
<result property="memo" column="memo"/>
|
|
<result property="status" column="status"/>
|
|
<result property="adminId" column="admin_id"/>
|
|
<result property="dataOrg" column="data_org"/>
|
|
<result property="subtitle" column="subtitle"/>
|
|
<result property="origin" column="origin"/>
|
|
<result property="imageList" column="image_list"/>
|
|
<result property="userName" column="user_name"/>
|
|
<result property="avatar" column="avatar"/>
|
|
<result property="channelKey" column="channelKey"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyCmsArticleCommentVo">
|
|
select zcac.id,
|
|
zcac.article_id,
|
|
zcac.zdy_user_id,
|
|
zcac.parent_comment_id,
|
|
zcac.content,
|
|
zcac.status,
|
|
zcac.del_flag,
|
|
zcac.create_time,
|
|
zcac.update_time,
|
|
zcac.update_by,
|
|
zu.avatar,
|
|
zu.nickname
|
|
from zdy_cms_article_comment zcac
|
|
left join zdy_user zu on zcac.zdy_user_id = zu.id
|
|
</sql>
|
|
|
|
<select id="selectZdyCmsArticleCommentList" parameterType="ZdyCmsArticleComment"
|
|
resultMap="ZdyCmsArticleCommentVOResult">
|
|
<include refid="selectZdyCmsArticleCommentVo"/>
|
|
<where>
|
|
zcac.del_flag = '0'
|
|
<if test="articleId != null ">
|
|
and zcac.article_id = #{articleId}
|
|
</if>
|
|
<if test="zdyUserId != null ">
|
|
and zcac.zdy_user_id = #{zdyUserId}
|
|
</if>
|
|
<if test="parentCommentId != null ">
|
|
and zcac.parent_comment_id = #{parentCommentId}
|
|
</if>
|
|
<if test="content != null and content != ''">
|
|
and zcac.content like concat('%',#{content},'%')
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
and zcac.status = #{status}
|
|
</if>
|
|
</where>
|
|
order by zcac.create_time desc
|
|
</select>
|
|
|
|
<select id="selectZdyCmsArticleCommentById" parameterType="Long"
|
|
resultMap="ZdyCmsArticleCommentVOResult">
|
|
<include refid="selectZdyCmsArticleCommentVo"/>
|
|
where zcac.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertZdyCmsArticleComment" parameterType="ZdyCmsArticleComment" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into zdy_cms_article_comment
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="articleId != null">article_id,
|
|
</if>
|
|
<if test="zdyUserId != null">zdy_user_id,
|
|
</if>
|
|
<if test="parentCommentId != null">parent_comment_id,
|
|
</if>
|
|
<if test="content != null">content,
|
|
</if>
|
|
<if test="status != null and status != ''">status,
|
|
</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="updateTime != null">update_time,
|
|
</if>
|
|
<if test="updateBy != null">update_by,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="articleId != null">#{articleId},
|
|
</if>
|
|
<if test="zdyUserId != null">#{zdyUserId},
|
|
</if>
|
|
<if test="parentCommentId != null">#{parentCommentId},
|
|
</if>
|
|
<if test="content != null">#{content},
|
|
</if>
|
|
<if test="status != null and status != ''">#{status},
|
|
</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">#{updateTime},
|
|
</if>
|
|
<if test="updateBy != null">#{updateBy},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyCmsArticleComment" parameterType="ZdyCmsArticleComment">
|
|
update zdy_cms_article_comment
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="articleId != null">article_id =
|
|
#{articleId},
|
|
</if>
|
|
<if test="zdyUserId != null">zdy_user_id =
|
|
#{zdyUserId},
|
|
</if>
|
|
<if test="parentCommentId != null">parent_comment_id =
|
|
#{parentCommentId},
|
|
</if>
|
|
<if test="content != null">content =
|
|
#{content},
|
|
</if>
|
|
<if test="status != null and status != ''">status =
|
|
#{status},
|
|
</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag =
|
|
#{delFlag},
|
|
</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">update_time =
|
|
#{updateTime},
|
|
</if>
|
|
<if test="updateBy != null">update_by =
|
|
#{updateBy},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteZdyCmsArticleCommentById" parameterType="Long">
|
|
update zdy_cms_article_comment
|
|
set del_flag = '1'
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteZdyCmsArticleCommentByIds" parameterType="String">
|
|
update zdy_cms_article_comment set del_flag = '1'
|
|
where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="existsCommentsNotOwnedByOperator" resultType="Integer">
|
|
select exists(
|
|
select 1 from
|
|
zdy_cms_article_comment
|
|
where id in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
and zdy_user_id != #{operatorId}
|
|
)
|
|
</select>
|
|
|
|
<select id="countCommentsByArticleIds" resultMap="ZdyCmsArchivesResult">
|
|
SELECT
|
|
article_id AS id,
|
|
count(*) AS comments
|
|
FROM
|
|
zdy_cms_article_comment
|
|
WHERE
|
|
del_flag = '0'
|
|
and article_id in
|
|
<foreach item="archiveId" collection="list" open="(" separator="," close=")">
|
|
#{archiveId}
|
|
</foreach>
|
|
GROUP BY
|
|
article_id
|
|
</select>
|
|
</mapper> |