huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
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
package com.panzhihua.service_community.dao;
 
import java.util.List;
 
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.common.model.vos.community.ComActDiscussCommentVO;
import com.panzhihua.service_community.model.dos.ComActDiscussCommentDO;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 一起议评论
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-01-22 15:11
 **/
@Mapper
public interface ComActDiscussCommentDAO extends BaseMapper<ComActDiscussCommentDO> {
    //    @Select("<script> " +
//            " <where>" +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            " </where>" +
//            "</script>")
    @Select("" +
            "SELECT\n" +
            "u.`name` userName,\n" +
            "IFNULL(u.`nick_name`,'社区管理员') as userNickName,\n" +
            "u.`image_url`,\n" +
            "u.phone,\n" +
            "c.`comment`,\n" +
            "c.`parent_id`,\n" +
            "c.`is_author`,\n" +
            "c.`is_topping`,\n" +
            "COUNT( cu.id ) num,\n" +
            "c.create_at,\n" +
            "c.id \n" +
            "FROM\n" +
            "com_act_discuss_comment c\n" +
            "JOIN sys_user u ON c.user_id = u.user_id\n" +
            "LEFT JOIN com_act_discuss_comment_user cu on c.id=cu.disscuss_comment_id\n" +
            "WHERE\n" +
            "FIND_IN_SET(\n" +
            "\tc.id,\n" +
            "getChildren ( #{id} )) and c.parent_id !=0 \n" +
            "GROUP BY c.id\n" +
            "ORDER BY\n" +
            "create_at desc")
    List<ComActDiscussCommentVO> selectChilds(Long id);
}