From 42239f79490e7130a63d51a67efd1f2c8d23be37 Mon Sep 17 00:00:00 2001 From: xyh <18782104331@139.com> Date: 星期五, 18 六月 2021 09:50:44 +0800 Subject: [PATCH] 平均耗时格式 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java | 67 +++++++++++++++++++++++++++++++-- 1 files changed, 63 insertions(+), 4 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 bcb902b..e9fa6ce 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 @@ -4,14 +4,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.vos.community.ComActActivityVO; +import com.panzhihua.common.model.vos.community.CommunityActivitiesVO; +import com.panzhihua.common.model.vos.community.CommunityGovernanceTrendsVO; import com.panzhihua.common.model.vos.partybuilding.PageActivityMembersVO; +import com.panzhihua.common.model.vos.screen.CarouselInfoVO; import com.panzhihua.service_community.model.dos.ComActActivityDO; 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.Date; import java.util.List; +import java.util.Map; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -47,12 +52,19 @@ "count(if(s.is_volunteer=0,s.id,null))participant_now,\n"+ "a.participant_max,\n" + "a.sign_up_begin,\n" + - "a.sign_up_end\n" + + "a.sign_up_end,\n" + + "ca.name as communityName \n" + "FROM\n" + "com_act_activity a \n" + "join sys_user u on a.sponsor_id=u.user_id\n" + "left join com_act_act_sign s on a.id=s.activity_id \n"+ - " where a.community_id=#{comActActivityVO.communityId}" + + "left join com_act ca on a.community_id=ca.community_id \n"+ + " where 1=1 " + + + "<if test='comActActivityVO.choice == 0 '>" + + "AND a.community_id=#{comActActivityVO.communityId}\n" + + " </if> " + + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName.trim() != ""'>" + " and a.activity_name like concat(#{comActActivityVO.activityName},'%') \n" + " </if> " + @@ -63,10 +75,16 @@ "AND a.`status` in (3,4) \n" + " </if> " + "<if test='comActActivityVO.isApplets != null and comActActivityVO.isApplets ==1'>" + - "AND a.`status` != 1 \n" + + "AND a.`status` != 1 AND a.`status` != 6 \n" + " </if> " + "<if test='comActActivityVO.beginAt != null '>" + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt} \n" + + " </if> " + + "<if test='comActActivityVO.type != null and comActActivityVO.type==1 '>" + + "AND a.volunteer_max!=0 \n" + + " </if> " + + "<if test='comActActivityVO.type != null and comActActivityVO.type==2 '>" + + "AND a.participant_max!=0 \n" + " </if> " + " group by a.id "+ " order by a.status asc,a.publish_at desc "+ @@ -75,6 +93,7 @@ @Select("SELECT \n" + "u.name sponsorName,\n" + + "ca.name communityName,\n" + "count(if(s.is_volunteer=1,s.id,null))volunteer_now,\n"+ "count(if(s.is_volunteer=0,s.id,null))participant_now,\n"+ "a.* \n" + @@ -82,6 +101,7 @@ "com_act_activity a \n" + "join sys_user u on a.sponsor_id=u.user_id \n"+ "left join com_act_act_sign s on a.id=s.activity_id \n"+ + "left join com_act ca on a.community_id=ca.community_id \n"+ "where a.id=#{id} \n"+ " group by a.id " ) @@ -139,7 +159,7 @@ @Update("update com_act_activity set `status`=3 where `status`=2 and TIMESTAMPDIFF(MINUTE,SYSDATE(),sign_up_begin)<=0") int updateStatusToBeginSign(); - @Update("update com_act_activity set `status`=(if(DATEDIFF(SYSDATE(),end_at)>=0,5,4)) where `status` in (3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),sign_up_end)<=0") + @Update("update com_act_activity set `status`=5 where `status` in (3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),sign_up_end)<=0") int updateStatusToBeginActiveOrEnd(); @Select("<script> " + "select t.* from (\n" + @@ -214,4 +234,43 @@ @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 (\n" + + "SELECT\n" + + "(select COUNT(d.id) from com_act_discuss d where d.community_id=#{communityId})x1,\n" + + "(select COUNT(w.id) from com_act_micro_wish w where w.community_id=#{communityId})x2,\n" + + "(select COUNT(p.id) from com_act_easy_photo p where p.community_id=#{communityId})x3,\n" + + "\tCOUNT( a.id ) x4\n" + + "FROM\n" + + "\tcom_pb_activity a \n" + + "WHERE\n" + + "\t a.community_id =#{communityId})t") + String selectCommunityGovernanceTrendsVO(Long communityId); + @Select("\n" + + "\tSELECT\n" + + "\t(select COUNT(d.id) from com_act_discuss d where DATE_FORMAT(d.create_at,'%Y-%m-%d')=DATE_FORMAT(#{date},'%Y-%m-%d') and d.community_id=#{communityId})discuss,\n" + + "\t(select COUNT(w.id) from com_act_micro_wish w where DATE_FORMAT(w.create_at,'%Y-%m-%d')=DATE_FORMAT(#{date},'%Y-%m-%d') and w.community_id=#{communityId})microWish,\n" + + "\t(select COUNT(p.id) from com_act_easy_photo p where DATE_FORMAT(p.create_at,'%Y-%m-%d')=DATE_FORMAT(#{date},'%Y-%m-%d') and p.community_id=#{communityId})eashPhoto,\n" + + "\t(select COUNT(pa.id) from com_pb_activity pa where DATE_FORMAT(pa.create_at,'%Y-%m-%d')=DATE_FORMAT(#{date},'%Y-%m-%d') and pa.community_id=#{communityId})pbActivity,\n" + + "\t\tCOUNT( a.id ) actActivity\n" + + "\tFROM\n" + + "\t\tcom_pb_activity a \n" + + "\tWHERE\n" + + "\t\tDATE_FORMAT( a.create_at, '%Y-%m-%d' )=DATE_FORMAT(#{date},'%Y-%m-%d') \n" + + "\t\tAND a.community_id =#{communityId}") + CommunityActivitiesVO selectCommunityActivitiesVO(@Param("communityId") Long communityId, @Param("date")Date date); + + @Select("SELECT COUNT(id) AS currentNum," + + "(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 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.participant_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) AND create_at LIKE CONCAT(#{nowDate},'%') ") + Map<String, Long> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate")String nowDate); + + @Select("SELECT id,activity_name as content,IF(participant_max = 0,'志愿者活动','居民活动') AS typeName FROM com_act_activity " + + "WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) ORDER BY create_at DESC LIMIT #{pageSize}") + List<CarouselInfoVO> screenActivity(@Param("communityId")Long communityId, @Param("pageSize")Integer pageSize); + + @Select("SELECT cover FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5)") + List<String> listImg(@Param("communityId")Long communityId); } -- Gitblit v1.7.1