meisiyu | c98fc52 | 2025-06-02 20:33:40 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.web.controller.post.mapper.PostReportMapper"> |
| 6 | |
| 7 | <resultMap type="com.ruoyi.web.controller.post.domain.PostReport" id="PostReportResult"> |
| 8 | <id property="reportId" column="report_id" /> |
| 9 | <result property="postId" column="post_id" /> |
| 10 | <result property="postTitle" column="post_title" /> |
| 11 | <result property="reportUserId" column="report_user_id" /> |
| 12 | <result property="reportUserName" column="report_user_name" /> |
| 13 | <result property="reportReason" column="report_reason" /> |
| 14 | <result property="status" column="status" /> |
| 15 | <result property="handleResult" column="handle_result" /> |
| 16 | <result property="handleTime" column="handle_time" /> |
| 17 | <result property="handleBy" column="handle_by" /> |
| 18 | <result property="createBy" column="create_by" /> |
| 19 | <result property="createTime" column="create_time" /> |
| 20 | <result property="updateBy" column="update_by" /> |
| 21 | <result property="updateTime" column="update_time" /> |
| 22 | <result property="remark" column="remark" /> |
| 23 | </resultMap> |
| 24 | |
| 25 | <sql id="selectPostReportVo"> |
| 26 | select report_id, post_id, post_title, report_user_id, report_user_name, report_reason, |
| 27 | status, handle_result, handle_time, handle_by, create_by, create_time, |
| 28 | update_by, update_time, remark |
| 29 | from post_report |
| 30 | </sql> |
| 31 | |
| 32 | <select id="selectPostReportList" parameterType="com.ruoyi.web.controller.post.domain.PostReport" resultMap="PostReportResult"> |
| 33 | <include refid="selectPostReportVo"/> |
| 34 | <where> |
| 35 | <if test="postId != null"> |
| 36 | AND post_id = #{postId} |
| 37 | </if> |
| 38 | <if test="reportUserId != null"> |
| 39 | AND report_user_id = #{reportUserId} |
| 40 | </if> |
| 41 | <if test="status != null and status != ''"> |
| 42 | AND status = #{status} |
| 43 | </if> |
| 44 | <if test="postTitle != null and postTitle != ''"> |
| 45 | AND post_title like concat('%', #{postTitle}, '%') |
| 46 | </if> |
| 47 | <if test="reportUserName != null and reportUserName != ''"> |
| 48 | AND report_user_name like concat('%', #{reportUserName}, '%') |
| 49 | </if> |
| 50 | </where> |
| 51 | order by create_time desc |
| 52 | </select> |
| 53 | |
| 54 | <select id="selectPostReportById" parameterType="Long" resultMap="PostReportResult"> |
| 55 | <include refid="selectPostReportVo"/> |
| 56 | where report_id = #{reportId} |
| 57 | </select> |
| 58 | |
| 59 | <insert id="insertPostReport" parameterType="com.ruoyi.web.controller.post.domain.PostReport" useGeneratedKeys="true" keyProperty="reportId"> |
| 60 | insert into post_report ( |
| 61 | post_id, |
| 62 | post_title, |
| 63 | report_user_id, |
| 64 | report_user_name, |
| 65 | report_reason, |
| 66 | status, |
| 67 | create_by, |
| 68 | create_time |
| 69 | ) values ( |
| 70 | #{postId}, |
| 71 | #{postTitle}, |
| 72 | #{reportUserId}, |
| 73 | #{reportUserName}, |
| 74 | #{reportReason}, |
| 75 | #{status}, |
| 76 | #{createBy}, |
| 77 | sysdate() |
| 78 | ) |
| 79 | </insert> |
| 80 | |
| 81 | <update id="updatePostReport" parameterType="com.ruoyi.web.controller.post.domain.PostReport"> |
| 82 | update post_report |
| 83 | <set> |
| 84 | <if test="postId != null">post_id = #{postId},</if> |
| 85 | <if test="postTitle != null and postTitle != ''">post_title = #{postTitle},</if> |
| 86 | <if test="reportUserId != null">report_user_id = #{reportUserId},</if> |
| 87 | <if test="reportUserName != null and reportUserName != ''">report_user_name = #{reportUserName},</if> |
| 88 | <if test="reportReason != null and reportReason != ''">report_reason = #{reportReason},</if> |
| 89 | <if test="status != null and status != ''">status = #{status},</if> |
| 90 | <if test="handleResult != null">handle_result = #{handleResult},</if> |
| 91 | <if test="handleTime != null">handle_time = #{handleTime},</if> |
| 92 | <if test="handleBy != null and handleBy != ''">handle_by = #{handleBy},</if> |
| 93 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| 94 | <if test="remark != null">remark = #{remark},</if> |
| 95 | update_time = sysdate() |
| 96 | </set> |
| 97 | where report_id = #{reportId} |
| 98 | </update> |
| 99 | |
| 100 | <delete id="deletePostReportById" parameterType="Long"> |
| 101 | delete from post_report where report_id = #{reportId} |
| 102 | </delete> |
| 103 | |
| 104 | <delete id="deletePostReportByIds" parameterType="Long"> |
| 105 | delete from post_report where report_id in |
| 106 | <foreach collection="array" item="reportId" open="(" separator="," close=")"> |
| 107 | #{reportId} |
| 108 | </foreach> |
| 109 | </delete> |
| 110 | |
| 111 | </mapper> |