lin
2024-04-15 2193832ff5b8424d4ed16d0dc7ee779151c0e704
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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="org.springblade.modules.article.mapper.ArticleCommentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="articleCommentResultMap" type="org.springblade.modules.article.vo.ArticleCommentVO">
        <result property="id" column="id"/>
        <result property="articleId" column="article_id"/>
        <result property="content" column="content"/>
        <result property="userId" column="user_id"/>
        <result property="replyId" column="reply_id"/>
        <result property="replyTime" column="reply_time"/>
        <result property="topping" column="topping"/>
        <result property="isexamine" column="isexamine"/>
        <result property="checkUser" column="check_user"/>
        <result property="checkTime" column="check_time"/>
        <result property="checkStatus" column="check_status"/>
        <result property="checkRemark" column="check_remark"/>
        <result property="createTime" column="create_time"/>
        <result property="isDeleted" column="is_deleted"/>
    </resultMap>
 
    <sql id="selectArticleComment">
        select id,
               article_id,
               content,
               user_id,
               reply_id,
               reply_time,
               topping,
               isexamine,
               check_user,
               check_time,
               check_status,
               check_remark,
               create_time,
               is_deleted
        from jczz_article_comment
    </sql>
 
 
    <select id="selectArticleCommentPage" resultMap="articleCommentResultMap">
        SELECT
        jac.id,
        jac.article_id,
        jac.content,
        jac.user_id,
        jac.reply_id,
        jac.reply_time,
        jac.topping,
        jac.isexamine,
        jac.check_user,
        jac.check_time,
        jac.check_status,
        jac.check_remark,
        jac.create_time,
        jac.is_deleted,
        bu.`name` name,
        bu.`avatar`,
        bu.`phone` phone,
        ja.title
        FROM
        jczz_article_comment jac
        LEFT JOIN blade_user bu ON jac.user_id = bu.id
        LEFT JOIN jczz_article ja ON ja.id = jac.article_id
        <where>
            <if test="noticeComment.id != null ">and  jac.id = #{noticeComment.id}</if>
            <if test="noticeComment.articleId != null ">and jac.article_id = #{noticeComment.articleId}</if>
            <if test="noticeComment.content != null  and noticeComment.content != ''">and jac.content = #{noticeComment.content}</if>
            <if test="noticeComment.userId != null ">and jac.user_id = #{noticeComment.userId}</if>
            <if test="noticeComment.replyId != null ">and jac.reply_id = #{noticeComment.replyId}</if>
            <if test="noticeComment.replyTime != null ">and jac.reply_time = #{noticeComment.replyTime}</if>
            <if test="noticeComment.topping != null ">and jac.topping = #{noticeComment.topping}</if>
            <if test="noticeComment.isexamine != null ">and jac.isexamine = #{noticeComment.isexamine}</if>
            <if test="noticeComment.checkUser != null ">and jac.check_user = #{noticeComment.checkUser}</if>
            <if test="noticeComment.checkTime != null ">and jac.check_time = #{noticeComment.checkTime}</if>
            <if test="noticeComment.checkStatus != null ">and jac.check_status = #{noticeComment.checkStatus}</if>
            <if test="noticeComment.checkRemark != null  and noticeComment.checkRemark != ''">and jac.check_remark =
                #{noticeComment.checkRemark}
            </if>
            <if test="noticeComment.createTime != null ">and jac.create_time = #{noticeComment.createTime}</if>
            <if test="noticeComment.isDeleted != null ">and jac.is_deleted = #{noticeComment.isDeleted}</if>
 
            <if test="noticeComment.phone != null ">and bu.phone like concat('%',#{noticeComment.phone},'%')</if>
            <if test="noticeComment.name != null ">and bu.name like concat('%',#{noticeComment.name},'%')</if>
            <if test="noticeComment.title != null ">and ja.title like concat('%',#{noticeComment.title},'%')</if>
 
            <if test="noticeComment.cityCodeList != null and noticeComment.cityCodeList.size() > 0">
                and ( ja.article_range like
                <foreach collection="noticeComment.cityCodeList" separator=" or ja.article_range like" item="id">
                    '%${id}%'
                </foreach>
                )
            </if>
            and jac.user_id is not null
            order by jac.create_time desc
        </where>
    </select>
 
 
</mapper>