101captain
2021-12-23 5a8a90c095280fbd2106869ecd2bad10e01a57a6
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.panzhihua.service_community.dao.ComActActivityDAO">
 
        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActivityDO">
                    <id column="id" property="id" />
                    <result column="activity_name" property="activityName" />
                    <result column="sponsor_id" property="sponsorId" />
                    <result column="activity_addr" property="activityAddr" />
                    <result column="lat" property="lat" />
                    <result column="lng" property="lng" />
                    <result column="status" property="status" />
                    <result column="publish_at" property="publishAt" />
                    <result column="end_at" property="endAt" />
                    <result column="begin_at" property="beginAt" />
                    <result column="sign_up_begin" property="signUpBegin" />
                    <result column="sign_up_end" property="signUpEnd" />
                    <result column="aattend_people" property="aattendPeople" />
                    <result column="volunteer_min" property="volunteerMin" />
                    <result column="volunteer_max" property="volunteerMax" />
                    <result column="participant_min" property="participantMin" />
                    <result column="participant_max" property="participantMax" />
                    <result column="cover" property="cover" />
                    <result column="has_prize" property="hasPrize" />
                    <result column="is_qr_code" property="isQrCode" />
                    <result column="contact_name" property="contactName" />
                    <result column="contact_phone" property="contactPhone" />
                    <result column="is_regist" property="isRegist" />
                    <result column="is_top" property="isTop" />
                    <result column="prize_remark" property="prizeRemark" />
                    <result column="reward_desc" property="rewardDesc" />
                    <result column="content" property="content" />
                    <result column="community_id" property="communityId" />
                    <result column="create_at" property="createAt" />
                    <result column="cancel_reason" property="cancelReason" />
        </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, activity_name, sponsor_id, activity_addr, lat, lng, status, publish_at, end_at, begin_at, sign_up_begin, sign_up_end, aattend_people, volunteer_min, volunteer_max, participant_min, participant_max, cover, has_prize, is_qr_code, contact_name, contact_phone, is_regist, is_top, prize_remark, reward_desc, content, community_id, create_at, cancel_reason
    </sql>
 
    <select id="activityStatistics" resultType="com.panzhihua.common.model.vos.community.ComActActivityStatisticsVO">
        SELECT IFNULL(volunteer_max,0) + IFNULL(participant_max,0) as signTotal
             ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as reallySignTotal
             ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as registTotal
             ,(SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId}) as reallyRegistTotal
             ,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) - (SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId})) as noRegistTotal
             ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as evaluateTotal
             ,(SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId}) as reallyEvaluateTotal
             ,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) - (SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId})) as noEvaluateTotal
        FROM com_act_activity where id = #{activityId}
    </select>
    <select id="getIndexTopActivityList" resultMap="BaseResultMap">
        SELECT * FROM `com_act_activity`
        WHERE community_id = #{communityId} and is_top = 1 and sign_up_end &gt;= now()
    </select>
</mapper>