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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.panzhihua.service_dangjian.dao.NeedProblemClaimDAO">
 
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,
        task_id,
        user_id,
        punch_start_time,
        punch_end_time,
        service_time,
        unit_id,
        creation_time,
        update_time
    </sql>
 
 
    <select id="getList" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemClaimDTO">
        SELECT
            nfnpc.id,
            nfnpc.task_id,
            nfnpc.user_id,
            su.name as userName,
            su.image_url as userImage,
            nfnpc.punch_start_time,
            nfnpc.punch_end_time,
            nfnpc.service_time,
            nfnpc.unit_id,
            nfnpc.creation_time,
            nfnpc.update_time
        FROM
            new_fight_need_problem_claim as nfnpc
        LEFT JOIN sys_user as su ON su.user_id=nfnpc.user_id
        <where>
            1=1
            <if test="taskId !=null and taskId != '' ">
                and nfnpc.task_id =#{taskId}
            </if>
            <if test="userId !=null and userId != '' ">
                and nfnpc.user_id =#{userId}
            </if>
            <if test="unitId !=null and unitId != '' ">
                and nfnpc.unit_id =#{unitId}
            </if>
        </where>
    </select>
 
 
    <select id="getDetails" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemClaimDTO">
        SELECT
            nfnpc.id,
            nfnpc.task_id,
            nfnpc.user_id,
            su.name as userName,
            su.image_url as userImage,
            nfnpc.punch_start_time,
            nfnpc.punch_end_time,
            nfnpc.service_time,
            nfnpc.unit_id,
            nfnpc.creation_time,
            nfnpc.update_time
        FROM
        new_fight_need_problem_claim as nfnpc
        LEFT JOIN sys_user as su ON su.user_id=nfnpc.user_id
        <where>
            1=1
            <if test="id !=null and id != '' ">
                and nfnpc.id =#{id}
            </if>
            <if test="taskId !=null and taskId != '' ">
                and nfnpc.task_id =#{taskId}
            </if>
            <if test="userId !=null and userId != '' ">
                and nfnpc.user_id =#{userId}
            </if>
        </where>
    </select>
 
 
 
    <select id="getUserIdDetails" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemClaimDTO">
        SELECT
            nfnpc.id,
            nfnpc.task_id,
            nfnpc.user_id,
            su.name as userName,
            su.image_url as userImage,
            nfnpc.punch_start_time,
            nfnpc.punch_end_time,
            nfnpc.service_time,
            nfnpc.unit_id,
            nfnpc.creation_time,
            nfnpc.update_time
        FROM
        new_fight_need_problem_claim as nfnpc
        LEFT JOIN sys_user as su ON su.user_id=nfnpc.user_id
        <where>
            1=1
            <if test="taskId !=null and taskId != '' ">
                and nfnpc.task_id =#{taskId}
            </if>
            <if test="userId !=null and userId != '' ">
                and nfnpc.user_id =#{userId}
            </if>
        </where>
        LIMIT 1
    </select>
 
 
    <insert id="addData">
        insert into new_fight_need_problem_claim
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null" >
                id,
            </if>
            <if test="item.taskId != null  and item.taskId != '' " >
                task_id,
            </if>
            <if test="item.userId != null  and item.userId != '' " >
                user_id,
            </if>
            <if test="item.punchStartTime != null" >
                punch_start_time,
            </if>
            <if test="item.punchEndTime != null" >
                punch_end_time,
            </if>
            <if test="item.serviceTime != null and item.serviceTime != '' " >
                service_time,
            </if>
            <if test="item.unitId !=null and item.unitId != '' ">
                unit_id,
            </if>
 
            creation_time
        </trim>
        values
        <trim prefix="("  suffix=")" suffixOverrides=",">
            <if test="item.id != null" >
                #{item.id},
            </if>
            <if test="item.taskId != null  and item.taskId != '' " >
                #{item.taskId},
            </if>
            <if test="item.userId != null  and item.userId != '' " >
                #{item.userId},
            </if>
            <if test="item.punchStartTime != null" >
                #{item.punchStartTime},
            </if>
            <if test="item.punchEndTime != null" >
                #{item.punchEndTime},
            </if>
            <if test="item.serviceTime != null and item.serviceTime != '' " >
                #{item.serviceTime},
            </if>
            <if test="item.unitId !=null and item.unitId != '' ">
                #{item.unitId},
            </if>
 
            sysdate()
        </trim>
    </insert>
 
    <update id="editData">
        update new_fight_need_problem_claim
        <set>
            <if test="item.id != null" >
                id=#{item.id},
            </if>
            <if test="item.taskId != null  and item.taskId != '' " >
                task_id=#{item.taskId},
            </if>
            <if test="item.userId != null  and item.userId != '' " >
                user_id=#{item.userId},
            </if>
            <if test="item.punchStartTime != null" >
                punch_start_time=#{item.punchStartTime},
            </if>
            <if test="item.punchEndTime != null" >
                punch_end_time=#{item.punchEndTime},
            </if>
            <if test="item.serviceTime != null and item.serviceTime != '' " >
                service_time=#{item.serviceTime},
            </if>
            <if test="item.unitId !=null and item.unitId != '' ">
                unit_id=#{item.unitId},
            </if>
            update_time=sysdate()
        </set>
        <where>
            1=1
            <if test="item.id!=null and item.id != '' ">
                and id = #{item.id}
            </if>
            <if test="item.userId !=null and item.userId != '' ">
                and user_id=#{item.userId}
            </if>
            <if test="item.taskId !=null and item.taskId != '' ">
                and task_id=#{item.taskId}
            </if>
        </where>
    </update>
 
    <delete id="expurgateData" parameterType="String">
        delete from new_fight_need_problem_claim
        <where>
            1=1
            <if test="id!=null and id != '' ">
                and id=#{id}
            </if>
            <if test="userId !=null and userId != '' ">
                and user_id=#{userId}
            </if>
            <if test="taskId !=null and taskId != '' ">
                and task_id=#{taskId}
            </if>
        </where>
    </delete>
 
    <select id="getJionNum" resultType="int">
        SELECT
            count(id)
        FROM
            new_fight_need_problem_claim
        <where>
            1=1
            <if test="taskId !=null and taskId != '' ">
                and task_id =#{taskId}
            </if>
            <if test="userId !=null and userId != '' ">
                and user_id =#{userId}
            </if>
        </where>
    </select>
 
 
 
    <select id="getUserIntegral" resultType="com.panzhihua.service_dangjian.entity.UserIntegral">
        select
            id,
            user_id,
            update_at,
            status,
            integral_volunteer,
            integral_sum,
            integral_resident,
            integral_party_time,
            integral_party,
            integral_frozen_volunteer,
            integral_frozen_sum,
            integral_frozen_resident,
            integral_frozen_party,
            integral_available_volunteer,
            integral_available_sum,
            integral_available_resident,
            integral_available_party,
            create_at,
            community_id
        from com_act_integral_user
        where user_id =#{userId} and community_id=#{communityId}
    </select>
 
 
 
    <insert id="addUserIntegral" useGeneratedKeys="true" keyProperty="id">
        insert into com_act_integral_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                id,
            </if>
            <if test="item.communityId !=null and item.communityId !='' ">
                community_id,
            </if>
            <if test="item.userId !=null and item.userId !='' ">
                user_id,
            </if>
            <if test="item.status !=null and item.status !='' ">
                status,
            </if>
            <if test="item.integralVolunteer !=null and item.integralVolunteer !='' ">
                integral_volunteer,
            </if>
            <if test="item.integralSum !=null and item.integralSum !='' ">
                integral_sum,
            </if>
            <if test="item.integralResident !=null and item.integralResident !='' ">
                integral_resident,
            </if>
            <if test="item.integralPartyTime !=null and item.integralPartyTime !='' ">
                integral_party_time,
            </if>
            <if test="item.integralParty !=null and item.integralParty !='' ">
                integral_party,
            </if>
            <if test="item.integralFrozenVolunteer !=null and item.integralFrozenVolunteer !='' ">
                integral_frozen_volunteer,
            </if>
            <if test="item.integralFrozenSum !=null and item.integralFrozenSum !='' ">
                integral_frozen_sum,
            </if>
            <if test="item.integralFrozenResident !=null and item.integralFrozenResident !='' ">
                integral_frozen_resident,
            </if>
            <if test="item.integralFrozenParty !=null and item.integralFrozenParty !='' ">
                integral_frozen_party,
            </if>
            <if test="item.integralAvailableVolunteer !=null and item.integralAvailableVolunteer !='' ">
                integral_available_volunteer,
            </if>
            <if test="item.integralAvailableSum !=null and item.integralAvailableSum !='' ">
                integral_available_sum,
            </if>
            <if test="item.integralAvailableResident !=null and item.integralAvailableResident !='' ">
                integral_available_resident,
            </if>
            <if test="item.integralAvailableParty !=null and item.integralAvailableParty !='' ">
                integral_available_party,
            </if>
            create_at
        </trim>
        values
        <trim prefix="("  suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                #{item.id},
            </if>
            <if test="item.communityId !=null and item.communityId !='' ">
                #{item.communityId},
            </if>
            <if test="item.userId !=null and item.userId !='' ">
                #{item.userId},
            </if>
            <if test="item.status !=null and item.status !='' ">
                #{item.status},
            </if>
            <if test="item.integralVolunteer !=null and item.integralVolunteer !='' ">
                #{item.integralVolunteer},
            </if>
            <if test="item.integralSum !=null and item.integralSum !='' ">
                #{item.integralSum},
            </if>
            <if test="item.integralResident !=null and item.integralResident !='' ">
                #{item.integralResident},
            </if>
            <if test="item.integralPartyTime !=null and item.integralPartyTime !='' ">
                #{item.integralPartyTime},
            </if>
            <if test="item.integralParty !=null and item.integralParty !='' ">
                #{item.integralParty},
            </if>
            <if test="item.integralFrozenVolunteer !=null and item.integralFrozenVolunteer !='' ">
                #{item.integralFrozenVolunteer},
            </if>
            <if test="item.integralFrozenSum !=null and item.integralFrozenSum !='' ">
                #{item.integralFrozenSum},
            </if>
            <if test="item.integralFrozenResident !=null and item.integralFrozenResident !='' ">
                #{item.integralFrozenResident},
            </if>
            <if test="item.integralFrozenParty !=null and item.integralFrozenParty !='' ">
                #{item.integralFrozenParty},
            </if>
            <if test="item.integralAvailableVolunteer !=null and item.integralAvailableVolunteer !='' ">
                #{item.integralAvailableVolunteer},
            </if>
            <if test="item.integralAvailableSum !=null and item.integralAvailableSum !='' ">
                #{item.integralAvailableSum},
            </if>
            <if test="item.integralAvailableResident !=null and item.integralAvailableResident !='' ">
                #{item.integralAvailableResident},
            </if>
            <if test="item.integralAvailableParty !=null and item.integralAvailableParty !='' ">
                #{item.integralAvailableParty},
            </if>
            sysdate()
        </trim>
    </insert>
 
    <update id="editUserIntegral">
        update com_act_integral_user
        <set>
            <if test="item.id != null and item.id != '' ">
                id=#{item.id},
            </if>
            <if test="item.communityId !=null and item.communityId !='' ">
                community_id=#{item.communityId},
            </if>
            <if test="item.userId !=null and item.userId !='' ">
                user_id=#{item.userId},
            </if>
            <if test="item.status !=null and item.status !='' ">
                status=#{item.status},
            </if>
            <if test="item.integralVolunteer !=null and item.integralVolunteer !='' ">
                integral_volunteer=#{item.integralVolunteer},
            </if>
            <if test="item.integralSum !=null and item.integralSum !='' ">
                integral_sum=#{item.integralSum},
            </if>
            <if test="item.integralResident !=null and item.integralResident !='' ">
                integral_resident=#{item.integralResident},
            </if>
            <if test="item.integralPartyTime !=null and item.integralPartyTime !='' ">
                integral_party_time=#{item.integralPartyTime},
            </if>
            <if test="item.integralParty !=null and item.integralParty !='' ">
                integral_party=#{item.integralParty},
            </if>
            <if test="item.integralFrozenVolunteer !=null and item.integralFrozenVolunteer !='' ">
                integral_frozen_volunteer=#{item.integralFrozenVolunteer},
            </if>
            <if test="item.integralFrozenSum !=null and item.integralFrozenSum !='' ">
                integral_frozen_sum=#{item.integralFrozenSum},
            </if>
            <if test="item.integralFrozenResident !=null and item.integralFrozenResident !='' ">
                integral_frozen_resident=#{item.integralFrozenResident},
            </if>
            <if test="item.integralFrozenParty !=null and item.integralFrozenParty !='' ">
                integral_frozen_party=#{item.integralFrozenParty},
            </if>
            <if test="item.integralAvailableVolunteer !=null and item.integralAvailableVolunteer !='' ">
                integral_available_volunteer=#{item.integralAvailableVolunteer},
            </if>
            <if test="item.integralAvailableSum !=null and item.integralAvailableSum !='' ">
                integral_available_sum=#{item.integralAvailableSum},
            </if>
            <if test="item.integralAvailableResident !=null and item.integralAvailableResident !='' ">
                integral_available_resident=#{item.integralAvailableResident},
            </if>
            <if test="item.integralAvailableParty !=null and item.integralAvailableParty !='' ">
                integral_available_party=#{item.integralAvailableParty},
            </if>
            update_at=sysdate()
        </set>
        where id = #{item.id}
    </update>
 
 
 
    <insert id="addUserIntegralTrade" useGeneratedKeys="true" keyProperty="id">
        insert into com_act_integral_user_trade
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                id,
            </if>
            <if test="item.userId != null and item.userId != '' ">
                user_id,
            </if>
            <if test="item.integralId != null and item.integralId != '' ">
                integral_id,
            </if>
            <if test="item.communityId != null and item.communityId != '' ">
                community_id,
            </if>
            <if test="item.serviceId != null and item.serviceId != '' ">
                service_id,
            </if>
            <if test="item.serviceType != null and item.serviceType != '' ">
                service_type,
            </if>
            <if test="item.amount != null and item.amount != '' ">
                amount,
            </if>
            <if test="item.changeType != null and item.changeType != '' ">
                change_type,
            </if>
            <if test="item.remark != null and item.remark != '' ">
                remark,
            </if>
            <if test="item.identityType != null and item.identityType != '' ">
                identity_type,
            </if>
            <if test="item.createBy != null and item.createBy != '' ">
                create_by,
            </if>
            create_at
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                #{item.id},
            </if>
            <if test="item.userId != null and item.userId != '' ">
                #{item.userId},
            </if>
            <if test="item.integralId != null and item.integralId != '' ">
                #{item.integralId},
            </if>
            <if test="item.communityId != null and item.communityId != '' ">
                #{item.communityId},
            </if>
            <if test="item.serviceId != null and item.serviceId != '' ">
                #{item.serviceType},
            </if>
            <if test="item.serviceType != null and item.serviceType != '' ">
                #{item.serviceType},
            </if>
            <if test="item.amount != null and item.amount != '' ">
                #{item.amount},
            </if>
            <if test="item.changeType != null and item.changeType != '' ">
                #{item.changeType},
            </if>
            <if test="item.remark != null and item.remark != '' ">
                #{item.remark},
            </if>
            <if test="item.identityType != null and item.identityType != '' ">
                #{item.identityType},
            </if>
            <if test="item.createBy != null and item.createBy != '' ">
                #{item.createBy},
            </if>
            sysdate()
        </trim>
    </insert>
 
 
    <!--  获取未签退活动id数据  -->
    <select id="getNotTimeTaskList" resultType="String">
        select task_id from new_fight_need_problem_claim where punch_start_time is not null and punch_end_time is null group by task_id
    </select>
 
 
    <!--  根据活动id获取没有签退的人员  -->
    <select id="getNotTimeId" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemClaimDTO">
        select id,punch_start_time,punch_end_time from new_fight_need_problem_claim where punch_start_time is not null and punch_end_time is null and task_id =#{taskId}
    </select>
 
 
    <select id="getActivityEndTime" resultType="com.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO">
        select id,need_end_time,need_start_time from new_fight_need_problem_inventory where id=#{taskId}
    </select>
 
 
    <update id="updateEndTime">
        update new_fight_need_problem_claim
        set punch_end_time=#{data}, service_time=#{serviceTime}
        where id = #{id}
    </update>
 
 
 
 
</mapper>