mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
package com.panzhihua.service_community.dao;
 
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO;
import com.panzhihua.common.model.vos.community.ComActEasyPhotoCommentVO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoCommentDO;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 随手拍评论
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-01-21 14:45
 **/
@Mapper
public interface ComActEasyPhotoCommentDAO extends BaseMapper<ComActEasyPhotoCommentDO> {
    // @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("<script> " + "select * from (" + "SELECT \n" + "m.id,\n" + "m.`comment`,\n" + "e.`name`,\n"
        + "e.`nick_name`,\n" + "e.image_url url,\n" + "m.create_at,\n"
        + "<if test='comActEasyPhotoCommentDTO.userId != null'>" + " if(u1.id is null,0,1)haveSign,\n" + "</if> "
        + "COUNT(u.id)num\n" + "FROM\n" + "com_act_easy_photo_comment m \n" + "JOIN sys_user e on m.user_id=e.user_id\n"
        + "LEFT JOIN com_act_easy_photo_comment_user u on m.id=u.easy_photo_comment_id\n"
        + "<if test='comActEasyPhotoCommentDTO.userId != null'>"
        + " LEFT JOIN com_act_easy_photo_comment_user u1 on m.id=u1.easy_photo_comment_id and u1.user_id=#{comActEasyPhotoCommentDTO.userId}\n"
        + "</if> " + "where m.easy_photo_id=#{comActEasyPhotoCommentDTO.id}  " + "GROUP BY m.id\n"
        + " )t order by t.num desc, t.create_at DESC </script>")
    IPage<ComActEasyPhotoCommentVO> pageComActEasyPhotoComment(Page page,
        @Param("comActEasyPhotoCommentDTO") PageComActEasyPhotoCommentDTO pageComActEasyPhotoCommentDTO);
 
}