insert into business_storehouse(
sh_desc,sh_type,sh_obj_id,operate,sh_id,sh_name,b_id,store_id,is_show
) values (
#{shDesc},#{shType},#{shObjId},#{operate},#{shId},#{shName},#{bId},#{storeId},#{isShow}
)
insert into storehouse(
sh_desc,sh_type,sh_obj_id,sh_id,status_cd,sh_name,b_id,store_id,is_show
) select t.sh_desc,t.sh_type,t.sh_obj_id,t.sh_id,'0',t.sh_name,t.b_id,t.store_id,t.is_show
from business_storehouse t
where 1=1
and t.sh_desc= #{shDesc}
and t.sh_type= #{shType}
and t.sh_obj_id= #{shObjId}
and t.operate= 'ADD'
and t.sh_id= #{shId}
and t.sh_name= #{shName}
and t.b_id= #{bId}
and t.store_id= #{storeId}
and t.is_show= #{isShow}
update storehouse t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.sh_desc= #{shDesc}
, t.sh_type= #{shType}
, t.sh_obj_id= #{shObjId}
, t.sh_name= #{shName}
, t.store_id= #{storeId}
, t.is_show= #{isShow}
where 1=1
and t.sh_id= #{shId}
and t.b_id= #{bId}