insert into plan_In
(
group_number, product_id, quantity, date,
vendor_id, manager_id, warehouse_id, qr_hash,
url, clear, vendor_date, other, activation, view_group_number
)
VALUES
(
UUID(), #{productId}, #{quantity},
#{date}, #{vendorId},
#{managerId},#{warehouseId},#{qrHash},
#{url},#{clear}, #{vendor_date},
#{other},#{activation}, (select MAX(c.group_number)+1 as cnt
from ( select group_number,MAX(group_number) from plan_In group by group_number ) as c)
)
update plan_In SET
quantity = #{quantity},
date = #{date},
vendor_id = #{vendorId},
manager_id = #{managerId},
warehouse_id = #{warehouseId},
qr_hash = #{qrHash},
url = #{url},
clear = #{clear},
vendor_date = #{vendorDate},
other = #{other},
activation = #{activation},
product_id = #{productId}
WHERE group_number = #{groupNumber} and product_id = #{oldProductId}
update plan_In SET activation = false WHERE group_number = #{groupNumber}
update plan_In SET activation = false WHERE group_number = #{groupNumber} and product_id = #{productId}