insert into business_user_storehouse( res_name,operate,b_id,store_id,stock,res_id,res_code,user_id,us_id,mini_stock ) values ( #{resName},#{operate},#{bId},#{storeId},#{stock},#{resId},#{resCode},#{userId},#{usId},#{miniStock} ) insert into user_storehouse( res_name,b_id,store_id,stock,res_id,res_code,user_id,us_id,mini_stock ) values ( #{resName},'-1',#{storeId},#{stock},#{resId},#{resCode},#{userId},#{usId},#{miniStock} ) insert into user_storehouse( res_name,status_cd,b_id,store_id,stock,res_id,res_code,user_id,us_id,mini_stock ) select t.res_name,'0',t.b_id,t.store_id,t.stock,t.res_id,t.res_code,t.user_id,t.us_id,t.mini_stock from business_user_storehouse t where 1=1 and t.res_name= #{resName} and t.operate= 'ADD' and t.b_id= #{bId} and t.store_id= #{storeId} and t.stock= #{stock} and t.res_id= #{resId} and t.res_code= #{resCode} and t.user_id= #{userId} and t.us_id= #{usId} and t.mini_stock= #{miniStock} update user_storehouse t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.res_name= #{resName} , t.store_id= #{storeId} , t.stock= #{stock} , t.res_id= #{resId} , t.res_code= #{resCode} , t.user_id= #{userId} , t.mini_stock= #{miniStock} where 1=1 and t.b_id= #{bId} and t.us_id= #{usId}