insert into business_org_staff_rel( rel_id,operate,store_id,b_id,org_id,staff_id,rel_cd ) values ( #{relId},#{operate},#{storeId},#{bId},#{orgId},#{staffId},#{relCd} ) insert into u_org_staff_rel( rel_id,status_cd,store_id,b_id,org_id,staff_id,rel_cd ) select t.rel_id,'0',t.store_id,t.b_id,t.org_id,t.staff_id,t.rel_cd from business_org_staff_rel t where 1=1 and t.rel_id= #{relId} and t.operate= 'ADD' and t.store_id= #{storeId} and t.b_id= #{bId} and t.org_id= #{orgId} and t.staff_id= #{staffId} and t.rel_cd= #{relCd} update u_org_staff_rel t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.store_id= #{storeId} , t.org_id= #{orgId} , t.staff_id= #{staffId} , t.rel_cd= #{relCd} where 1=1 and t.rel_id= #{relId} and t.b_id= #{bId}