insert into business_allocation_storehouse( as_id,store_id,res_id,sh_id_z,res_name,start_user_id,operate,sh_id_a,start_user_name,state,b_id,stock,original_stock,remark,apply_id ) values ( #{asId},#{storeId},#{resId},#{shIdz},#{resName},#{startUserId},#{operate},#{shIda},#{startUserName},#{state},#{bId},#{stock},#{originalStock},#{remark},#{applyId} ) insert into allocation_storehouse( as_id,status_cd,store_id,res_id,sh_id_z,res_name,start_user_id,sh_id_a,start_user_name,state,b_id,stock,original_stock,remark,apply_id ) select t.as_id,'0',t.store_id,t.res_id,t.sh_id_z,t.res_name,t.start_user_id,t.sh_id_a,t.start_user_name,t.state,t.b_id,t.stock,t.original_stock,t.remark,t.apply_id from business_allocation_storehouse t where 1=1 and t.as_id= #{asId} and t.store_id= #{storeId} and t.res_id= #{resId} and t.sh_id_z= #{shIdz} and t.res_name= #{resName} and t.start_user_id= #{startUserId} and t.operate= 'ADD' and t.sh_id_a= #{shIda} and t.start_user_name= #{startUserName} and t.state= #{state} and t.b_id= #{bId} and t.stock= #{stock} and t.original_stock= #{originalStock} update allocation_storehouse t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.store_id= #{storeId} , t.res_id= #{resId} , t.sh_id_z= #{shIdz} , t.res_name= #{resName} , t.start_user_id= #{startUserId} , t.sh_id_a= #{shIda} , t.start_user_name= #{startUserName} , t.state= #{state} , t.stock= #{stock} and t.original_stock= #{originalStock} where 1=1 and t.as_id= #{asId} and t.b_id= #{bId}