From 9ed2262afb8ec79c2cf927063fdd31702a2bde05 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期二, 15 四月 2025 11:32:01 +0800
Subject: [PATCH] 获取轮灌组接口优化
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
index 497b2be..449f82d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
@@ -303,6 +303,15 @@
ORDER BY plan.plan_state DESC
</select>
+ <!--鑾峰彇宸插畬鎴愮殑璁″垝鏁伴噺-->
+ <select id="getCompletedPlansCount" resultType="java.lang.Long">
+ SELECT
+ COUNT(*) AS recordCount
+ FROM ir_irrigate_plan plan
+ INNER JOIN ir_project pro ON pro.id = plan.project_id
+ WHERE plan.deleted = 0 AND ((plan.plan_state = 2 AND NOW() >= plan.plan_stop_time) OR (plan.executing_state = 3))
+ </select>
+
<!--鑾峰彇宸插畬鎴愮殑璁″垝鍒楄〃锛屽皬绋嬪簭璁″垝鍒楄〃椤典娇鐢�-->
<select id="getCompletedPlans" resultType="com.dy.pipIrrGlobal.voIr.VoPlans">
SELECT
@@ -318,6 +327,11 @@
INNER JOIN ir_project pro ON pro.id = plan.project_id
WHERE plan.deleted = 0 AND ((plan.plan_state = 2 AND NOW() >= plan.plan_stop_time) OR (plan.executing_state = 3))
ORDER BY plan.plan_state DESC
+ <trim prefix="limit ">
+ <if test="start != null and count != null">
+ #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+ </if>
+ </trim>
</select>
<!--鏍规嵁璁″垝ID鑾峰彇寰呯粓姝㈣鍒掔殑缁撴潫鏃堕棿锛氭湭鍒犻櫎銆佹湭缁堟銆佸凡鍙戝竷銆佸綋鍓嶆椂闂村皬浜庤鍒掔粨鏉熸椂闂�-->
@@ -337,4 +351,31 @@
</select>
+ <!--鏍规嵁璁″垝ID鑾峰彇璁″垝璇︽儏锛屽寘鎷鍒掑悕绉帮紝椤圭洰鍚嶏紝璁″垝寮�濮嬫椂闂达紝璁″垝缁撴潫鏃堕棿锛岃鍒掕鎯呴〉浣跨敤-->
+ <select id="getPlanDetails" resultType="com.dy.pipIrrGlobal.voIr.VoPlanDetails">
+ SELECT
+ plan.plan_name AS planName,
+ pro.project_name AS projectName,
+ IF(plan.executing_state = 3, '5',
+ IF(NOW() < plan.plan_start_time,'2',
+ IF(NOW() < plan.plan_stop_time, '3', '4'))) AS state,
+ plan.plan_start_time AS planStartTime,
+ plan.plan_stop_time AS planStopTime,
+ NULL AS groupDetails,
+ NULL AS failureCount
+ FROM ir_irrigate_plan plan
+ INNER JOIN ir_project pro ON pro.id = plan.project_id
+ WHERE plan.id = #{planId}
+ AND plan.deleted = 0
+ </select>
+
+ <!--鏍规嵁璁″垝ID鑾峰彇璁″垝鐘舵�侊紝鐢ㄤ簬鍒ゆ柇鏄惁鍙互鍒犻櫎璁″垝-->
+ <select id="getPlanState" resultType="java.lang.Integer">
+ SELECT
+ plan_state
+ FROM ir_irrigate_plan
+ WHERE id = #{planId}
+ AND deleted = 0
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0