From 54ad966d0b142c97fc659263b51d1ea5d7b5c7c6 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 28 五月 2021 16:17:08 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java |  113 +++++++++++++++++++-------------------------------------
 1 files changed, 39 insertions(+), 74 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
index 0c9bb41..3240ae7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
@@ -9,6 +9,7 @@
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -22,10 +23,10 @@
 public interface ComActMicroWishDAO extends BaseMapper<ComActMicroWishDO> {
 
     @Select("<script> " +
-            "select * from ( "+
             "SELECT\n" +
             "w.id,\n" +
             "u.name sponsor_name,\n" +
+            "u.nick_name userNickName,\n" +
             "u.image_url ,\n" +
             "w.sponsor_phone,\n" +
             "w.wish_name,\n" +
@@ -47,101 +48,64 @@
             "left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id "+
             "JOIN sys_user u ON w.sponsor_id = u.user_id \n" +
             "<if test='comActMicroWishVO.sponsorName != null and comActMicroWishVO.sponsorName.trim() != &quot;&quot;'>" +
-            "AND u.name = #{comActMicroWishVO.sponsorName} \n" +
+            "AND u.name like concat(#{comActMicroWishVO.sponsorName},'%')  \n" +
             " </if> " +
+            "<if test='comActMicroWishVO.responsibleName == null or comActMicroWishVO.responsibleName.trim() == &quot;&quot;'>" +
             "LEFT JOIN sys_user su ON w.responsible_id = su.user_id \n" +
-            "<if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName.trim() != &quot;&quot;'>" +
-            "AND su.`name` = #{comActMicroWishVO.responsibleName} \n" +
             " </if> " +
-            "where w.status!=3 " +
+            "<if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName.trim() != &quot;&quot;'>" +
+            " JOIN sys_user su ON w.responsible_id = su.user_id \n" +
+            "AND su.`name` like concat(#{comActMicroWishVO.responsibleName},'%')  \n" +
+            " </if> " +
+            " <where>" +
             "<if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>" +
             " and w.community_id=#{comActMicroWishVO.communityId} \n" +
             " </if> " +
             "<if test='comActMicroWishVO.sponsorPhone != null and comActMicroWishVO.sponsorPhone.trim() != &quot;&quot;'>" +
-            "AND w.sponsor_phone = #{comActMicroWishVO.sponsorPhone} \n" +
+            "AND w.sponsor_phone like concat(#{comActMicroWishVO.sponsorPhone},'%')  \n" +
             " </if> " +
-            "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status!=0 '>" +
+            "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status!=0 and comActMicroWishVO.status!=3 and comActMicroWishVO.isPageMyWish==null'>" +
             "AND w.`status` = #{comActMicroWishVO.status} \n" +
+            " </if> " +
+            "<if test='comActMicroWishVO.status == 3  and comActMicroWishVO.isPageMyWish==null'>" +
+            "AND ( w.`status` = 3 or  w.`status` = 5 )\n" +
+            " </if> " +
+            "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status!=0 and comActMicroWishVO.isPageMyWish!=null and comActMicroWishVO.status==1'>" +
+            "AND w.`status` =1 \n" +
+            " </if> " +
+            "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status==3  and comActMicroWishVO.isPageMyWish!=null '>" +
+            "AND w.`status` in (2, 3) \n" +
             " </if> " +
             "<if test='comActMicroWishVO.createBegin != null '>" +
             "AND w.create_at BETWEEN #{comActMicroWishVO.createBegin} \n" +
             "AND #{comActMicroWishVO.createEnd}" +
             " </if> " +
             "<if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>" +
-            "AND w.status  in (3,6) \n" +
+            "AND w.status  in (3, 5, 6) \n" +
             " </if> " +
             "<if test='comActMicroWishVO.userId != null and comActMicroWishVO.userId != 0'>" +
             "AND w.sponsor_id  =#{comActMicroWishVO.userId} \n" +
             " </if> " +
+            "<if test='comActMicroWishVO.backUserId != null and comActMicroWishVO.backUserId != 0 and  comActMicroWishVO.status==3 '>" +
+            "AND w.responsible_id  =#{comActMicroWishVO.backUserId} \n" +
+            " </if> " +
+            "<if test='comActMicroWishVO.backUserId != null and comActMicroWishVO.backUserId != 0 and  comActMicroWishVO.status==0 '>" +
+            "and (w.status in(1,2,4,5,6) or (w.status=3 and w.responsible_id  =#{comActMicroWishVO.backUserId}))\n" +
+            " </if> " +
+            " </where>" +
             " group by w.id  \n"+
-
-
-            "union all "+
-
-            "SELECT\n" +
-            "w.id,\n" +
-            "u.name sponsor_name,\n" +
-            "u.image_url ,\n" +
-            "w.sponsor_phone,\n" +
-            "w.wish_name,\n" +
-            "w.`status`,\n" +
-            "w.`feedback_at`,\n" +
-            "w.`examine_at`,\n" +
-            "w.`distribution_at`,\n" +
-            "w.`evaluate_at`,\n" +
-            "w.`photo_path_list`,\n" +
-            "count(wu.id)star_num,\n" +
-            "w.`detail`,\n" +
-            "w.form,\n" +
-            "w.reject_reason,\n" +
-            "su.`name` responsible_name,\n" +
-            "w.score,\n" +
-            "w.create_at \n" +
-            "FROM\n" +
-            "com_act_micro_wish w\n" +
-            "left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id "+
-            "JOIN sys_user u ON w.sponsor_id = u.user_id \n" +
-            "<if test='comActMicroWishVO.sponsorName != null and comActMicroWishVO.sponsorName.trim() != &quot;&quot;'>" +
-            "AND u.name = #{comActMicroWishVO.sponsorName} \n" +
-            " </if> " +
-            "LEFT JOIN sys_user su ON w.responsible_id = su.user_id \n" +
-            "<if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName.trim() != &quot;&quot;'>" +
-            "AND su.`name` = #{comActMicroWishVO.responsibleName} \n" +
-            " </if> " +
-            "where w.status=3 and w.form=1 \n" +
-            "<if test='comActMicroWishVO.backUserId != null and comActMicroWishVO.backUserId != 0'>" +
-            "and w.responsible_id=#{comActMicroWishVO.backUserId} \n"+
-            " </if> " +
-            "<if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>" +
-            " and w.community_id=#{comActMicroWishVO.communityId} \n" +
-            " </if> " +
-            "<if test='comActMicroWishVO.sponsorPhone != null and comActMicroWishVO.sponsorPhone.trim() != &quot;&quot;'>" +
-            "AND w.sponsor_phone = #{comActMicroWishVO.sponsorPhone} \n" +
-            " </if> " +
-            "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status!=0 '>" +
-            "AND w.`status` = #{comActMicroWishVO.status} \n" +
-            " </if> " +
-            "<if test='comActMicroWishVO.createBegin != null '>" +
-            "AND w.create_at BETWEEN #{comActMicroWishVO.createBegin} \n" +
-            "AND #{comActMicroWishVO.createEnd}" +
-            " </if> " +
-            "<if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>" +
-            "AND w.status  in (3,6) \n" +
-            " </if> " +
-            "<if test='comActMicroWishVO.userId != null and comActMicroWishVO.userId != 0'>" +
-            "AND w.sponsor_id  =#{comActMicroWishVO.userId} \n" +
-            " </if> " +
-            " group by w.id  )t\n"+
-            "ORDER BY t.`status`, t.create_at "+
+            "ORDER BY  w.create_at desc "+
             "</script>")
     IPage<ComActMicroWishVO> pageMicroWish(Page page, @Param("comActMicroWishVO") ComActMicroWishVO comActMicroWishVO);
     @Select("SELECT\n" +
             "w.id,\n" +
             "u.name sponsor_name,\n" +
+            "u.nick_name userNickName,\n" +
             "w.create_at,\n" +
             "u.image_url,\n" +
             "w.sponsor_phone,\n" +
             "w.`status`,\n" +
+            "w.`sponsor_id`,\n" +
             "w.wish_name,\n" +
             "count(wu.id)starNum,\n" +
             "w.detail,\n" +
@@ -167,13 +131,12 @@
             "LEFT JOIN com_act_micro_wish_user wu ON w.id = wu.micro_wish_id \n" +
             "WHERE\n" +
             "w.id =#{id}"+
-            " group by w.id "
+            " group by w.id " +
+            "order by w.create_at desc"
     )
     ComActMicroWishVO detailMicroWish(Long id);
     @Select("SELECT\n" +
-            "'微心愿' FUNCTION,\n" +
-            "'待审核' behavior,\n" +
-            "'新增微心愿动态待审核' words \n" +
+            "'2' type\n" +
             "FROM\n" +
             "com_act_micro_wish w \n" +
             "WHERE\n" +
@@ -183,9 +146,7 @@
             "union all \n" +
             "\n" +
             "SELECT\n" +
-            "\t'微心愿' FUNCTION,\n" +
-            "\t'需要进行反馈' behavior,\n" +
-            "\t'微心愿有待反馈动态' words \n" +
+            "'2' type\n" +
             "FROM\n" +
             "\tcom_act_micro_wish w \n" +
             "WHERE\n" +
@@ -196,4 +157,8 @@
             "GROUP BY\n" +
             "\tw.community_id\n")
     List<TodoEventsVO> selectNeedToDo(@Param("communityId") Long communityId, @Param("userId") Long userId);
+
+    @Update("update com_act_micro_wish set `status`=6, evaluate_at=now() where `status`=5 and TIMESTAMPDIFF(HOUR, feedback_at, SYSDATE())>=72")
+    int updateStatusAutoConfirm();
+
 }

--
Gitblit v1.7.1