From 72b971c98c46531064d74b68fc8fe8864ed0b544 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 08 Nov 2022 09:04:56 +0800
Subject: [PATCH] 大屏溯源统计次数sql修改
---
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml | 69 ++++++++++++++++++++++------------
1 files changed, 45 insertions(+), 24 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 2f5c3ad..61d41a9 100644
--- a/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
+++ b/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -69,19 +69,24 @@
</select>
<!--查询地块列表(不分页)-->
- <select id="getLandList" resultType="org.springblade.modules.lang.vo.LandVO">
+ <select id="getLandList" resultMap="landResultMap">
SELECT
- id,
- land_name,
- land_area,
- ST_ASTEXT(land_range) as land_range,
- url,
- type,
- land_type,
- land_unit,
- dept_id,
- farm_id
- FROM sys_land
+ l.id,
+ l.land_name,
+ l.land_area,
+ ST_ASTEXT(l.land_range) as land_range,
+ l.url,
+ l.type,
+ l.land_type,
+ l.land_unit,
+ l.dept_id,
+ l.farm_id,
+ GROUP_CONCAT(a.url) AS strainUrl
+ FROM sys_land l
+ LEFT JOIN
+ (
+ SELECT sfp.strain_id,strain.url,sfp.land_id FROM sys_farm_plant sfp LEFT JOIN sys_strain strain ON strain.id = sfp.strain_id WHERE sfp.`status` = 1
+ ) a ON l.id = a.land_id
where is_deleted = 0
<if test="land.landType!=null and land.landType != ''">
and land_type = #{land.landType}
@@ -101,6 +106,7 @@
<if test="land.farmId!=null and land.farmId != ''">
and farm_id =#{land.farmId}
</if>
+ GROUP BY l.id
</select>
<insert id="saveLandInfo">
@@ -121,18 +127,22 @@
<!--详情信息(自定义查询)-->
<select id="getLandInfo" resultType="org.springblade.modules.lang.vo.LandVO">
- select user_id,
- land_name,
- land_type,
- land_area,
- ST_ASTEXT(land_range) as landRange,
- type,
- land_unit,
- url
- from sys_land
+ select
+ l.user_id,
+ l.land_name,
+ l.land_type,
+ l.land_area,
+ ST_ASTEXT(l.land_range) as landRange,
+ l.type,
+ l.land_unit,
+ l.url,
+ bdb.dict_value dica
+ from sys_land l
+ LEFT JOIN blade_dict_biz bdb ON l.land_unit = bdb.dict_key
where 1 = 1
- and is_deleted = 0
- and id = #{land.id}
+ and l.is_deleted = 0
+ AND bdb.code = 'landunit' AND bdb.tenant_id = '000000' AND bdb.is_deleted = 0
+ and l.id = #{land.id}
</select>
<!--自定义地块数据-->
@@ -246,7 +256,7 @@
SELECT DISTINCT land.id,land.land_name,land.url,land.farm_id
FROM sys_land land
LEFT JOIN sys_farm_plant sfp ON sfp.land_id = land.id
- WHERE land.is_deleted = 0
+ WHERE land.is_deleted = 0 AND sfp.planting_way !=2
<if test="land.strainId !=null and land.strainId !=''">
AND sfp.strain_id = #{land.strainId}
</if>
@@ -264,5 +274,16 @@
WHERE land.is_deleted = 0 AND sfp.status = 1
AND land.id = #{ids}
</select>
+ <select id="selectRecoveryLandList" resultType="org.springblade.modules.lang.vo.LandVO">
+ SELECT
+ DISTINCT l.id,l.land_name AS landName
+ FROM
+ sys_recovery r
+ LEFT JOIN sys_land l ON r.land_id = l.id
+ WHERE l.is_deleted = 0
+ <if test="farmId !=null and farmId !=''">
+ AND r.dept_id = #{farmId}
+ </if>
+ </select>
</mapper>
--
Gitblit v1.9.3