From 929ff93a7a9db5b9fb0e3ce8e45a66ce59ea1767 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期三, 11 八月 2021 17:53:57 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoCommentDAO.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoCommentDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoCommentDAO.java
index 8c87302..5fcd256 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoCommentDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoCommentDAO.java
@@ -29,7 +29,8 @@
 //            " </if> " +
 //            " </where>" +
 //            "</script>")
-    @Select("select * from (" +
+    @Select("<script> " +
+            "select * from (" +
             "SELECT \n" +
             "m.id,\n" +
             "m.`comment`,\n" +
@@ -37,16 +38,20 @@
             "e.`nick_name`,\n" +
             "e.image_url url,\n" +
             "m.create_at,\n" +
-            "if(u1.id is null,0,1)haveSign,\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" +
-            "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 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 ")
+            " )t order by t.num desc, t.create_at DESC </script>")
     IPage<ComActEasyPhotoCommentVO> pageComActEasyPhotoComment(Page page, @Param("comActEasyPhotoCommentDTO") PageComActEasyPhotoCommentDTO pageComActEasyPhotoCommentDTO);
 
 

--
Gitblit v1.7.1