insert into business_repair_user(
operate,context,repair_id,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
pre_staff_name,repair_event,end_time,start_time,pre_ru_id
) values (
#{operate},#{context},#{repairId},#{ruId},#{state},#{communityId},#{bId},#{staffId},
#{staffName},#{preStaffId},#{preStaffName},#{repairEvent},#{endTime},#{startTime},#{preRuId}
)
insert into r_repair_user(
context,repair_id,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
pre_staff_name,repair_event,end_time,start_time,pre_ru_id,create_time
) values (
#{context},#{repairId},#{ruId},#{state},#{communityId},#{bId},#{staffId},
#{staffName},#{preStaffId},#{preStaffName},#{repairEvent},#{endTime},#{startTime},#{preRuId},#{createTime}
)
insert into r_repair_user(
context,repair_id,status_cd,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
pre_staff_name,repair_event,start_time,end_time,pre_ru_id
) select t.context,t.repair_id,'0',t.ru_id,t.state,t.community_id,t.b_id,t.staff_id,t.staff_name,
t.pre_staff_id,t.pre_staff_name,t.repair_event,t.start_time,t.end_time,t.pre_ru_id
from business_repair_user t
where 1=1
and t.operate= 'ADD'
and t.context= #{context}
and t.repair_id= #{repairId}
and t.ru_id= #{ruId}
and t.state= #{state}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.user_id= #{userId}
update r_repair_user t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.context= #{context}
, t.state= #{state}
, t.community_id= #{communityId}
, t.end_time= #{endTime}
, t.start_time= #{startTime}
, t.staff_name= #{staffName}
where 1=1
and t.ru_id= #{ruId}
and t.b_id= #{bId}
and t.staff_id= #{staffId}
and t.repair_id= #{repairId}