insert into machine_auth(person_name, machine_id, person_id, start_time, status_cd, state, end_time, community_id, b_id, person_type, auth_id) values (#{personName}, #{machineId}, #{personId}, #{startTime}, #{statusCd}, #{state}, #{endTime}, #{communityId}, #{bId}, #{personType}, #{authId}) insert into business_machine_auth(person_name, machine_id, operate, person_id, start_time, state, end_time, community_id, b_id, person_type, auth_id) values (#{personName}, #{machineId}, #{operate}, #{personId}, #{startTime}, #{state}, #{endTime}, #{communityId}, #{bId}, #{personType}, #{authId}) insert into machine_auth( person_name,machine_id,person_id,start_time,status_cd,state,end_time,community_id,b_id,person_type,auth_id ) select t.person_name,t.machine_id,t.person_id,t.start_time,'0',t.state,t.end_time,t.community_id,t.b_id,t.person_type,t.auth_id from business_machine_auth t where 1=1 and t.person_name= #{personName} and t.machine_id= #{machineId} and t.operate= 'ADD' and t.person_id= #{personId} and t.start_time= #{startTime} and t.state= #{state} and t.end_time= #{endTime} and t.community_id= #{communityId} and t.b_id= #{bId} and t.person_type= #{personType} and t.auth_id= #{authId} update machine_auth t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.person_name= #{personName} , t.machine_id= #{machineId} , t.person_id= #{personId} , t.start_time= #{startTime} , t.state= #{state} , t.end_time= #{endTime} , t.community_id= #{communityId} , t.person_type= #{personType} where 1=1 and t.b_id= #{bId} and t.auth_id= #{authId} update machine_auth t set t.status_cd = '1' ,t.b_id = #{newBId} , t.person_name= #{personName} , t.machine_id= #{machineId} , t.person_id= #{personId} , t.start_time= #{startTime} , t.state= #{state} , t.end_time= #{endTime} , t.community_id= #{communityId} , t.person_type= #{personType} where 1=1 and t.b_id= #{bId} and t.auth_id= #{authId}