mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
package com.panzhihua.service_community.dao;
 
import java.util.List;
import java.util.Map;
 
import com.panzhihua.common.model.dtos.PageBaseDTO;
import com.panzhihua.common.model.vos.community.StatisticsCommVO;
import com.panzhihua.common.model.vos.neighbor.*;
import com.panzhihua.service_community.entity.NewFightNeedProblemClaim;
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.screen.CarouselInfoVO;
import com.panzhihua.common.model.vos.screen.PieElementVO;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO;
 
/**
 * @auther lyq
 * @create 2021-04-28 09:20:49
 * @describe 邻里圈表mapper类
 */
@Mapper
public interface ComActNeighborCircleDAO extends BaseMapper<ComActNeighborCircleDO> {
 
 
    /**
     * 分页查询邻里圈列表
     * @param neighborCircleAppDTO  请求参数
     * @return  邻里圈列表
     */
    IPage<ComActNeighborCircleAppVO> pageNeighborByApp(Page page, @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO);
 
    /**
     * 分页查询邻里圈列表
     * @param neighborCircleAppDTO  请求参数
     * @return  邻里圈列表
     */
    IPage<ComActNeighborCircleAppVO> selectSolve(Page page, @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO);
 
    ComActNeighborCircleDetailAppVO neighborDetailByApp(@Param("circleId") Long circleId);
 
 
    IPage<ComActNeighborCircleAdminVO> pageNeighborByAdmin(Page page,@Param("neighborCircleAdminDTO") ComActNeighborCircleAdminDTO neighborCircleAdminDTO);
 
