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, b_id, stock, original_stock, remark, apply_id) values (#{asId}, #{storeId}, #{resId}, #{shIdz}, #{resName}, #{startUserId}, #{operate}, #{shIda}, #{startUserName}, #{bId}, #{stock}, #{originalStock}, #{remark}, #{applyId}) insert into allocation_storehouse(as_id, b_id, sh_id_a, sh_id_z, res_id, res_name, store_id, stock, start_user_id, start_user_name, create_time, remark, apply_id, original_stock,times_id) values (#{asId}, #{bId}, #{shIda}, #{shIdz}, #{resId}, #{resName}, #{storeId}, #{stock}, #{startUserId}, #{startUserName}, #{createTime}, #{remark}, #{applyId}, #{originalStock}, #{timesId}) 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,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.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.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.stock= #{stock} and t.original_stock= #{originalStock} where 1=1 and t.as_id= #{asId} and t.b_id= #{bId}