From d01be9f1ec9a393818ea64deca3cbe7fa9372e08 Mon Sep 17 00:00:00 2001 From: xyh <18782104331@139.com> Date: 星期三, 23 六月 2021 18:21:21 +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 | 349 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 206 insertions(+), 143 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 be9453f..6c2f255 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 @@ -3,9 +3,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenActActivityListDTO; 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.community.screen.work.ActActivityListVO; import com.panzhihua.common.model.vos.partybuilding.PageActivityMembersVO; import com.panzhihua.common.model.vos.screen.CarouselInfoVO; import com.panzhihua.service_community.model.dos.ComActActivityDO; @@ -37,84 +39,84 @@ // " </where>" + // "</script>") @Select("<script> " + - "SELECT \n" + - "a.id,\n" + - "a.activity_name,\n" + - "u.`name` sponsorName,\n" + - "a.activity_addr,\n" + - "a.`status`,\n" + - "a.publish_at,\n" + - "a.begin_at,\n" + - "a.cover,\n" + - "a.end_at,\n" + - "a.volunteer_max,\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.participant_max,\n" + - "a.sign_up_begin,\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"+ - "left join com_act ca on a.community_id=ca.community_id \n"+ + "SELECT " + + "a.id, " + + "a.activity_name, " + + "u.`name` sponsorName, " + + "a.activity_addr, " + + "a.`status`, " + + "a.publish_at, " + + "a.begin_at, " + + "a.cover, " + + "a.end_at, " + + "a.volunteer_max, " + + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, "+ + "count(if(s.is_volunteer=0,s.id,null))participant_now, "+ + "a.participant_max, " + + "a.sign_up_begin, " + + "a.sign_up_end, " + + "ca.name as communityName " + + "FROM " + + "com_act_activity a " + + "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 1=1 " + "<if test='comActActivityVO.choice == 0 '>" + - "AND a.community_id=#{comActActivityVO.communityId}\n" + + "AND a.community_id=#{comActActivityVO.communityId} " + " </if> " + "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName.trim() != ""'>" + - " and a.activity_name like concat(#{comActActivityVO.activityName},'%') \n" + + " and a.activity_name like concat(#{comActActivityVO.activityName},'%') " + " </if> " + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 and comActActivityVO.isIng==null'>" + - "AND a.`status` = #{comActActivityVO.status} \n" + + "AND a.`status` = #{comActActivityVO.status} " + " </if> " + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 and comActActivityVO.isIng!=null and comActActivityVO.isIng==1'>" + - "AND a.`status` in (3,4) \n" + + "AND a.`status` in (3,4) " + " </if> " + "<if test='comActActivityVO.isApplets != null and comActActivityVO.isApplets ==1'>" + - "AND a.`status` != 1 AND a.`status` != 6 \n" + + "AND a.`status` != 1 AND a.`status` != 6 " + " </if> " + "<if test='comActActivityVO.beginAt != null '>" + - "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt} \n" + + "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 \n" + + "AND a.volunteer_max!=0 " + " </if> " + "<if test='comActActivityVO.type != null and comActActivityVO.type==2 '>" + - "AND a.participant_max!=0 \n" + + "AND a.participant_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 \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" + - "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"+ - "left join com_act ca on a.community_id=ca.community_id \n"+ - "where a.id=#{id} \n"+ + @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 " + + "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\n" + - "a.* \n" + - "FROM\n" + - "com_act_act_sign s\n" + - "JOIN com_act_activity a ON s.activity_id = a.id \n" + - "WHERE\n" + - "s.user_id = #{comActActivityVO.sponsorId} \n" + - "ORDER BY\n" + + @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") IPage<ComActActivityVO> pageMyActivity(Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO); @@ -129,27 +131,27 @@ "join sys_user u on s.user_id=u.user_id and u.phone=#{phone} and s.is_volunteer=1 " + "join com_act_activity t on s.activity_id=t.id and t.status=5") List<ComActActivityVO> listActivityByPhone(String phone); - @Select("select t.id from (\n" + - "SELECT \n" + - "a.id,\n" + - "a.activity_name,\n" + - "COUNT(case when s.is_volunteer=1 then s.id else null end )volunteernum,\n" + - "COUNT(case when s.is_volunteer=0 then s.id else null end)usernum,\n" + - "a.participant_min,\n" + - "a.volunteer_min\n" + - "FROM\n" + - "com_act_activity a \n" + - "LEFT JOIN com_act_act_sign s on a.id=s.activity_id \n" + - "WHERE\n" + - "a.`status` in(3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),a.sign_up_end)<=0\n" + + @Select("select t.id from ( " + + "SELECT " + + "a.id, " + + "a.activity_name, " + + "COUNT(case when s.is_volunteer=1 then s.id else null end )volunteernum, " + + "COUNT(case when s.is_volunteer=0 then s.id else null end)usernum, " + + "a.participant_min, " + + "a.volunteer_min " + + "FROM " + + "com_act_activity a " + + "LEFT JOIN com_act_act_sign s on a.id=s.activity_id " + + "WHERE " + + "a.`status` in(3,4) and TIMESTAMPDIFF(MINUTE,SYSDATE(),a.sign_up_end)<=0 " + "GROUP BY a.id)t WHERE t.usernum<participant_min or t.volunteernum<volunteer_min") List<Long> selectTimedTaskActActivity(); @Update("<script> " + - "update com_act_activity set `status`=6 where id in\n" + - "<foreach item=\"item\" collection=\"longs\" separator=\",\" open=\"(\" close=\")\" index=\"\">\n"+ - "#{item}\n"+ - "</foreach>\n"+ + "update com_act_activity set `status`=6 where id in " + + "<foreach item=\"item\" collection=\"longs\" separator=\",\" open=\"(\" close=\")\" index=\"\"> "+ + "#{item} "+ + "</foreach> "+ "</script>") int updateIdBatch(@Param("longs") List<Long> longs); @@ -162,71 +164,71 @@ @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" + - "SELECT \n" + - "a.id,\n" + - "a.activity_name,\n" + - "u.`name` sponsorName,\n" + - "a.activity_addr,\n" + - "a.participant_max,\n" + - "count(if(s.is_volunteer=1,null,s.id))participant_now,\n"+ - "a.volunteer_max,\n" + - "count(if(s.is_volunteer=1,s.id,null))volunteer_now,\n"+ - "a.`status`,\n" + - "a.publish_at,\n" + - "a.begin_at,\n" + - "a.end_at,\n" + - "a.sign_up_begin,\n" + - "a.sign_up_end\n" + - "FROM\n" + - "\tcom_act_activity a \n" + - "\tLEFT JOIN sys_user u on a.sponsor_id=u.user_id\n" + - "\tLEFT JOIN com_act_act_sign s on a.id=s.activity_id\n" + - "WHERE\n" + - "\t a.`status` = 1 and a.community_id=#{comActActivityVO.communityId}\n" + + "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.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 !=""'>" + - "\tand a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' ) \n" + + " 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 \n" + + "AND a.`status` = 99 " + " </if> " + "<if test='comActActivityVO.beginAt != null '>" + - "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt} \n" + + "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt} " + " </if> " + - "group by a.id\n" + - "\t\n" + - "\tunion all\n" + - "select t1.* from (\n"+ - "\t\n" + - "\tSELECT \n" + - "a.id,\n" + - "a.activity_name,\n" + - "u.`name` sponsorName,\n" + - "a.activity_addr,\n" + - "a.participant_max,\n" + - "count(if(s.is_volunteer=1,null,s.id))participant_now,\n"+ - "a.volunteer_max,\n" + - "count(if(s.is_volunteer=1,s.id,null))volunteer_now,\n"+ - "a.`status`,\n" + - "a.publish_at,\n" + - "a.begin_at,\n" + - "a.end_at,\n" + - "a.sign_up_begin,\n" + - "a.sign_up_end\n" + - "FROM\n" + - "\tcom_act_activity a \n" + - "\tLEFT JOIN sys_user u on a.sponsor_id=u.user_id\n" + - "\tLEFT JOIN com_act_act_sign s on a.id=s.activity_id\n" + - "WHERE\n" + - "\t a.`status` != 1 and a.community_id=#{comActActivityVO.communityId}\n" + + "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.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 !=""'>" + - "\tand a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' ) \n" + + " and a.activity_name LIKE concat( #{comActActivityVO.activityName}, '%' ) " + " </if> " + "<if test='comActActivityVO.status != null and comActActivityVO.status !=0 '>" + - "AND a.`status` = #{comActActivityVO.status} \n" + + "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} \n" + + "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>") @@ -234,29 +236,29 @@ @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") + @Select("select GROUP_CONCAT(t.x1,',',t.x2,',',t.x3,',',t.x4) from ( " + + "SELECT " + + "(select COUNT(d.id) from com_act_discuss d where d.community_id=#{communityId})x1, " + + "(select COUNT(w.id) from com_act_micro_wish w where w.community_id=#{communityId})x2, " + + "(select COUNT(p.id) from com_act_easy_photo p where p.community_id=#{communityId})x3, " + + " COUNT( a.id ) x4 " + + "FROM " + + " com_pb_activity a " + + "WHERE " + + " 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}") + @Select(" " + + " SELECT " + + " (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, " + + " (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, " + + " (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, " + + " (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, " + + " COUNT( a.id ) actActivity " + + " FROM " + + " com_pb_activity a " + + " WHERE " + + " DATE_FORMAT( a.create_at, '%Y-%m-%d' )=DATE_FORMAT(#{date},'%Y-%m-%d') " + + " AND a.community_id =#{communityId}") CommunityActivitiesVO selectCommunityActivitiesVO(@Param("communityId") Long communityId, @Param("date")Date date); @Select("SELECT COUNT(id) AS totalNum," + @@ -274,4 +276,65 @@ @Select("SELECT cover FROM com_act_activity WHERE community_id = #{communityId}") List<String> listImg(@Param("communityId")Long communityId); + + @Select("<script> " + + "SELECT " + + " caa.id, " + + " su.`name` AS userName , " + + " su.image_url, " + + " caa.sponsor_id, " + + " caa.`status`, " + + " caa.create_at, " + + " caa.begin_at, " + + " caa.end_at, " + + " caa.sign_up_begin, " + + " caa.sign_up_end, " + + " caa.volunteer_min, " + + " caa.volunteer_max, " + + " caa.participant_min, " + + " caa.participant_max, " + + " caa.activity_name, " + + " caa.cover, " + + " caa.content, " + + " caa.activity_addr " + + "FROM " + + " com_act_activity AS caa " + + " LEFT JOIN sys_user AS su ON su.user_id = caa.sponsor_id" + + " <where> "+ + "<if test='actActivityListDTO.communityId != null '>" + + " and caa.community_id = #{actActivityListDTO.communityId} " + + " </if> " + + "<if test='actActivityListDTO.startTime!=null and actActivityListDTO.startTime != ""'>" + + " AND DATE_FORMAT(caa.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{actActivityListDTO.startTime} " + + " </if> " + + "<if test='actActivityListDTO.endTime!=null and actActivityListDTO.endTime != ""'>" + + " AND DATE_FORMAT(caa.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{actActivityListDTO.endTime} " + + " </if> " + + "<if test='actActivityListDTO.type!=null'>" + + " AND caa.type = #{actActivityListDTO.type} " + + " </if> " + + " </where> "+ + "ORDER BY " + + " caa.create_at DESC " + + " </script>") + IPage<ActActivityListVO> getScreenActActivityList(Page page, @Param("actActivityListDTO") ScreenActActivityListDTO actActivityListDTO); + + @Select("SELECT " + + " count( caas.id ) AS volunteerCount,( " + + " SELECT " + + " count( caas1.id ) " + + " FROM " + + " com_act_act_sign AS caas1 " + + " LEFT JOIN sys_user AS su1 ON su1.user_id = caas1.user_id " + + " WHERE " + + " su1.is_volunteer = 0 " + + " AND caas1.activity_id = #{activityId} " + + " ) AS participantCount " + + "FROM " + + " com_act_act_sign AS caas " + + " LEFT JOIN sys_user AS su ON su.user_id = caas.user_id " + + "WHERE " + + " su.is_volunteer = 1 " + + " AND activity_id = #{activityId} ") + ActActivityListVO getScreenActActivityPeopleCount(@Param("activityId") Long activityId); } -- Gitblit v1.7.1