From f071a79c18115c00762bf78d62f21daaa7d77d39 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 19 三月 2025 11:02:52 +0800
Subject: [PATCH] 优化完善代码
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml | 50 ++++++++++++++++++++++++++++----------------------
1 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
index 1c90e2a..f57f2f0 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
+++ b/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}
--
Gitblit v1.8.0