zhubaomin
2025-03-03 b375247a32664d3d1a37d735180f25ca8f5aedf7
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
@@ -7,15 +7,15 @@
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="plan_id" jdbcType="BIGINT" property="planId" />
    <result column="group_id" jdbcType="BIGINT" property="groupId" />
    <result column="unit_id" jdbcType="BIGINT" property="unitId" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" />
    <result column="intake_ids" jdbcType="VARCHAR" property="intakeIds" />
    <result column="duration" jdbcType="INTEGER" property="duration" />
    <result column="intake_ids" jdbcType="LONGVARCHAR" property="intakeIds" />
    <result column="current_state" jdbcType="TINYINT" property="currentState" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, plan_id, group_id, unit_id, start_time, stop_time, intake_ids, current_state
    id, plan_id, group_id, start_time, stop_time, duration, intake_ids, current_state
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -32,11 +32,11 @@
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule">
    <!--@mbg.generated-->
    insert into ir_irrigate_schedule (id, plan_id, group_id, 
      unit_id, start_time, stop_time,
      start_time, stop_time, duration,
      intake_ids, current_state)
    values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, 
      #{unitId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, #{stopTime,jdbcType=TIMESTAMP},
      #{intakeIds,jdbcType=VARCHAR}, #{currentState,jdbcType=TINYINT})
      #{startTime,jdbcType=TIMESTAMP}, #{stopTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER},
      #{intakeIds,jdbcType=LONGVARCHAR}, #{currentState,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule">
    <!--@mbg.generated-->
@@ -51,14 +51,14 @@
      <if test="groupId != null">
        group_id,
      </if>
      <if test="unitId != null">
        unit_id,
      </if>
      <if test="startTime != null">
        start_time,
      </if>
      <if test="stopTime != null">
        stop_time,
      </if>
      <if test="duration != null">
        duration,
      </if>
      <if test="intakeIds != null">
        intake_ids,
@@ -77,17 +77,17 @@
      <if test="groupId != null">
        #{groupId,jdbcType=BIGINT},
      </if>
      <if test="unitId != null">
        #{unitId,jdbcType=BIGINT},
      </if>
      <if test="startTime != null">
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stopTime != null">
        #{stopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="duration != null">
        #{duration,jdbcType=INTEGER},
      </if>
      <if test="intakeIds != null">
        #{intakeIds,jdbcType=VARCHAR},
        #{intakeIds,jdbcType=LONGVARCHAR},
      </if>
      <if test="currentState != null">
        #{currentState,jdbcType=TINYINT},
@@ -104,17 +104,17 @@
      <if test="groupId != null">
        group_id = #{groupId,jdbcType=BIGINT},
      </if>
      <if test="unitId != null">
        unit_id = #{unitId,jdbcType=BIGINT},
      </if>
      <if test="startTime != null">
        start_time = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stopTime != null">
        stop_time = #{stopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="duration != null">
        duration = #{duration,jdbcType=INTEGER},
      </if>
      <if test="intakeIds != null">
        intake_ids = #{intakeIds,jdbcType=VARCHAR},
        intake_ids = #{intakeIds,jdbcType=LONGVARCHAR},
      </if>
      <if test="currentState != null">
        current_state = #{currentState,jdbcType=TINYINT},
@@ -127,20 +127,26 @@
    update ir_irrigate_schedule
    set plan_id = #{planId,jdbcType=BIGINT},
      group_id = #{groupId,jdbcType=BIGINT},
      unit_id = #{unitId,jdbcType=BIGINT},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      stop_time = #{stopTime,jdbcType=TIMESTAMP},
      intake_ids = #{intakeIds,jdbcType=VARCHAR},
      duration = #{duration,jdbcType=INTEGER},
      intake_ids = #{intakeIds,jdbcType=LONGVARCHAR},
      current_state = #{currentState,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据计划ID获取灌溉次序-->
  <!--根据计划ID获取灌溉次序_模式2-->
  <select id="getIrrigateSchedules" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule">
    SELECT
        id AS scheduleId,
        start_time AS startTime,
        TIMESTAMPDIFF(MINUTE, start_time, stop_time) AS duration,
        <if test="startupMode == 1">
            null AS startTime,
            duration,
        </if>
        <if test="startupMode == 2">
          start_time AS startTime,
          TIMESTAMPDIFF(MINUTE, start_time, stop_time) AS duration,
        </if>
        intake_ids AS intakeIds
    FROM ir_irrigate_schedule
    WHERE plan_id = #{planId}