From 4dfbe79d4beb7457343945e0f956bc0c6dd09b78 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 25 May 2022 08:32:24 +0800
Subject: [PATCH] 地块管理

---
 src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml b/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
index 4bd7a54..fef14ac 100644
--- a/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
+++ b/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -3,7 +3,7 @@
 <mapper namespace="org.springblade.modules.lang.mapper.LandMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="landResultMap" type="org.springblade.modules.lang.entity.Land">
+    <resultMap id="landResultMap" type="org.springblade.modules.lang.vo.LandVO">
         <result column="id" property="id"/>
         <result column="user_id" property="userId"/>
         <result column="land_name" property="landName"/>
@@ -16,9 +16,20 @@
 
 
     <select id="selectLandPage" resultMap="landResultMap">
-        select *
-        from sys_land
-        where is_deleted = 0
+        SELECT l.land_name,
+               l.land_area ,
+               ST_ASTEXT(land_range) as land_range,
+               l.url,
+               d.dict_value as dic,
+               c.dict_value as dica
+        FROM `sys_land` l
+                 LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0) d
+                           ON d.dict_key = l.land_type
+                 LEFT JOIN (SELECT dict_key, dict_value
+                            FROM blade_dict_biz
+                            WHERE CODE = 'landunit'
+                              AND is_deleted = 0) c ON c.dict_key = l.type
+        where l.is_deleted = 0
     </select>
 
     <insert id="saveLandInfo">
@@ -42,7 +53,8 @@
                type,
                land_unit
         from sys_land
-        where 1 = 1 and is_deleted = 0
+        where 1 = 1
+          and is_deleted = 0
           and id = #{land.id}
     </select>
 
@@ -61,18 +73,29 @@
     </update>
 
     <select id="selectLandList" resultType="java.util.HashMap">
-      select id,land_name as landName from sys_land where user_id=#{userid} and is_deleted = 0
+        select id, land_name as landName
+        from sys_land
+        where user_id = #{userid}
+          and is_deleted = 0
     </select>
     <!--土地总面积-->
     <select id="selectZAre" resultType="java.util.HashMap">
-        SELECT land_area as area,land_unit as unit FROM sys_land WHERE is_deleted=0
+        SELECT land_area as area, land_unit as unit
+        FROM sys_land
+        WHERE is_deleted = 0
     </select>
     <!--土地使用面积-->
     <select id="selectSAre" resultType="java.util.HashMap">
-        SELECT land_area as area,land_unit as unit FROM sys_land WHERE is_deleted=0 and type=0
+        SELECT land_area as area, land_unit as unit
+        FROM sys_land
+        WHERE is_deleted = 0
+          and type = 0
     </select>
     <select id="selectNum" resultType="java.util.HashMap">
-        SELECT strain_id FROM `sys_farm_plant` WHERE status=1 GROUP BY strain_id
+        SELECT strain_id
+        FROM `sys_farm_plant`
+        WHERE status = 1
+        GROUP BY strain_id
     </select>
 
 </mapper>

--
Gitblit v1.9.3