From f34dc97df6dc9f4480e7903016f104388ec1a7ab Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期四, 23 五月 2024 11:34:47 +0800
Subject: [PATCH] 田间灌溉项目管理 轮灌组 修改查一个、分页查、轮灌组绑定灌溉单元变物理删除
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml | 33 ++++++----------
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java | 12 +++++-
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java | 8 +++-
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java | 6 --
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml | 12 ++++--
5 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java
index 5ec4a32..20366dc 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupUnitMapper.java
@@ -5,6 +5,8 @@
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* @author :WuZeYu
* @Date :2024/5/22 13:41
@@ -16,8 +18,7 @@
//澧�
int insertSelective(IrGroupUnit record);
- //鍒�
- int deleteLogicById(Long id);
+
//鍒燽y unitId groupId
int deleteByUnitIdGroupId(IrGroupUnit record);
@@ -25,4 +26,7 @@
int deleteByUnitId(Long unitId);
//鍒燽y groupId
int deleteByGroupId(Long groupId);
+
+ //鏌ヤ竴涓疆鐏岀粍缁戝畾鐨勭亴婧夊崟鍏僫d
+ List<Long> getGroupBindUnits(Long groupId);
}
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java
index 766d3db..8256734 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupUnit.java
@@ -69,9 +69,5 @@
private Date operateDt;
- /**
- * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎
- */
- @Schema(description = "鍒犻櫎鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
- private Byte deleted;
+
}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml
index 4fa6d92..d512779 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupUnitMapper.xml
@@ -9,12 +9,11 @@
<result column="unit_id" jdbcType="BIGINT" property="unitId" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
- <result column="deleted" jdbcType="TINYINT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, group_id, unit_id, `operator`,
- operate_time, deleted
+ operate_time
</sql>
<!--娣诲姞-->
@@ -37,9 +36,7 @@
<if test="operateDt != null">
operate_time,
</if>
- <if test="deleted != null">
- deleted,
- </if>
+
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -57,35 +54,29 @@
<if test="operateDt != null">
#{operateDt,jdbcType=TIMESTAMP},
</if>
- <if test="deleted != null">
- #{deleted,jdbcType=TINYINT},
- </if>
+
</trim>
</insert>
- <!--閫昏緫鍒犻櫎-->
- <delete id="deleteLogicById" parameterType="java.lang.Long">
- <!--@mbg.generated-->
- update ir_group_unit
- set deleted = 1
- where id = #{id,jdbcType=BIGINT}
- </delete>
+
<delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
- update ir_group_unit
- set deleted = 1,operator = #{operator,jdbcType=BIGINT},operate_time = #{operateDt,jdbcType=TIMESTAMP}
+ delete from ir_group_unit
where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT}
</delete>
<delete id="deleteByUnitId">
- update ir_group_unit
- set deleted = 1
+ delete from ir_group_unit
where unit_id = #{unitId,jdbcType=BIGINT}
</delete>
<delete id="deleteByGroupId">
- update ir_group_unit
- set deleted = 1
+ delete from ir_group_unit
where group_id = #{groupId,jdbcType=BIGINT}
</delete>
+
+<!-- //鏌ヤ竴涓疆鐏岀粍缁戝畾鐨勭亴婧夊崟鍏僫d-->
+ <select id="getGroupBindUnits" parameterType="Long" resultType="java.lang.Long">
+ SELECT unit_id AS unitId FROM `ir_group_unit`WHERE group_id = #{groupId,jdbcType=BIGINT}
+ </select>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml
index fa78683..ae93ff0 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateGroupMapper.xml
@@ -119,7 +119,7 @@
left join ir_project pro on pro.id = gro.project_id
left join se_client cli on cli.id = gro.operator
left join ir_group_unit gu on gu.group_id = gro.id
- where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
+ where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0 and pro.deleted != 1
</select>
<!--鍒嗛〉鏌ヨ疆鐏岀粍-->
@@ -139,7 +139,7 @@
left join se_client cli on cli.id = gro.operator
left join ir_group_unit gu on gu.group_id = gro.id
<where>
- gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
+ gro.deleted = 0 and pro.deleted != 1
<if test="projectName != null and projectName != ''">
AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
</if>
@@ -147,6 +147,7 @@
AND gro.group_code = #{groupCode}
</if>
</where>
+ GROUP BY gro.id
ORDER BY gro.operate_time DESC
<if test="pageCurr != null and pageSize != null">
LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
@@ -154,13 +155,14 @@
</select>
<!--鍒嗛〉鏌ヨ疆鐏岀粍璁板綍鏁�-->
<select id="getRecordCount" resultType="java.lang.Long">
- SELECT COUNT(*) AS recordCount
+ SELECT COUNT(*) FROM(
+ SELECT COUNT(*),gro.id AS recordCount
from ir_irrigate_group gro
left join ir_project pro on pro.id = gro.project_id
left join se_client cli on cli.id = gro.operator
left join ir_group_unit gu on gu.group_id = gro.id
<where>
- gro.deleted = 0 and gu.deleted = 0 and pro.deleted = 0
+ gro.deleted = 0 and pro.deleted != 1
<if test="projectName != null and projectName != ''">
AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
</if>
@@ -168,5 +170,7 @@
AND gro.group_code = #{groupCode}
</if>
</where>
+ GROUP BY gro.id
+ ) a
</select>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
index f776ad5..4929306 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
@@ -110,7 +110,6 @@
*/
public Integer addGroupUnit(IrGroupUnit po) {
po.setOperateDt(new Date());
- po.setDeleted((byte) 0);
int rows = irGroupUnitMapper.insertSelective(po);
if (rows == 0) {
return 0;
@@ -125,11 +124,20 @@
* @return
*/
public Integer deleteGroupUnit(IrGroupUnit po) {
- po.setOperateDt(new Date());
int rows = irGroupUnitMapper.deleteByUnitIdGroupId(po);
if (rows == 0) {
return 0;
}
return 1;
}
+
+ /**
+ * 鏌ヤ竴涓疆鐏岀粍缁戝畾鐨勭亴婧夊崟鍏僫d
+ * @param groupId
+ * @return
+ */
+ public List<Long> getGroupBindUnits(Long groupId) {
+ List<Long> groupBindUnits = irGroupUnitMapper.getGroupBindUnits(groupId);
+ return groupBindUnits;
+ }
}
--
Gitblit v1.8.0