<!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>
|