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
package com.panzhihua.service_community.dao;
 
import java.util.Map;
 
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import com.panzhihua.common.model.vos.screen.PbWorkVO;
 
/**
 * @author xyh
 * @date 2021/6/16 14:57
 */
@Mapper
public interface ComPbDynDAO {
 
    @Select("SELECT COUNT(id) AS activityNum ,"
        + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = ${communityId} AND STATUS = 2) AS dynNum," + "("
        + " (SELECT COUNT(id) FROM com_pb_activity WHERE community_id = ${communityId} AND (STATUS = 3 or STATUS = 4 or STATUS = 5 ) AND create_at LIKE CONCAT(#{nowDate},'%')) + "
        + " (SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = ${communityId} AND STATUS = 2 AND create_at LIKE CONCAT(#{nowDate},'%'))"
        + " ) AS currentNum "
        + " FROM com_pb_activity WHERE community_id = ${communityId} AND (STATUS = 3 or STATUS = 4 or STATUS = 5 )")
    Map<String, Long> countByCommunityId(@Param("communityId") Long communityId, @Param("nowDate") String nowDate);
 
    @Select("SELECT "
        + "(SELECT COUNT(id) FROM com_pb_activity WHERE community_id = ${communityId} AND (STATUS = 3 or STATUS = 4 or STATUS = 5 ) AND #{start} < create_at AND create_at < #{end}) AS activity,"
        + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = ${communityId} AND STATUS = 2 AND #{start} < create_at AND create_at < #{end}) AS dyn "
        + "FROM DUAL")
    PbWorkVO countByTime(@Param("start") String start, @Param("end") String end,
        @Param("communityId") Long communityId);
 
}