Pu Zhibing
2025-02-27 f0a9a41697a8568e8b3bd3436c450e68b3298916
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
<?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.panzhihua.service_community.dao.ComActNeighborCircleCommentReplyWestDAO">
 
    <select id="getCircleCommentReplyList" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentReplyAppVO">
        select * from (
            select
              reply.id,reply.comment_id, reply.reply_content,reply.fabulous_num,
              reply.create_at,reply.is_release,su1.nick_name as userName,
              su1.image_url as userHeadUrl,su2.nick_name as parentUserName
            from com_act_neighbor_circle_comment_reply as reply
                   left join sys_user su1 on su1.user_id = reply.user_id
                   left join sys_user su2 on su2.user_id = reply.parent_user_id
            where reply.status = 1 and reply.comment_id = #{commentId}
            union
            select
              reply.id,reply.comment_id, reply.reply_content,reply.fabulous_num,
              reply.create_at,reply.is_release,su1.nick_name as userName,
              su1.image_url as userHeadUrl,su2.nick_name as parentUserName
            from com_act_neighbor_circle_comment_reply_west as reply
                   left join sys_user su1 on su1.user_id = reply.user_id
                   left join sys_user su2 on su2.user_id = reply.parent_user_id
            where reply.status = 1 and reply.comment_id = #{commentId}
        ) temp
        order by temp.create_at desc
    </select>
 
 
    <select id="selectListByComment" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyByAdminVO">
        select * from (
            select
                cr.id,
                cr.circle_id,
                cr.comment_id,
                cr.parent_id,
                cr.parent_user_id,
                cr.user_id,
                cr.reply_content,
                cr.fabulous_num,
                cr.create_at,
                cr.is_release,
                cr.status,
                u.name as userName,u.phone as userPhone,u.nick_name as userNickName
            from com_act_neighbor_circle_comment_reply cr
            left join sys_user u on cr.user_id=u.user_id
            <where>
                <if test='dto.id != null and dto.id!= 0l'>
                    cr.comment_id = #{dto.id}
                </if>
            </where>
        union
            select
                cr.id,
                cr.circle_id,
                cr.comment_id,
                cr.parent_id,
                cr.parent_user_id,
                cr.user_id,
                cr.reply_content,
                cr.fabulous_num,
                cr.create_at,
                cr.is_release,
                cr.status,
                u.name as userName,u.phone as userPhone,u.nick_name as userNickName
            from com_act_neighbor_circle_comment_reply_west cr
            left join sys_user u on cr.user_id=u.user_id
            <where>
                <if test='dto.id != null and dto.id!= 0l'>
                    cr.comment_id = #{dto.id}
                </if>
            </where>
        ) temp
        ORDER BY temp.create_at
    </select>
 
 
 
</mapper>