id, intake_id, `year`, `month`, amount
delete from st_loss_month
where id = #{id,jdbcType=BIGINT}
insert into st_loss_month (id, intake_id, `year`,
`month`, amount)
values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{year,jdbcType=INTEGER},
#{month,jdbcType=INTEGER}, #{amount,jdbcType=FLOAT})
insert into st_loss_month
id,
intake_id,
`year`,
`month`,
amount,
#{id,jdbcType=BIGINT},
#{intakeId,jdbcType=BIGINT},
#{year,jdbcType=INTEGER},
#{month,jdbcType=INTEGER},
#{amount,jdbcType=FLOAT},
update st_loss_month
intake_id = #{intakeId,jdbcType=BIGINT},
`year` = #{year,jdbcType=INTEGER},
`month` = #{month,jdbcType=INTEGER},
amount = #{amount,jdbcType=FLOAT},
where id = #{id,jdbcType=BIGINT}
update st_loss_month
set intake_id = #{intakeId,jdbcType=BIGINT},
`year` = #{year,jdbcType=INTEGER},
`month` = #{month,jdbcType=INTEGER},
amount = #{amount,jdbcType=FLOAT}
where id = #{id,jdbcType=BIGINT}
SELECT intaId.intakeId AS intakeId,
sld.year AS `year`,
sld.month AS `month`,
sld.amount AS amount
FROM JSON_TABLE(
#{intakesJson},
'$[*]' COLUMNS (
intakeId BIGINT PATH '$.intakeId'
)
) intaId
INNER JOIN st_loss_month sld ON sld.intake_id = intaId.intakeId
AND sld.year = #{year, javaType=Integer, jdbcType=INTEGER}