insert into business_machine_attrs( machine_id,attr_id,operate,spec_cd,community_id,b_id,value ) values ( #{machineId},#{attrId},#{operate},#{specCd},#{communityId},#{bId},#{value} ) insert into machine_attrs( machine_id,attr_id,spec_cd,community_id,b_id,value ) values ( #{machineId},#{attrId},#{specCd},#{communityId},'-1',#{value} ) insert into machine_attrs( machine_id,attr_id,spec_cd,status_cd,community_id,b_id,value ) select t.machine_id,t.attr_id,t.spec_cd,'0',t.community_id,t.b_id,t.value from business_machine_attrs t where 1=1 and t.machine_id= #{machineId} and t.attr_id= #{attrId} and t.operate= 'ADD' and t.spec_cd= #{specCd} and t.community_id= #{communityId} and t.b_id= #{bId} and t.value= #{value} update machine_attrs t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.value= #{value} where 1=1 and t.attr_id= #{attrId} and t.b_id= #{bId} and t.community_id= #{communityId} and t.spec_cd= #{specCd} and t.machine_id= #{machineId}