blob: fbbe02124e7e1fdfb113f5968d6204f43730befc [file] [log] [blame]
<?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.web.controller.post.mapper.PostReportMapper">
<resultMap type="com.ruoyi.web.controller.post.domain.PostReport" id="PostReportResult">
<id property="reportId" column="report_id" />
<result property="postId" column="post_id" />
<result property="postTitle" column="post_title" />
<result property="reportUserId" column="report_user_id" />
<result property="reportUserName" column="report_user_name" />
<result property="reportReason" column="report_reason" />
<result property="status" column="status" />
<result property="handleResult" column="handle_result" />
<result property="handleTime" column="handle_time" />
<result property="handleBy" column="handle_by" />
<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" />
</resultMap>
<sql id="selectPostReportVo">
select report_id, post_id, post_title, report_user_id, report_user_name, report_reason,
status, handle_result, handle_time, handle_by, create_by, create_time,
update_by, update_time, remark
from post_report
</sql>
<select id="selectPostReportList" parameterType="com.ruoyi.web.controller.post.domain.PostReport" resultMap="PostReportResult">
<include refid="selectPostReportVo"/>
<where>
<if test="postId != null">
AND post_id = #{postId}
</if>
<if test="reportUserId != null">
AND report_user_id = #{reportUserId}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postTitle != null and postTitle != ''">
AND post_title like concat('%', #{postTitle}, '%')
</if>
<if test="reportUserName != null and reportUserName != ''">
AND report_user_name like concat('%', #{reportUserName}, '%')
</if>
</where>
order by create_time desc
</select>
<select id="selectPostReportById" parameterType="Long" resultMap="PostReportResult">
<include refid="selectPostReportVo"/>
where report_id = #{reportId}
</select>
<insert id="insertPostReport" parameterType="com.ruoyi.web.controller.post.domain.PostReport" useGeneratedKeys="true" keyProperty="reportId">
insert into post_report (
post_id,
post_title,
report_user_id,
report_user_name,
report_reason,
status,
create_by,
create_time
) values (
#{postId},
#{postTitle},
#{reportUserId},
#{reportUserName},
#{reportReason},
#{status},
#{createBy},
sysdate()
)
</insert>
<update id="updatePostReport" parameterType="com.ruoyi.web.controller.post.domain.PostReport">
update post_report
<set>
<if test="postId != null">post_id = #{postId},</if>
<if test="postTitle != null and postTitle != ''">post_title = #{postTitle},</if>
<if test="reportUserId != null">report_user_id = #{reportUserId},</if>
<if test="reportUserName != null and reportUserName != ''">report_user_name = #{reportUserName},</if>
<if test="reportReason != null and reportReason != ''">report_reason = #{reportReason},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="handleResult != null">handle_result = #{handleResult},</if>
<if test="handleTime != null">handle_time = #{handleTime},</if>
<if test="handleBy != null and handleBy != ''">handle_by = #{handleBy},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where report_id = #{reportId}
</update>
<delete id="deletePostReportById" parameterType="Long">
delete from post_report where report_id = #{reportId}
</delete>
<delete id="deletePostReportByIds" parameterType="Long">
delete from post_report where report_id in
<foreach collection="array" item="reportId" open="(" separator="," close=")">
#{reportId}
</foreach>
</delete>
</mapper>