insert into business_org(org_name, operate, parent_org_id, description, org_level, store_id, b_id, org_id,
belong_community_id, allow_operation)
values (#{orgName}, #{operate}, #{parentOrgId}, #{description}, #{orgLevel}, #{storeId}, #{bId}, #{orgId},
#{belongCommunityId}, #{allowOperation})
insert into u_org(
org_name,parent_org_id,description,org_level,status_cd,store_id,b_id,org_id,belong_community_id,allow_operation
) select
t.org_name,t.parent_org_id,t.description,t.org_level,'0',t.store_id,t.b_id,t.org_id,t.belong_community_id,t.allow_operation
from business_org t
where 1=1
and t.org_name= #{orgName}
and t.operate= 'ADD'
and t.parent_org_id= #{parentOrgId}
and t.description= #{description}
and t.org_level= #{orgLevel}
and t.store_id= #{storeId}
and t.b_id= #{bId}
and t.org_id= #{orgId}
and t.belong_community_id= #{belongCommunityId}
and t.allow_operation= #{allowOperation}
update u_org t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.org_name= #{orgName}
, t.parent_org_id= #{parentOrgId}
, t.description= #{description}
, t.org_level= #{orgLevel}
, t.belong_community_id= #{belongCommunityId}
, t.store_id= #{storeId}
, t.allow_operation= #{allowOperation}
where 1=1
and t.b_id= #{bId}
and t.org_id= #{orgId}