    /**
     * 大屏清单查询
     * @param page
     * @param neighborCircleAdminDTO
     * @return
     */
    IPage<ComActNeighborCircleAdminVO> pageNeighborByBigScreen(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.is_del = 2 and canc.belong_type = #{belongType} and canc.status != 3 order by create_at desc" + " </script>")
    IPage<ComActNeighborCircleAppVO> neighborExamineByApp(Page page, @Param("userId") Long userId,@Param("belongType") Integer belongType);
 
    @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 belong_type = 1 and status = 2 ORDER BY create_at DESC limit #{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 belong_type = 1 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 belong_type = 1 and status = 2 ")
    Map<String, Object> sumScreenNum(@Param("communityId") Long communityId);
 
    @Select("SELECT release_images FROM com_act_neighbor_circle WHERE  community_id = ${communityId} and belong_type = 1 and status = 2 order by create_at desc limit #{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 and belong_type = 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_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 and belong_type = 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);
 
    void addHotNum(@Param("circleId") Long circleId,@Param("hotNum") Long hotNum);
 
    void addTopicHotNum(@Param("circleId") Long circleId,@Param("hotNum") Long hotNum);
 
    /**
     * 获取大屏邻里圈展示图片
     * @param communityId
     * @param pageSize
     * @return
     */
    List<String> getAllImages(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize);
 
    /**
     * 获取大屏邻里圈展示文本内容
     * @param communityId
     * @param pageSize
     * @return
     */
    List<String> getContents(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize);
 
    List<StatisticsCommVO> getIndexNeighborBaseData(@Param("communityId") Long communityId);
 
    List<StatisticsCommVO> getNeighborAddPolylineData(@Param("communityId") Long communityId);
 
    StatisticsCommVO getNeighborTotalPolylineDate(@Param("communityId") Long communityId, @Param("date") String date);
 
    IPage<ComActNeighborCircleAdminVO> indexNeighborList(@Param("page") Page page, @Param("pageBaseDTO") PageBaseDTO pageBaseDTO);
 
    ServiceStaticsVO selectStatsCheckUnit(@Param("checkUnitId") Long checkUnitId,@Param("date")String date);
 
    ServiceStaticsVO selectStatsUser(@Param("phone") String phone,@Param("checkUnitId")String checkUnitId, @Param("date")String date);
 
    List<ComActNeighborCircleAppVO> selectListByCheckUnitId(@Param("checkUnitId")Long checkUnitId,@Param("date")String date);
 
    List<ComActNeighborCircleAppVO> selectListByPhone(@Param("phone")String phone,@Param("date")String date);
 
    /**
     * 单位服务统计
     */
    List<UnitActivityAnalysisVO> institutionalUnitServiceAnalysis(@Param("beginTime") String beginTime,
                                                                  @Param("endTime") String endTIme,
                                                                  @Param("belongTo") String belongTo,
                                                                  @Param("communityId") Long communityId,
                                                                  @Param("unitId") Long unitId);
 
    List<UnitActivityAnalysisVO> getNewTaskList(@Param("beginTime") String beginTime,
                                                @Param("endTime") String endTIme,
                                                @Param("belongTo") String belongTo,
                                                @Param("communityId") Long communityId);
 
    List<UnitActivityAnalysisVO> institutionalUnitActivityAnalysis(@Param("beginTime") String beginTime,
                                                                   @Param("endTime") String endTIme,
                                                                   @Param("belongTo") String belongTo,
                                                                   @Param("communityId") Long communityId,
                                                                   @Param("unitId") Long unitId);
 
    List<PartyMemberAnalysisVO> getNewPartyMemberTaskList(@Param("beginTime") String beginTime,
                                                            @Param("endTime") String endTIme,
                                                            @Param("belongTo") String belongTo,
                                                            @Param("communityId") Long communityId,
                                                            @Param("unitId") Long unitId,
                                                            @Param("searchContent") String searchContent
                                                            );
    List<PartyMemberAnalysisVO> institutionalPartyMemberServiceAnalysis(@Param("beginTime") String beginTime,
                                                                        @Param("endTime") String endTIme,
                                                                        @Param("belongTo") String belongTo,
                                                                        @Param("communityId") Long communityId,
                                                                        @Param("unitId") Long unitId,
                                                                        @Param("searchContent") String searchContent
                                                                        );
    List<PartyMemberAnalysisVO> institutionalPartyMemberActAnalysis(@Param("beginTime") String beginTime,
                                                                    @Param("endTime") String endTIme,
                                                                    @Param("belongTo") String belongTo,
                                                                    @Param("communityId") Long communityId,
                                                                    @Param("unitId") Long unitId,
                                                                    @Param("searchContent") String searchContent);
    List<PartyMemberAnalysisVO> institutionalPartyMemberServiceAnalysisByServicesTimes(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("belongTo") String belongTo);
 
    /**
     * 查询我的问题数量
     * @param type
     * @param phone
     * @return
     */
    Integer selectCount(@Param("type") Integer type,@Param("phone") String phone,@Param("communityId") Long communityId);
 
    /**
     * 分页查询可关联清单列表
     * @param neighborCircleAppDTO
     * @return
     */
    IPage<ComActNeighborCircleAppVO> pageRelationList(@Param("userPage") Page userPage, @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO);
 
    /**
     * 单位获取服务明细
     * @param checkUnitId
     * @param date
     * @param serviceType
     * @return
     */
    List<ServiceDetailStaticsVO> selectServiceDetailList(@Param("checkUnitId") Long checkUnitId, @Param("date") String date, @Param("serviceType") Integer serviceType);
 
    /**
     * 个人获取服务明细
     * @param checkUnitId
     * @param phone
     * @param date
     * @param serviceType
     * @return
     */
    List<ServiceDetailStaticsVO> selectServiceDetailListForPersonal(@Param("checkUnitId") Long checkUnitId, @Param("phone") String phone, @Param("date") String date, @Param("serviceType") Integer serviceType);
 
 
    /**
     * 根据手机好查询用户完成清单任务
     * @param phone
     * @return
     */
    List<NewFightNeedProblemClaim> getNewServiceNum(@Param("phone") String phone,@Param("unitId") String unitId);
 
 
}