linwe
2024-05-29 c10d6358b9f014375a13821465bc978d0c0da22e
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?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.circle.mapper.CircleCommentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="circleResultMap" type="org.springblade.modules.circle.vo.CircleCommentVO">
        <result property="id"    column="id"    />
        <result property="circleId"    column="circle_id"    />
        <result property="content"    column="content"    />
        <result property="userId"    column="user_id"    />
        <result property="parentId"    column="parent_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"    />
        <result property="depth"    column="depth"    />
 
        <collection property="children" column="id"  javaType="java.util.List"
                    ofType="org.springblade.modules.circle.vo.CircleCommentVO"
                    autoMapping="true"
                    select="selectCircleCommentByParentId">
 
        </collection>
 
    </resultMap>
 
 
    <resultMap type="org.springblade.modules.circle.dto.CircleCommentDTO" id="CircleCommentDTOResult">
        <result property="id"    column="id"    />
        <result property="circleId"    column="circle_id"    />
        <result property="content"    column="content"    />
        <result property="userId"    column="user_id"    />
        <result property="parentId"    column="parent_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"    />
        <result property="depth"    column="depth"    />
    </resultMap>
 
    <sql id="selectCircleComment">
        select
            id,
            circle_id,
            content,
            user_id,
            parent_id,
            reply_time,
            topping,
            isexamine,
            check_user,
            check_time,
            check_status,
            check_remark,
            create_time,
            is_deleted,
            depth
        from
            jczz_circle_comment
    </sql>
 
    <select id="selectCircleCommentById" parameterType="int" resultMap="CircleCommentDTOResult">
        <include refid="selectCircleComment"/>
        where
        id = #{id}
    </select>
 
    <select id="selectCircleCommentByParentId" parameterType="int" resultMap="CircleCommentDTOResult">
        <include refid="selectCircleComment"/>
        where
        parent_id = #{id}
    </select>
 
    <select id="selectCircleCommentList" parameterType="org.springblade.modules.circle.dto.CircleCommentDTO" resultMap="CircleCommentDTOResult">
        <include refid="selectCircleComment"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="circleId != null "> and circle_id = #{circleId}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="parentId != null "> and parent_id = #{parentId}</if>
            <if test="replyTime != null "> and reply_time = #{replyTime}</if>
            <if test="topping != null "> and topping = #{topping}</if>
            <if test="isexamine != null "> and isexamine = #{isexamine}</if>
            <if test="checkUser != null "> and check_user = #{checkUser}</if>
            <if test="checkTime != null "> and check_time = #{checkTime}</if>
            <if test="checkStatus != null "> and check_status = #{checkStatus}</if>
            <if test="checkRemark != null  and checkRemark != ''"> and check_remark = #{checkRemark}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
            <if test="depth != null "> and depth = #{depth}</if>
        </where>
    </select>
 
 
    <select id="selectCircleCommentPage" resultMap="circleResultMap">
        select
        jcc.id,
        jcc.circle_id,
        jcc.content,
        jcc.user_id,
        jcc.parent_id,
        jcc.reply_time,
        jcc.topping,
        jcc.isexamine,
        jcc.check_user,
        jcc.check_time,
        jcc.check_status,
        jcc.check_remark,
        jcc.create_time,
        jcc.is_deleted,
        bu.name,
        bu.avatar,
        jcc.depth
        from
        jczz_circle_comment  jcc left join blade_user bu on jcc.user_id = bu.id
        <where>
            <if test="circle.id != null "> and jcc.id = #{circle.id}</if>
            <if test="circle.circleId != null "> and jcc.circle_id = #{circle.circleId}</if>
            <if test="circle.content != null  and circle.content != ''"> and content = #{circle.content}</if>
            <if test="circle.userId != null "> and jcc.user_id = #{circle.userId}</if>
            <if test="circle.parentId != null "> and jcc.parent_id = #{circle.parentId}</if>
            <if test="circle.replyTime != null "> and jcc.reply_time = #{circle.replyTime}</if>
            <if test="circle.topping != null "> and jcc.topping = #{circle.topping}</if>
            <if test="circle.isexamine != null "> and jcc.isexamine = #{circle.isexamine}</if>
            <if test="circle.checkUser != null "> and jcc.check_user = #{circle.checkUser}</if>
            <if test="circle.checkTime != null "> and jcc.check_time = #{circle.checkTime}</if>
            <if test="circle.checkStatus != null "> and jcc.check_status = #{circle.checkStatus}</if>
            <if test="circle.checkRemark != null  and circle.checkRemark != ''"> and jcc.check_remark = #{circle.checkRemark}</if>
            <if test="circle.createTime != null "> and jcc.create_time = #{circle.createTime}</if>
            <if test="circle.isDeleted != null "> and jcc.is_deleted = #{circle.isDeleted}</if>
            <if test="circle.depth != null "> and jcc.depth = #{circle.depth}</if>
        </where>
    </select>
 
 
</mapper>