From 3389e27613953cf3d7d06653139bf902e08736dc Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 22 十月 2021 13:58:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test' into test

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java |   95 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 61 insertions(+), 34 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 5a3d820..f3ab2fb 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
@@ -5,6 +5,7 @@
 import java.util.Map;
 
 import com.panzhihua.common.model.vos.community.ComActActivityStatisticsVO;
+import com.panzhihua.common.model.vos.community.ComActActivityTypeVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -61,16 +62,22 @@
         + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}  "
         + " </if> " + "<if test='comActActivityVO.type != null and comActActivityVO.type==1 '>"
         + "AND a.volunteer_max!=0  " + " </if> "
-        + "<if test='comActActivityVO.type != null and comActActivityVO.type==2 '>" + "AND a.participant_max!=0  "
+        + "<if test='comActActivityVO.type != null and comActActivityVO.type==2 '>" + "AND a.volunteer_max=0  "
         + " </if> " + " group by a.id " + " order by a.status asc,a.publish_at desc " + "</script>")
     IPage<ComActActivityVO> pageActivity(Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO);
 
-    @Select("SELECT  " + "u.name sponsorName, " + "ca.name communityName, "
-        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, "
-        + "count(if(s.is_volunteer=0,s.id,null))participant_now, " + "a.*  " + "FROM  " + "com_act_activity a  "
-        + "left join sys_user u on a.sponsor_id=u.user_id  " + "left join com_act_act_sign s on a.id=s.activity_id  "
-        + "left join com_act ca on a.community_id=ca.community_id  " + "where a.id=#{id}  " + " group by a.id ")
-    ComActActivityVO inforActivity(Long id);
+//    @Select("SELECT  " + "u.name sponsorName, " + "ca.name communityName, "
+//        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, "
+//        + "count(if(s.is_volunteer=0,s.id,null))participant_now, " + "a.*  " + "FROM  " + "com_act_activity a  "
+//        + "left join sys_user u on a.sponsor_id=u.user_id  " + "left join com_act_act_sign s on a.id=s.activity_id  "
+//        + "left join com_act ca on a.community_id=ca.community_id  " + "where a.id=#{id}  " + " group by a.id ")
+
+    /**
+     * 活动详情
+     * @param id
+     * @return
+     */
+    ComActActivityVO inforActivity(@Param("id") Long id);
 
     @Select("SELECT " + "a.*  " + "FROM " + "com_act_act_sign s " + "JOIN com_act_activity a ON s.activity_id = a.id  "
         + "WHERE " + "s.user_id = #{comActActivityVO.sponsorId}  " + "ORDER BY " + "s.create_at DESC")
@@ -104,33 +111,38 @@
     @Update("update com_act_activity set `status`=5 where `status` in (3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),end_at)<=0")
     int updateStatusToBeginActiveOrEnd();
 
-    @Select("<script> " + "select t.* from ( " + "SELECT  " + "a.id, " + "a.activity_name, " + "u.`name` sponsorName, "
-        + "a.activity_addr, " + "a.participant_max, " + "count(if(s.is_volunteer=1,null,s.id))participant_now, "
-        + "a.volunteer_max, " + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, "
-        + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, " + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM "
-        + " com_act_activity a  " + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id "
-        + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id " + "WHERE "
-        + "  a.`status` = 1 and a.community_id=#{comActActivityVO.communityId} "
-        + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName !=&quot;&quot;'>"
-        + " and a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' )  " + " </if> "
-        + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 and comActActivityVO.status !=1'>"
-        + "AND a.`status` = 99  " + " </if> " + "<if test='comActActivityVO.beginAt != null '>"
-        + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}  "
-        + " </if> " + "group by a.id " + "  " + " union all " + "select t1.* from ( " + "  " + " SELECT  " + "a.id, "
-        + "a.activity_name, " + "u.`name` sponsorName, " + "a.activity_addr, " + "a.participant_max, "
-        + "count(if(s.is_volunteer=1,null,s.id))participant_now, " + "a.volunteer_max, "
-        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, " + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, "
-        + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM " + " com_act_activity a  "
-        + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id " + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id "
-        + "WHERE " + "  a.`status` != 1 and a.community_id=#{comActActivityVO.communityId} "
-        + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName !=&quot;&quot;'>"
-        + " and a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' )  " + " </if> "
-        + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 '>"
-        + "AND a.`status` = #{comActActivityVO.status}  " + " </if> " + "<if test='comActActivityVO.beginAt != null '>"
-        + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}  "
-        + " </if> " + " group by a.id order by a.publish_at desc)t1 )t" + "</script>")
-    IPage<ComActActivityVO> pageActivityCommunityBack(Page page,
-        @Param("comActActivityVO") ComActActivityVO comActActivityVO);
+//    @Select("<script> " + "select t.* from ( " + "SELECT  " + "a.id, " + "a.activity_name, " + "u.`name` sponsorName, "
+//        + "a.activity_addr, " + "a.participant_max, " + "count(if(s.is_volunteer=1,null,s.id))participant_now, "
+//        + "a.volunteer_max, " + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, "
+//        + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, " + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM "
+//        + " com_act_activity a  " + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id "
+//        + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id " + "WHERE "
+//        + "  a.`status` = 1 and a.community_id=#{comActActivityVO.communityId} "
+//        + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName !=&quot;&quot;'>"
+//        + " and a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' )  " + " </if> "
+//        + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 and comActActivityVO.status !=1'>"
+//        + "AND a.`status` = 99  " + " </if> " + "<if test='comActActivityVO.beginAt != null '>"
+//        + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}  "
+//        + " </if> " + "group by a.id " + "  " + " union all " + "select t1.* from ( " + "  " + " SELECT  " + "a.id, "
+//        + "a.activity_name, " + "u.`name` sponsorName, " + "a.activity_addr, " + "a.participant_max, "
+//        + "count(if(s.is_volunteer=1,null,s.id))participant_now, " + "a.volunteer_max, "
+//        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, " + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, "
+//        + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM " + " com_act_activity a  "
+//        + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id " + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id "
+//        + "WHERE " + "  a.`status` != 1 and a.community_id=#{comActActivityVO.communityId} "
+//        + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName !=&quot;&quot;'>"
+//        + " and a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' )  " + " </if> "
+//        + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 '>"
+//        + "AND a.`status` = #{comActActivityVO.status}  " + " </if> " + "<if test='comActActivityVO.beginAt != null '>"
+//        + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt}  "
+//        + " </if> " + " group by a.id order by a.publish_at desc)t1 )t" + "</script>")
+    /**
+     * 分页查询社区活动
+     * @param page
+     * @param comActActivityVO
+     * @return
+     */
+    IPage<ComActActivityVO> pageActivityCommunityBack(@Param("page") Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO);
 
     @Select("select id from com_act_activity where `status` in (3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),end_at)<=0")
     List<Long> getActivityEndIds();
@@ -204,4 +216,19 @@
      * @return 活动列表
      */
     List<ComActActivityVO> getIndexTopActivityList(@Param("communityId") Long communityId);
+
+    /**
+     * 获取活动类型(目前只有志愿者活动需要获取)
+     * @param communityId
+     * @param type
+     * @return
+     */
+    List<ComActActivityTypeVO> listActivityType(@Param("communityId") Long communityId, @Param("type") Integer type);
+
+    /**
+     * 添加活动类型
+     * @param comActActivityTypeVO
+     * @return
+     */
+    int addActivityType(@Param("comActActivityTypeVO") ComActActivityTypeVO comActActivityTypeVO);
 }

--
Gitblit v1.7.1