From d9d08181a94d727a4fe5933ac9efd1ff5c8a7c5a Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 16 七月 2025 13:49:13 +0800
Subject: [PATCH] 中间件修改内容: 1、当没农业综合站时即没相关配置项目内容为空时,启动时会产生bug; 2、整理优化代码。

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmSoilLastMapper.xml |   78 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmSoilLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmSoilLastMapper.xml
index 2e10b41..eb042e1 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmSoilLastMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmSoilLastMapper.xml
@@ -25,6 +25,15 @@
     soil_humidity4, soil_humidity5, soil_temperature1, soil_temperature2, soil_temperature3, 
     soil_temperature4, soil_temperature5
   </sql>
+
+  <sql id="Base_Column_List_with_alias">
+    <!--@mbg.generated-->
+    ${alias}.id, ${alias}.last_history_id, ${alias}.soil_id, ${alias}.dt, ${alias}.soil_humidity1,
+    ${alias}.soil_humidity2, ${alias}.soil_humidity3, ${alias}.soil_humidity4,
+    ${alias}.soil_humidity5, ${alias}.soil_temperature1, ${alias}.soil_temperature2,
+    ${alias}.soil_temperature3, ${alias}.soil_temperature4, ${alias}.soil_temperature5
+  </sql>
+
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
     select 
@@ -45,6 +54,75 @@
     </where>
     limit 0,1
   </select>
+
+
+
+  <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍鏁伴噺-->
+  <select id="selectCount" resultType="java.lang.Long">
+    SELECT
+    COUNT(*) AS recordCount
+    FROM rm_soil_last ltb
+    INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id
+    <where>
+      <if test="soilId != null">
+        AND ltb.soil_id = #{soilId}
+      </if>
+      <if test = "no != null">
+        AND mtb.no = #{no}
+      </if>
+      <if test = "name != null and name !=''">
+        AND mtb.name LIKE CONCAT('%',#{name},'%')
+      </if>
+      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
+        AND ltb.dt BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+  </select>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鏌ヨ璁板綍-->
+  <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoSoil">
+    SELECT
+    <include refid="Base_Column_List_with_alias" >
+      <property name="alias" value="ltb"/>
+    </include>,
+    mtb.`name` AS soilName
+    FROM rm_soil_last ltb
+    INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id
+    <where>
+      <if test="soilId != null">
+        AND ltb.soil_id = #{soilId}
+      </if>
+      <if test = "no != null">
+        AND mtb.no = #{no}
+      </if>
+      <if test = "name != null and name !=''">
+        AND mtb.name LIKE CONCAT('%',#{name},'%')
+      </if>
+      <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''">
+        AND ltb.dt BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+    ORDER BY ltb.soil_id DESC
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
+  </select>
+
+  <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇璁板綍-->
+  <select id="selectSomeBySoilId" resultType="com.dy.pipIrrGlobal.voRm.VoSoil">
+    select
+    <include refid="Base_Column_List" />
+    from rm_soil_last
+    <where>
+      <if test="soilId != null">
+        and soil_id = #{soilId}
+      </if>
+    </where>
+    limit 0,1
+  </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
     delete from rm_soil_last

--
Gitblit v1.8.0