insert into business_inspection_plan_staff( operate,ip_staff_id,staff_name,start_time,inspection_plan_id,end_time,b_id,community_id,staff_id ) values ( #{operate},#{ipStaffId},#{staffName},#{startTime},#{inspectionPlanId},#{endTime},#{bId},#{communityId},#{staffId} ) insert into inspection_plan_staff( ip_staff_id,staff_name,start_time,status_cd,inspection_plan_id,end_time,b_id,community_id,staff_id ) select t.ip_staff_id,t.staff_name,t.start_time,'0',t.inspection_plan_id,t.end_time,t.b_id,t.community_id,t.staff_id from business_inspection_plan_staff t where 1=1 and t.operate= 'ADD' and t.ip_staff_id= #{ipStaffId} and t.staff_name= #{staffName} and t.start_time= #{startTime} and t.inspection_plan_id= #{inspectionPlanId} and t.end_time= #{endTime} and t.b_id= #{bId} and t.community_id= #{communityId} and t.staff_id= #{staffId} update inspection_plan_staff t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.staff_name= #{staffName} , t.start_time= #{startTime} , t.inspection_plan_id= #{inspectionPlanId} , t.end_time= #{endTime} , t.community_id= #{communityId} , t.staff_id= #{staffId} where 1=1 and t.ip_staff_id= #{ipStaffId} and t.b_id= #{bId}