| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | 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.neighbor.ComActNeighborCircleAdminDTO; |
| | | import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; |
| | | import com.panzhihua.common.model.vos.neighbor.*; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyAppVO; |
| | | import com.panzhihua.common.model.vos.screen.CarouselInfoVO; |
| | | import com.panzhihua.common.model.vos.screen.ComActNeighborCircleScreenVO; |
| | | import com.panzhihua.common.model.vos.screen.PieElementVO; |
| | | import com.panzhihua.common.model.vos.user.AdministratorsUserVO; |
| | | import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | @Mapper |
| | | public interface ComActNeighborCircleDAO extends BaseMapper<ComActNeighborCircleDO> { |
| | | |
| | | @Select("<script> " + |
| | | "SELECT " + |
| | | "canc.id," + |
| | | "canc.release_content," + |
| | | "canc.release_images," + |
| | | "canc.comment_num," + |
| | | "canc.fabulous_num," + |
| | | "canc.forward_num," + |
| | | "canc.views_num," + |
| | | "canc.is_boutique," + |
| | | "canc.create_at," + |
| | | "canc.reply_at," + |
| | | "canc.last_comment_num," + |
| | | "canc.last_fabulous_num," + |
| | | "canc.last_views_num," + |
| | | "canc.type," + |
| | | "canc.topic_id," + |
| | | "su.nick_name as name," + |
| | | "su.community_id," + |
| | | "canct.name as topicName," + |
| | | "su.image_url as headUrl " + |
| | | " FROM " + |
| | | " com_act_neighbor_circle AS canc" + |
| | | " left join sys_user as su on su.user_id = canc.release_id " + |
| | | " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id " + |
| | | " where canc.status = 2 and canc.community_id = #{neighborCircleAppDTO.communityId} " + |
| | | "<if test='neighborCircleAppDTO.topicId != null '>" + |
| | | " and canc.topic_id = #{neighborCircleAppDTO.topicId} " + |
| | | " </if> " + |
| | | "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 1'>" + |
| | | " order by (canc.last_views_num + canc.last_comment_num + canc.last_fabulous_num) desc " + |
| | | " </if> " + |
| | | "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 2'>" + |
| | | " order by canc.create_at desc " + |
| | | " </if> " + |
| | | "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 3'>" + |
| | | " order by (canc.views_num + canc.comment_num + canc.fabulous_num) desc " + |
| | | " </if> " + |
| | | " </script>") |
| | | IPage<ComActNeighborCircleAppVO> pageNeighborByApp(Page page, @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO); |
| | | @Select("<script> " + "SELECT " + "canc.id," + "canc.release_content," + "canc.release_images," |
| | | + "canc.comment_num," + "canc.fabulous_num," + "canc.forward_num," + "canc.views_num," + "canc.is_boutique," |
| | | + "canc.create_at," + "canc.reply_at," + "canc.last_comment_num," + "canc.last_fabulous_num," |
| | | + "canc.last_views_num," + "canc.type," + "canc.topic_id," + "su.nick_name as name," + "su.community_id," |
| | | + "canct.name as topicName," + "su.image_url as headUrl " + " FROM " + " com_act_neighbor_circle AS canc" |
| | | + " left join sys_user as su on su.user_id = canc.release_id " |
| | | + " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id " |
| | | + " where canc.status = 2 and canc.community_id = #{neighborCircleAppDTO.communityId} " |
| | | + "<if test='neighborCircleAppDTO.topicId != null '>" + " and canc.topic_id = #{neighborCircleAppDTO.topicId} " |
| | | + " </if> " + "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 1'>" |
| | | + " order by (canc.last_views_num + canc.last_comment_num + canc.last_fabulous_num) desc " + " </if> " |
| | | + "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 2'>" |
| | | + " order by canc.create_at desc " + " </if> " |
| | | + "<if test='neighborCircleAppDTO.type != null and neighborCircleAppDTO.type == 3'>" |
| | | + " order by (canc.views_num + canc.comment_num + canc.fabulous_num) desc " + " </if> " + " </script>") |
| | | IPage<ComActNeighborCircleAppVO> pageNeighborByApp(Page page, |
| | | @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO); |
| | | |
| | | @Select("<script> " + |
| | | "select canc.id,su.nick_name as name,su.image_url as headUrl,canc.release_content " + |
| | | ",canc.release_images,canc.comment_num,canc.fabulous_num,canc.forward_num,canc.views_num,canct.name as topicName " + |
| | | ",canc.is_boutique,canc.create_at,canc.reply_at,su.community_id,canc.type from com_act_neighbor_circle as canc " + |
| | | " left join sys_user as su on su.user_id = canc.release_id "+ |
| | | " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id where canc.id = #{circleId}" + |
| | | " </script>") |
| | | @Select("<script> " + "select canc.id,su.nick_name as name,su.image_url as headUrl,canc.release_content " |
| | | + ",canc.release_images,canc.comment_num,canc.fabulous_num,canc.forward_num,canc.views_num,canct.name as topicName " |
| | | + ",canc.is_boutique,canc.create_at,canc.reply_at,su.community_id,canc.type from com_act_neighbor_circle as canc " |
| | | + " left join sys_user as su on su.user_id = canc.release_id " |
| | | + " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id where canc.id = #{circleId}" |
| | | + " </script>") |
| | | ComActNeighborCircleDetailAppVO neighborDetailByApp(@Param("circleId") Long circleId); |
| | | @Select("<script> \n"+ |
| | | "SELECT\n" + |
| | | "nc.*,\n" + |
| | | "u.`nick_name` AS releaseName,u.image_url,canct.`name` as topicName ,u.`type` as userType\n" + |
| | | ",u.name as communityName\n" + |
| | | "FROM\n" + |
| | | "com_act_neighbor_circle nc\n" + |
| | | "LEFT JOIN sys_user u ON nc.release_id = u.user_id \n" + |
| | | "LEFT JOIN com_act_neighbor_circle_topic as canct ON canct.id = nc.topic_id \n" + |
| | | "<where>"+ |
| | | "nc.community_id = #{neighborCircleAdminDTO.communityId} \n"+ |
| | | "<if test='neighborCircleAdminDTO.releaseContent != null and neighborCircleAdminDTO.releaseContent != ""'>" + |
| | | "and nc.release_content like concat('%',#{neighborCircleAdminDTO.releaseContent},'%') \n" + |
| | | " </if> " + |
| | | "<if test='neighborCircleAdminDTO.topicName != null and neighborCircleAdminDTO.topicName != ""'>" + |
| | | "and canct.`name` = #{neighborCircleAdminDTO.topicName} " + |
| | | " </if> " + |
| | | "<if test='neighborCircleAdminDTO.startAt != null and neighborCircleAdminDTO.endAt !=null '>" + |
| | | "and nc.create_at between #{neighborCircleAdminDTO.startAt} and #{neighborCircleAdminDTO.endAt} \n" + |
| | | " </if> " + |
| | | "<if test='neighborCircleAdminDTO.status != null '>" + |
| | | "and nc.status = #{neighborCircleAdminDTO.status} \n" + |
| | | " </if> " + |
| | | "</where>"+ |
| | | "order by " + |
| | | "case when nc.`status`=1 then 0 else 1 end, \n" + |
| | | "nc.`status` asc,nc.create_at desc " + |
| | | "</script>") |
| | | IPage<ComActNeighborCircleAdminVO> pageNeighborByAdmin(Page page,@Param("neighborCircleAdminDTO") ComActNeighborCircleAdminDTO neighborCircleAdminDTO); |
| | | |
| | | @Select("<script> \n" + "SELECT\n" + "nc.*,\n" |
| | | + "u.`nick_name` AS releaseName,u.image_url,canct.`name` as topicName ,u.`type` as userType\n" |
| | | + ",u.name as communityName\n" + "FROM\n" + "com_act_neighbor_circle nc\n" |
| | | + "LEFT JOIN sys_user u ON nc.release_id = u.user_id \n" |
| | | + "LEFT JOIN com_act_neighbor_circle_topic as canct ON canct.id = nc.topic_id \n" + "<where>" |
| | | + "nc.community_id = #{neighborCircleAdminDTO.communityId} \n" |
| | | + "<if test='neighborCircleAdminDTO.releaseContent != null and neighborCircleAdminDTO.releaseContent != ""'>" |
| | | + "and nc.release_content like concat('%',#{neighborCircleAdminDTO.releaseContent},'%') \n" + " </if> " |
| | | + "<if test='neighborCircleAdminDTO.topicName != null and neighborCircleAdminDTO.topicName != ""'>" |
| | | + "and canct.`name` = #{neighborCircleAdminDTO.topicName} " + " </if> " |
| | | + "<if test='neighborCircleAdminDTO.startAt != null and neighborCircleAdminDTO.endAt !=null '>" |
| | | + "and nc.create_at between #{neighborCircleAdminDTO.startAt} and #{neighborCircleAdminDTO.endAt} \n" |
| | | + " </if> " + "<if test='neighborCircleAdminDTO.status != null '>" |
| | | + "and nc.status = #{neighborCircleAdminDTO.status} \n" + " </if> " + "</where>" + "order by " |
| | | + "case when nc.`status`=1 then 0 else 1 end, \n" + "nc.`status` asc,nc.create_at desc " + "</script>") |
| | | IPage<ComActNeighborCircleAdminVO> pageNeighborByAdmin(Page page, |
| | | @Param("neighborCircleAdminDTO") ComActNeighborCircleAdminDTO neighborCircleAdminDTO); |
| | | |
| | | @Select("select * from sys_user where user_id=#{userId}") |
| | | AdministratorsUserVO selectUserByUserId(@Param("userId") Long userId); |
| | | |
| | | @Select("<script> " + |
| | | "select canc.id,canc.release_content,canc.release_images,canc.status,canc.create_at,canct.name as topicName" + |
| | | ",canc.comment_num,canc.fabulous_num,canc.forward_num,canc.views_num,canc.refuse_reason,su.nick_name as name,su.image_url as headUrl " + |
| | | " from com_act_neighbor_circle as canc " + |
| | | " left join sys_user as su on su.user_id = canc.release_id " + |
| | | " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id " + |
| | | " where canc.release_id = #{userId} and canc.status != 3 order by create_at desc" + |
| | | " </script>") |
| | | IPage<ComActNeighborCircleAppVO> neighborExamineByApp(Page page,@Param("userId") Long userId); |
| | | @Select("<script> " |
| | | + "select canc.id,canc.release_content,canc.release_images,canc.status,canc.create_at,canct.name as topicName" |
| | | + ",canc.comment_num,canc.fabulous_num,canc.forward_num,canc.views_num,canc.refuse_reason,su.nick_name as name,su.image_url as headUrl " |
| | | + " from com_act_neighbor_circle as canc " + " left join sys_user as su on su.user_id = canc.release_id " |
| | | + " left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id " |
| | | + " where canc.release_id = #{userId} and canc.status != 3 order by create_at desc" + " </script>") |
| | | IPage<ComActNeighborCircleAppVO> neighborExamineByApp(Page page, @Param("userId") Long userId); |
| | | |
| | | @Select("select reply.id,reply.comment_id,reply.reply_content,reply.fabulous_num,reply.create_at" + |
| | | ",reply.is_release,su.nick_name as userName,su.image_url as userHeadUrl,su1.nick_name as oldUserName" + |
| | | " from com_act_neighbor_circle_comment_reply as reply" + |
| | | " left join sys_user as su on su.user_id = reply.user_id" + |
| | | " left join sys_user as su1 on su1.user_id = reply.parent_user_id" + |
| | | " where reply.comment_id = #{commentId} and reply.status = 1") |
| | | @Select("select reply.id,reply.comment_id,reply.reply_content,reply.fabulous_num,reply.create_at" |
| | | + ",reply.is_release,su.nick_name as userName,su.image_url as userHeadUrl,su1.nick_name as oldUserName" |
| | | + " from com_act_neighbor_circle_comment_reply as reply" |
| | | + " left join sys_user as su on su.user_id = reply.user_id" |
| | | + " left join sys_user as su1 on su1.user_id = reply.parent_user_id" |
| | | + " where reply.comment_id = #{commentId} and reply.status = 1") |
| | | IPage<ComActNeighborCommentReplyAppVO> neighborCommentReplyByApp(Page page, @Param("commentId") Long commentId); |
| | | |
| | | @Select("SELECT id,release_content as content FROM com_act_neighbor_circle WHERE community_id =#{communityId} and status = 2 ORDER BY create_at DESC limit #{pageSize}") |
| | | List<CarouselInfoVO> screenNeighborCircle(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | List<CarouselInfoVO> screenNeighborCircle(@Param("communityId") Long communityId, |
| | | @Param("pageSize") Integer pageSize); |
| | | |
| | | @Select(" SELECT COUNT(id) AS totalNum," + |
| | | " (SELECT COUNT(id) FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2 AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " + |
| | | " FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2") |
| | | Map<String, Long> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate")String nowDate); |
| | | @Select(" SELECT COUNT(id) AS totalNum," |
| | | + " (SELECT COUNT(id) FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2 AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " |
| | | + " FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2") |
| | | Map<String, Long> countByCommunityId(@Param("communityId") Long communityId, @Param("nowDate") String nowDate); |
| | | |
| | | @Select("SELECT SUM(comment_num) as commentNum,SUM(fabulous_num) as fabulousNum,SUM(forward_num) as forwardNum FROM com_act_neighbor_circle WHERE community_id = #{communityId} and status = 2 ") |
| | | Map<String, Object> sumScreenNum(@Param("communityId")Long communityId); |
| | | Map<String, Object> sumScreenNum(@Param("communityId") Long communityId); |
| | | |
| | | @Select("SELECT release_images FROM com_act_neighbor_circle WHERE community_id = #{communityId} and status = 2 order by create_at desc limit #{pageSize}") |
| | | List<String> screenNeighborCircleImgs(@Param("communityId") Long communityId,@Param("pageSize") Integer pageSize); |
| | | List<String> screenNeighborCircleImgs(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | |
| | | @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND STATUS = 4 " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND STATUS = 6 " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 2 " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT( e.id ) AS num,'网格事件' AS name FROM `event` as e left join event_grid_data as egd on egd.id = e.grid_id WHERE egd.grid_community_id = #{communityId} AND e.event_process_status = 2 " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND STATUS = 5 ") |
| | | List<PieElementVO> countAllCompletedWorkByCommunityId(@Param("communityId")Long communityId); |
| | | @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND STATUS = 4 " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND STATUS = 6 " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 2 " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT( e.id ) AS num,'网格事件' AS name FROM `event` as e left join event_grid_data as egd on egd.id = e.grid_id WHERE egd.grid_community_id = #{communityId} AND e.event_process_status = 2 " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND STATUS = 5 ") |
| | | List<PieElementVO> countAllCompletedWorkByCommunityId(@Param("communityId") Long communityId); |
| | | |
| | | @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2) " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 1 " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT( e.id ) AS num,'网格事件' AS NAME FROM `event` as e left join event_grid_data as egd on egd.id = e.grid_id WHERE egd.grid_community_id = #{communityId} AND e.event_status = 2 and e.event_deal_status in (1,2,3) " + |
| | | "UNION ALL " + |
| | | "SELECT COUNT(id),'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) ") |
| | | List<PieElementVO> countAllNoneCompletedWorkByCommunityId(@Param("communityId")Long communityId); |
| | | @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2) " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 1 " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT( e.id ) AS num,'网格事件' AS NAME FROM `event` as e left join event_grid_data as egd on egd.id = e.grid_id WHERE egd.grid_community_id = #{communityId} AND e.event_status = 2 and e.event_deal_status in (1,2,3) " |
| | | + "UNION ALL " |
| | | + "SELECT COUNT(id),'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) ") |
| | | List<PieElementVO> countAllNoneCompletedWorkByCommunityId(@Param("communityId") Long communityId); |
| | | |
| | | @Select(" SELECT AVG(b.t)AS avgTime " + |
| | | " FROM (SELECT TIMESTAMPDIFF(MINUTE,create_at,feedback_at) AS t FROM com_act_easy_photo WHERE community_id = #{communityId} and STATUS = 4 " + |
| | | " UNION ALL SELECT TIMESTAMPDIFF(MINUTE,create_at,finish_at) AS t FROM com_act_micro_wish WHERE community_id = #{communityId} and STATUS = 6 " + |
| | | " )AS b ") |
| | | Map<String, Object> countAvgByCommunityId(@Param("communityId")Long communityId); |
| | | @Select(" SELECT AVG(b.t)AS avgTime " |
| | | + " FROM (SELECT TIMESTAMPDIFF(MINUTE,create_at,feedback_at) AS t FROM com_act_easy_photo WHERE community_id = #{communityId} and STATUS = 4 " |
| | | + " UNION ALL SELECT TIMESTAMPDIFF(MINUTE,create_at,finish_at) AS t FROM com_act_micro_wish WHERE community_id = #{communityId} and STATUS = 6 " |
| | | + " )AS b ") |
| | | Map<String, Object> countAvgByCommunityId(@Param("communityId") Long communityId); |
| | | } |