From cc1098fc00a50cb1591d182f04bc37066ff0a9e2 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期四, 05 八月 2021 15:12:39 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
index 777d733..dc61b2a 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
@@ -234,6 +234,9 @@
             "</script>")
     IPage<ComActActivityVO> pageActivityCommunityBack(Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO);
 
+    @Select("select id from com_act_activity where `status` in (3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),sign_up_end)<=0")
+    List<Long> getActivityEndIds();
+
     @Update("update com_act_activity set `status`=4 where `status`=3 and TIMESTAMPDIFF(MINUTE,SYSDATE(),sign_up_end)<=0")
     int updateStatusToBeginAfterSingEnd();
     @Select("select GROUP_CONCAT(t.x1,',',t.x2,',',t.x3,',',t.x4) from ( " +
@@ -261,13 +264,17 @@
             "  AND a.community_id =#{communityId}")
     CommunityActivitiesVO selectCommunityActivitiesVO(@Param("communityId") Long communityId, @Param("date")Date date);
 
-    @Select("SELECT COUNT(id) AS totalNum," +
-            "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND create_at LIKE CONCAT(#{nowDate},'%'))AS currentNum," +
-            "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND volunteer_max = 0)AS commonNum," +
-            "(SELECT COUNT(aas.id) FROM com_act_activity a INNER JOIN com_act_act_sign aas ON a.id = aas.activity_id WHERE a.volunteer_max = 0 AND (a.status = 3 OR a.status = 4 OR a.status = 5) AND  a.community_id=#{communityId})AS commonPeopleNum," +
-            "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND participant_max = 0)AS volunteerNum," +
-            "(SELECT COUNT(aas.id) FROM com_act_activity a INNER JOIN com_act_act_sign aas ON a.id = aas.activity_id WHERE a.community_id=#{communityId} AND a.participant_max = 0 AND (a.status = 3 OR a.status = 4 OR a.status = 5))AS volunteerPeopleNum" +
-            " FROM com_act_activity where community_id=#{communityId} AND (status = 3 OR status = 4 OR status = 5)")
+    @Select("SELECT " +
+            " count( caa.id ) as totalNum, " +
+            " (select count(id) from com_act_activity where `status` IN (1,2,3,4,5) and volunteer_min = 0 and community_id = #{communityId}) as commonNum, " +
+            " (select count(id) from com_act_activity where `status` IN (1,2,3,4,5) and volunteer_min > 0 and community_id = #{communityId}) as volunteerNum, " +
+            " (select count(caas.user_id) from com_act_act_sign as caas left join com_act_activity as caa on caa.id = caas.activity_id where caa.`status` IN (1,2,3,4,5) and is_volunteer = 0 and caa.community_id = #{communityId}) as commonPeopleNum, " +
+            " (select count(caas.user_id) from com_act_act_sign as caas left join com_act_activity as caa on caa.id = caas.activity_id where caa.`status` IN (1,2,3,4,5) and is_volunteer = 1 and caa.community_id = #{communityId}) as volunteerPeopleNum, " +
+            " (select count(id) from com_act_activity where `status` IN (1,2,3,4,5) and community_id = #{communityId} and create_at between date_sub(curdate() - day(curdate()) +1,interval 1 month) and now()) as currentNum " +
+            "FROM " +
+            " com_act_activity AS caa  " +
+            "WHERE " +
+            " caa.`status` IN (1,2,3,4,5) and community_id = #{communityId}")
     Map<String, Long> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate")String nowDate);
 
     @Select("SELECT id,activity_name as content,IF(volunteer_max = 0,'居民活动','志愿者活动') AS typeName  FROM com_act_activity " +
@@ -311,7 +318,7 @@
             " AND DATE_FORMAT(caa.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{actActivityListDTO.endTime} " +
             " </if> " +
             "<if test='actActivityListDTO.type!=null'>" +
-            " AND caa.status = #{actActivityListDTO.status} " +
+            " AND caa.status = #{actActivityListDTO.type} " +
             " </if> " +
             " </where> "+
             "ORDER BY " +

--
Gitblit v1.7.1