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
<?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.ComActActRegistDAO">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActRegistDO">
                <id column="id" property="id" />
                <result column="activity_id" property="activityId" />
                <result column="user_id" property="userId" />
                <result column="create_at" property="createAt" />
                <result column="sign_identity" property="signIdentity" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, activity_id, user_id, create_at, sign_identity
    </sql>
 
    <select id="pageActivityRegists" resultType="com.panzhihua.common.model.vos.community.ComActActRegistVO">
        SELECT
        caar.id,
        caar.activity_id,
        caar.start_time,
        caar.end_time,
        caar.create_at,
        caar.position,
        caar.times,
        caar.award,
        su.user_id,
        su.`name`,
        su.nick_name,
        su.phone,
        su.image_url,
        su.tags,
        caar.sign_identity AS identity,
        t.duration
 
        FROM
        com_act_act_regist caar
        LEFT JOIN sys_user su ON caar.user_id = su.user_id
        LEFT JOIN com_act_activity t on caar.activity_id = t.id
        where caar.activity_id = #{comActActRegistVO.activityId}
        <if test="comActActRegistVO.phone != null and comActActRegistVO.phone !=''">
            AND su.phone = #{comActActRegistVO.phone}
        </if>
        <if test="comActActRegistVO.name != null and comActActRegistVO.name !=''">
            AND su.`name` = #{comActActRegistVO.name}
        </if>
        <if test="comActActRegistVO.tags != null and comActActRegistVO.tags !=''">
            AND su.tags like concat ('%', #{comActActRegistVO.tags}, '%')
        </if>
        <if test="comActActRegistVO.createAt != null">
            AND caar.create_at = #{comActActRegistVO.createAt}
        </if>
        <if test="comActActRegistVO.startTime != null">
            AND caar.create_at &gt;= #{comActActRegistVO.startTime}
        </if>
        <if test="comActActRegistVO.endTime != null">
            AND caar.create_at &lt;= #{comActActRegistVO.endTime}
        </if>
        <if test="comActActRegistVO.type != null">
            AND caar.type = #{comActActRegistVO.type}
        </if>
        order by caar.create_at desc
    </select>
 
    <select id="getRegistLists" resultType="com.panzhihua.common.model.vos.community.ComActActRegistExcelVO">
        SELECT
        caar.create_at,
        caar.start_time,
        caar.end_time,
        caar.position,
        caar.times,
        caar.award,
        su.`name`,
        su.phone,
        su.tags,
        caar.sign_identity AS identity
        FROM
        com_act_act_regist caar
        LEFT JOIN sys_user su ON caar.user_id = su.user_id
        left join com_act_activity t on caar.activity_id = t.id
        where caar.activity_id = #{comActActRegistVO.activityId}
        <if test="comActActRegistVO.phone != null and comActActRegistVO.phone !=''">
            AND su.phone = #{comActActRegistVO.phone}
        </if>
        <if test="comActActRegistVO.name != null and comActActRegistVO.name !=''">
            AND su.`name` = #{comActActRegistVO.name}
        </if>
        <if test="comActActRegistVO.tags != null and comActActRegistVO.tags !=''">
            AND su.tags like ('%', #{comActActRegistVO.tags}, '%')
        </if>
        <if test="comActActRegistVO.createAt != null">
            AND caar.create_at = #{comActActRegistVO.createAt}
        </if>
        <if test="comActActRegistVO.type != null">
            AND caar.type = #{comActActRegistVO.type}
        </if>
        order by caar.create_at desc
    </select>
 
    <select id="getNoRegistLists" resultType="com.panzhihua.common.model.vos.community.ComActActRegistExcelVO">
        SELECT
            caas.create_at,
            caar.positon,
            caar.times,
            caar.award,
            su.`name`
            su.phone,
            su.tags,
            caas.sign_identity AS identity
        FROM
        (SELECT * FROM com_act_act_sign WHERE `status` = 1) caas
        LEFT JOIN sys_user su ON caas.user_id = su.user_id
        WHERE NOT EXISTS ( SELECT 1 FROM com_act_act_regist caar WHERE caas.user_id = caar.user_id )
        AND caas.activity_id = #{comActActRegistVO.activityId}
        <if test="comActActRegistVO.phone != null and comActActRegistVO.phone !=''">
            AND su.phone = #{comActActRegistVO.phone}
        </if>
        <if test="comActActRegistVO.name != null and comActActRegistVO.name !=''">
            AND su.`name` = #{comActActRegistVO.name}
        </if>
        <if test="comActActRegistVO.tags != null and comActActRegistVO.tags !=''">
            AND su.tags like ('%', #{comActActRegistVO.tags}, '%')
        </if>
        <if test="comActActRegistVO.createAt != null">
            AND caar.create_at = #{comActActRegistVO.createAt}
        </if>
        <if test="comActActRegistVO.type != null">
            AND caar.type = #{comActActRegistVO.type}
        </if>
    </select>
    <select id="listRegistRecord" resultType="com.panzhihua.common.model.vos.community.ComActActRegistVO">
        SELECT
            caar.id,
            caar.activity_id,
            caar.create_at,
            caar.position,
            caar.times,
            caar.award,
            su.user_id,
            su.`name`,
            su.nick_name,
            su.phone,
            su.image_url,
            su.tags,
            caar.sign_identity,
            t.duration,
            t.status,
            caar.start_time,
            caar.end_time
 
        FROM
            com_act_act_regist caar
            LEFT JOIN sys_user su ON caar.user_id = su.user_id
            LEFT JOIN com_act_activity t on caar.activity_id = t.id
        WHERE caar.activity_id = #{id} AND caar.user_id = #{userId} ORDER BY caar.id DESC
    </select>
    <select id="selectTotalAwardWithRegist" resultType="java.lang.Integer">
        SELECT SUM(award) FROM com_act_act_regist WHERE activity_id = #{activityId} AND user_id = #{userId} AND `type` = 1
    </select>
 
 
 
 
    <select id="getDetails" resultType="com.panzhihua.service_community.entity.JinhuiCoinGeneralTable">
        select
            id,
            user_id,
            gold_coin,
            creation_time,
            update_time,
            community_id
        from jinhui_coin_general_table
        where
            user_id=#{userId}
    </select>
 
 
 
    <select id="getNotTimeActivityList" resultType="String">
        select activity_id from com_act_act_regist where end_time is null group by activity_id
    </select>
 
 
    <!--  根据活动id获取没有签退的人员  -->
    <select id="getNotTimeUser" resultType="com.panzhihua.common.model.vos.community.ComActActRegistVO">
        select id,start_time from com_act_act_regist where end_time is null and activity_id =#{activityId}
    </select>
 
 
    <select id="getActivityEndTime" resultType="com.panzhihua.service_community.model.dos.ComActActivityDO">
        select id,end_at from com_act_activity where id=#{activityId}
    </select>
 
 
    <update id="updateEndTime">
        update com_act_act_regist
        set end_time=#{data}
        where id = #{id}
    </update>
 
 
 
</mapper>