insert into business_org(
org_name,operate,parent_org_id,description,org_level,store_id,b_id,org_id
) values (
#{orgName},#{operate},#{parentOrgId},#{description},#{orgLevel},#{storeId},#{bId},#{orgId}
)
insert into u_org(
org_name,parent_org_id,description,org_level,status_cd,store_id,b_id,org_id
) select t.org_name,t.parent_org_id,t.description,t.org_level,'0',t.store_id,t.b_id,t.org_id 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}
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.store_id= #{storeId}
where 1=1
and t.b_id= #{bId}
and t.org_id= #{orgId}