SELECT
productid as product_id,
productsno,
productname,
p.muid,
po.plan_value,
po.paln_type,
po."value",
po.coal_value,
po.steam_value,
po.water_value
FROM
sys_product P
left JOIN planned_output po on po.product_id= p.productid
insert into planned_output
paln_type,
product_id,
plan_value,
data_time,
create_time,
update_time,
#{palnType},
#{productId},
#{planValue},
#{dataTime},
#{createTime},
#{updateTime},
insert into planned_output (
time_code,
paln_type,
product_id,
plan_value,
value,
coal_value,
steam_value,
water_value,
data_time,
create_time)
select #{plannedOutput.timeCode},
#{plannedOutput.palnType},
#{plannedOutput.productId},
#{plannedOutput.planValue,jdbcType = DOUBLE},
#{plannedOutput.value,jdbcType = DOUBLE},
#{plannedOutput.coalValue,jdbcType = DOUBLE},
#{plannedOutput.steamValue,jdbcType = DOUBLE},
#{plannedOutput.waterValue,jdbcType = DOUBLE},
#{plannedOutput.dataTime},
now()
on conflict
(product_id,time_code)
do update
set plan_value = #{plannedOutput.planValue, jdbcType = DOUBLE},
value = #{plannedOutput.value, jdbcType = DOUBLE},
coal_value = #{plannedOutput.coalValue, jdbcType = DOUBLE},
steam_value = #{plannedOutput.steamValue, jdbcType = DOUBLE},
water_value = #{plannedOutput.waterValue, jdbcType = DOUBLE},
update_time = now();
insert into planned_output (
time_code,
paln_type,
product_id,
plan_value,
data_time,
create_time)
select #{plannedOutput.timeCode},
#{plannedOutput.palnType},
#{plannedOutput.productId},
#{plannedOutput.planValue,jdbcType = DOUBLE},
#{plannedOutput.dataTime},
now()
on conflict
(product_id,time_code)
do update
set plan_value = #{plannedOutput.planValue, jdbcType = DOUBLE},
update_time = now();