id, group_id, start_time, duration, current_state
  
  
  
    
    delete from ir_irrigate_schedule
    where id = #{id,jdbcType=BIGINT}
  
  
    
    insert into ir_irrigate_schedule (id, group_id, start_time, duration, current_state)
    values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT},
      #{startTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, #{currentState,jdbcType=TINYINT})
  
  
    
    insert into ir_irrigate_schedule
    
      
        id,
      
      
        group_id,
      
      
        start_time,
      
      
        duration,
      
      
        current_state,
      
    
    
      
        #{id,jdbcType=BIGINT},
      
      
        #{groupId,jdbcType=BIGINT},
      
      
        #{startTime,jdbcType=TIMESTAMP},
      
      
        #{duration,jdbcType=INTEGER},
      
      
        #{currentState,jdbcType=TINYINT},
      
    
  
  
    
    update ir_irrigate_schedule
    
      
        group_id = #{groupId,jdbcType=BIGINT},
      
      
        start_time = #{startTime,jdbcType=TIMESTAMP},
      
      
        duration = #{duration,jdbcType=INTEGER},
      
      
        current_state = #{currentState,jdbcType=TINYINT},
      
    
    where id = #{id,jdbcType=BIGINT}
  
  
    
    update ir_irrigate_schedule
    set group_id = #{groupId,jdbcType=BIGINT},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      duration = #{duration,jdbcType=INTEGER},
      current_state = #{currentState,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  
  
  
  
  
    UPDATE ir_irrigate_schedule
    SET start_time = #{startTime}
    WHERE id = #{scheduleId}
  
  
  
    UPDATE ir_irrigate_schedule sch
      INNER JOIN ir_plan_schedule ps ON ps.schedule_id = sch.id
      INNER JOIN ir_irrigate_plan plan ON ps.plan_id = plan.id
    SET sch.current_state = 2
    WHERE plan.id = #{planId}