select out_id, out_code, ioi.warehouse_id, out_date, ioi.fetch_user_id, total_num, out_type,
ioi.status, order_id, total_amount, plan_id, fetch_material_id, goods_allocation_id,
ioi.remark, ioi.del_flag, ioi.create_by, ioi.create_time, ioi.update_by, ioi.update_time,
iwi.warehouse_name, ioi.fetch_user, ba.area_id, ba.area_name
from ims_out_inventory ioi
left join ims_warehouse_info iwi on ioi.warehouse_id = iwi.warehouse_id
left join basic_area ba on iwi.area_id = ba.area_id
left join sys_user su on ioi.fetch_user_id = su.user_id
insert into ims_out_inventory
out_code,
warehouse_id,
out_date,
fetch_user_id,
fetch_user,
total_num,
out_type,
status,
order_id,
total_amount,
plan_id,
fetch_material_id,
goods_allocation_id,
remark,
del_flag,
create_by,
create_time,
update_by,
update_time,
#{outCode},
#{warehouseId},
#{outDate},
#{fetchUserId},
#{fetchUser},
#{totalNum},
#{outType},
#{status},
#{orderId},
#{totalAmount},
#{planId},
#{fetchMaterialId},
#{goodsAllocationId},
#{remark},
#{delFlag},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
update ims_out_inventory
out_code = #{outCode},
warehouse_id = #{warehouseId},
out_date = #{outDate},
fetch_user_id = #{fetchUserId},
fetch_user = #{fetchUser},
total_num = #{totalNum},
out_type = #{outType},
status = #{status},
order_id = #{orderId},
total_amount = #{totalAmount},
plan_id = #{planId},
fetch_material_id = #{fetchMaterialId},
goods_allocation_id = #{goodsAllocationId},
remark = #{remark},
del_flag = #{delFlag},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
where out_id = #{outId}
update ims_out_inventory set del_flag = '2' where out_id = #{outId}
update ims_out_inventory set del_flag = '2' where out_id in
#{outId}
update ims_out_inventory_detail set del_flag = '2' where out_id in
#{outId}
update ims_out_inventory_detail set del_flag = '2' where out_id = #{outId}
insert into ims_out_inventory_detail( out_detail_id, out_id, out_code, inventory_id, fetch_num, total_price, into_detail_id, interval_id, size, img_url, if_overdraft, remark, del_flag, create_by, create_time, update_by, update_time) values
( #{item.outDetailId}, #{item.outId}, #{item.outCode}, #{item.inventoryId}, #{item.fetchNum}, #{item.totalPrice}, #{item.intoDetailId}, #{item.intervalId}, #{item.size}, #{item.imgUrl}, #{item.ifOverdraft}, #{item.remark}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})