id, intake_id, `year`, `month`, amount
  
  
 
  
    
    delete from st_intake_amount_month
    where id = #{id,jdbcType=BIGINT}
  
  
    
    insert into st_intake_amount_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_intake_amount_month
    
      
        id,
      
      
        intake_id,
      
      
        `year`,
      
      
        `month`,
      
      
        amount,
      
    
    
      
        #{id,jdbcType=BIGINT},
      
      
        #{intakeId,jdbcType=BIGINT},
      
      
        #{year,jdbcType=INTEGER},
      
      
        #{month,jdbcType=INTEGER},
      
      
        #{amount,jdbcType=FLOAT},
      
    
  
  
    
    update st_intake_amount_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_intake_amount_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,
             siam.year          AS `year`,
             siam.month         AS `month`,
             siam.amount        AS amount
      FROM JSON_TABLE(
        #{intakesJson},
          '$[*]' COLUMNS (
          intakeId BIGINT PATH '$.intakeId'
        )
      ) intaId
      INNER JOIN st_intake_amount_month siam ON siam.intake_id = intaId.intakeId
      
        
          AND siam.year = #{year, javaType=Integer, jdbcType=INTEGER}