insert into business_repair_pool(
operate,repair_name,appointment_time,repair_type,context,repair_id,tel,state,community_id,b_id,room_id
) values (
#{operate},#{repairName},#{appointmentTime},#{repairType},#{context},#{repairId},#{tel},#{state},#{communityId},#{bId},#{roomId}
)
insert into r_repair_pool(
repair_name,appointment_time,repair_type,context,repair_id,tel,status_cd,state,community_id,b_id,room_id
) select
t.repair_name,t.appointment_time,t.repair_type,t.context,t.repair_id,t.tel,'0',t.state,t.community_id,t.b_id,t.room_id
from business_repair_pool t where 1=1
and t.operate= 'ADD'
and t.repair_name= #{repairName}
and t.appointment_time= #{appointmentTime}
and t.repair_type= #{repairType}
and t.context= #{context}
and t.repair_id= #{repairId}
and t.tel= #{tel}
and t.state= #{state}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.room_id= #{roomId}
update r_repair_pool t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.repair_name= #{repairName}
, t.appointment_time= #{appointmentTime}
, t.repair_type= #{repairType}
, t.context= #{context}
, t.tel= #{tel}
, t.state= #{state}
, t.community_id= #{communityId}
, t.room_id= #{roomId}
where 1=1
and t.repair_id= #{repairId}
and t.b_id= #{bId}