select org_id, user_id, org_name, org_type, business_nature, address, tax_no, status, create_time,
contact_name, contact_phone, intent_count,
create_by, update_by, update_time, del_flag, is_synced
from biz_org
insert into biz_org
user_id,
org_name,
org_type,
business_nature,
address,
tax_no,
contact_name,
contact_phone,
intent_count,
status,
is_synced,
create_by,
create_time,
#{userId},
#{orgName},
#{orgType},
#{businessNature},
#{address},
#{taxNo},
#{contactName},
#{contactPhone},
#{intentCount},
#{status},
#{isSynced},
#{createBy},
sysdate(),
update biz_org
user_id = #{userId},
org_name = #{orgName},
org_type = #{orgType},
business_nature = #{businessNature},
address = #{address},
tax_no = #{taxNo},
contact_name = #{contactName},
contact_phone = #{contactPhone},
intent_count = #{intentCount},
status = #{status},
is_synced = #{isSynced},
update_by = #{updateBy},
update_time = sysdate(),
where org_id = #{orgId}
update biz_org set del_flag = '1' where org_id in
#{orgId}
and del_flag = '0'
update sys_user set del_flag = '1'
where del_flag = '0' and (
user_id in (select user_id from biz_person where org_id = #{orgId})
or user_id = (select user_id from biz_org where org_id = #{orgId})
)