From 3df8757ade3bdef3b5a142c846680102589260bc Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 13 Jul 2022 10:36:37 +0800
Subject: [PATCH] 农事操作,种植记录查询新增,地块,溯源码查询修改
---
src/main/java/org/springblade/modules/farm/mapper/FarmMapper.xml | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/springblade/modules/farm/mapper/FarmMapper.xml b/src/main/java/org/springblade/modules/farm/mapper/FarmMapper.xml
index 2ea4b48..666711f 100644
--- a/src/main/java/org/springblade/modules/farm/mapper/FarmMapper.xml
+++ b/src/main/java/org/springblade/modules/farm/mapper/FarmMapper.xml
@@ -11,13 +11,40 @@
slogan,
introduce,
picture,
- ST_ASTEXT(position) as position,user_id
+ ST_ASTEXT(position) as position
from
sys_farm
where 1=1
+ <if test="farm.farmName!=null and farm.farmName!=''">
+ and farm_name like concat('%',#{farm.farmName},'%')
+ </if>
+ <if test="farm.deptId!=null and farm.deptId!=''">
+ and dept_id = #{farm.deptId}
+ </if>
</select>
- <!--自定义修改电子围栏数据-->
+ <!--自定义查询农场列表数据(不分页)-->
+ <select id="getFarmList" resultType="org.springblade.modules.farm.vo.FarmVO">
+ select id,
+ farm_name,
+ farm_address,
+ farm_area,
+ slogan,
+ introduce,
+ picture,
+ ST_ASTEXT(position) as position
+ from
+ sys_farm
+ where 1=1
+ <if test="farm.farmName!=null and farm.farmName!=''">
+ and farm_name like concat('%',#{farm.farmName},'%')
+ </if>
+ <if test="farm.deptId!=null and farm.deptId!=''">
+ and dept_id = #{farm.deptId}
+ </if>
+ </select>
+
+ <!--自定义修改农场围栏数据-->
<update id="updateFarmById">
update sys_farm set farm_name = #{farm.farmName},
farm_address = #{farm.farmAddress},
@@ -32,6 +59,22 @@
where id = #{farm.id}
</update>
+ <!--自定义新增农场围栏数据-->
+ <insert id="saveFarmInfo">
+ insert into sys_farm (farm_name,farm_address,farm_area,slogan,introduce,picture,position,create_time,update_time,dept_id)
+ values
+ (#{farm.farmName},#{farm.farmAddress},#{farm.farmArea},#{farm.slogan},#{farm.introduce},#{farm.picture},
+ <choose>
+ <when test="farm.position!=null and farm.position!=''">
+ ST_GeomFromText(${farm.position}),
+ </when>
+ <otherwise>
+ null,
+ </otherwise>
+ </choose>
+ #{farm.createTime},#{farm.updateTime},#{farm.deptId})
+ </insert>
+
<!--详情信息(自定义查询)-->
<select id="getFarmInfo" resultType="org.springblade.modules.farm.vo.FarmVO">
select id,
@@ -45,7 +88,7 @@
from
sys_farm
where 1=1
- and dept_id = #{farm.deptId}
+ and id = #{farm.id}
</select>
<!--农场数量-->
--
Gitblit v1.9.3