From bb5c0ca59fd23ca6c4b8184023d8707d9d506826 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 25 四月 2025 10:56:37 +0800
Subject: [PATCH] 修改bug

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 114 insertions(+), 5 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
index 8936453..1d8abba 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -34,13 +34,33 @@
         operateDt,
         deleted
     </sql>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoAllIntake">
         <!--@mbg.generated-->
         select
-        <include refid="Base_Column_List"/>
-        from pr_intake
-        where id = #{id,jdbcType=BIGINT}
-        and deleted = 0
+        ge.id,
+        ge.countyId,
+        ge.townId,
+        ge.villageId,
+        ge.divideId,
+        ge.blockId,
+        ge.`name`,
+        ge.lng,
+        ge.lat,
+        ge.remarks,
+        ge.`operator`,
+        ge.operateDt,
+        blo.`name`                                          AS blockName,
+        CONCAT(country.`name`, town.`name`, village.`name`)              AS address
+        FROM pr_intake ge
+        INNER JOIN pr_divide divi ON ge.divideId = divi.id
+        INNER JOIN ba_block blo ON divi.blockId = blo.id
+        LEFT JOIN ba_district country ON ge.countyId = country.id
+        LEFT JOIN ba_district town ON ge.townId = town.id
+        LEFT JOIN ba_district village ON ge.villageId = village.id
+        where ge.id = #{id,jdbcType=BIGINT}
+        AND ge.deleted = 0
+        AND divi.deleted = 0
+        AND blo.deleted = 0
     </select>
 
     <delete id="deleteLogicById" parameterType="java.lang.Long">
@@ -385,6 +405,13 @@
     </select>
 
     <!--鏍规嵁鏉慖D鑾峰彇鍏ㄩ儴鍦板潃-->
+    <select id="getNameById" resultType="java.lang.String">
+        select name
+        from pr_intake
+        where id = #{intakeId, jdbcType=BIGINT}
+    </select>
+
+    <!--鏍规嵁鏉慖D鑾峰彇鍏ㄩ儴鍦板潃-->
     <select id="getAddressByVillageId" parameterType="_long" resultType="java.lang.String">
         select CONCAT(dis_province.`name`, dis_city.`name`, dis_county.`name`, dis_town.`name`,
         dis_village.`name`) AS address
@@ -569,6 +596,7 @@
         inta.name                   AS intakeNum,
         inta.lng,
         inta.lat,
+        IFNULL(hou.instant_amount, 0) AS instantAmount,
         IFNULL(hou.total_amount, 0) AS totalAmount,
         <if test="onLineMap != null and onLineMap !='' and isOnLine != null">
             rtus.isOnLine,
@@ -689,4 +717,85 @@
         WHERE id != #{id}
         and `name` = #{intakeName}
     </select>
+    <!--app淇敼鍙栨按鍙g粡绾害-->
+    <update id="updateByPrimaryKeySelective1" parameterType="com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat">
+        <!--@mbg.generated-->
+        update pr_intake
+        <set>
+            <if test="lng != null">
+                lng = #{lng,jdbcType=DOUBLE},
+            </if>
+            <if test="lat != null">
+                lat = #{lat,jdbcType=DOUBLE},
+            </if>
+            <if test="operator != null">
+                `operator` = #{operator,jdbcType=BIGINT},
+            </if>
+            <if test="operateDt != null">
+                operateDt = #{operateDt,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+
+    <!--鑾峰彇鏈粦瀹氬埌杞亴缁勭殑鍙栨按鍙e垪琛�-->
+    <select id="getFreeIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntakeSimple">
+        SELECT
+            id AS intakeId,
+            name AS intakeName
+        FROM pr_intake inta
+        <where>
+            AND inta.deleted = 0
+            AND NOT EXISTS (SELECT 1 FROM ir_group_intake gi WHERE gi.intake_id = inta.id)
+            <if test="intakeName != null and intakeName != ''">
+                AND LOWER(inta.name) LIKE CONCAT('%', #{intakeName}, '%')
+            </if>
+        </where>
+    </select>
+
+    <!--鑾峰彇鏈粦瀹氳櫄鎷熷崱鐨勫彇姘村彛鍒楄〃锛岀粰鍙栨按鍙g粦铏氭嫙鍗′娇鐢�-->
+    <select id="getNotLinkVcIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntakeSimple">
+        SELECT
+            id AS intakeId,
+            name AS intakeName
+        FROM pr_intake inta
+        WHERE NOT EXISTS (
+                SELECT 1
+                FROM pr_intake_vc iv
+                WHERE iv.intake_id = inta.id
+            ) AND inta.deleted = 0
+    </select>
+
+
+
+    <!-- 涓簑echat,鏍规嵁鎸囧畾鍙栨按鍙e悕绉版ā绯婏紙鍚庣锛夋煡璇㈡按鍙h褰曟暟 -->
+    <select id="getSomeIntakesCount4Wx" parameterType="java.util.Map" resultType="java.lang.Long">
+        SELECT COUNT(*) AS recordCount
+        FROM pr_intake tb
+        <where>
+            tb.deleted = 0
+            <if test="intakeNum != null and intakeNum != ''">
+                AND tb.name LIKE CONCAT('%', #{intakeNum})
+            </if>
+        </where>
+    </select>
+
+    <!-- 涓簑echat,鏍规嵁鎸囧畾鍙栨按鍙e悕绉版ā绯婏紙鍚庣锛夋煡璇㈡按鍙h褰� -->
+    <select id="getSomeIntakes4Wx" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
+        SELECT
+        inta.id AS intakeId,
+        con.rtuAddr,
+        inta.name AS intakeNum
+        FROM pr_intake inta
+        INNER JOIN pr_controller con ON con.intakeId = inta.id
+        <where>
+            inta.deleted = 0
+            <if test="intakeNum != null and intakeNum != ''">
+                AND inta.name LIKE CONCAT('%', #{intakeNum})
+            </if>
+        </where>
+        ORDER BY inta.id DESC
+    </select>
+
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0