insert into business_allocation_user_storehouse(
accept_user_id,accept_user_name,remark,store_id,res_id,res_name,start_user_id,operate,start_user_name,aus_id,b_id,stock,give_quantity
) values (
#{acceptUserId},#{acceptUserName},#{remark},#{storeId},#{resId},#{resName},#{startUserId},#{operate},#{startUserName},#{ausId},#{bId},
#{stock},#{giveQuantity}
)
insert into allocation_user_storehouse(
accept_user_id,accept_user_name,status_cd,remark,store_id,res_id,res_name,start_user_id,start_user_name,aus_id,b_id,stock,give_quantity
) select
t.accept_user_id,t.accept_user_name,'0',t.remark,t.store_id,t.res_id,t.res_name,t.start_user_id,t.start_user_name,t.aus_id,t.b_id,t.stock,
t.give_quantity
from business_allocation_user_storehouse t where 1=1
and t.accept_user_id= #{acceptUserId}
and t.accept_user_name= #{acceptUserName}
and t.remark= #{remark}
and t.store_id= #{storeId}
and t.res_id= #{resId}
and t.res_name= #{resName}
and t.start_user_id= #{startUserId}
and t.operate= 'ADD'
and t.start_user_name= #{startUserName}
and t.aus_id= #{ausId}
and t.b_id= #{bId}
and t.stock= #{stock}
and t.give_quantity= #{giveQuantity}
update allocation_user_storehouse t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.accept_user_id= #{acceptUserId}
, t.accept_user_name= #{acceptUserName}
, t.remark= #{remark}
, t.store_id= #{storeId}
, t.res_id= #{resId}
, t.res_name= #{resName}
, t.start_user_id= #{startUserId}
, t.start_user_name= #{startUserName}
, t.stock= #{stock}
, t.give_quantity= #{giveQuantity}
where 1=1
and t.aus_id= #{ausId}
and t.b_id= #{bId}