From aac3b819f2228192d918c419488a1dbc315443cc Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期三, 16 八月 2023 14:26:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
index a39956c..1dee4da 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.alarmpoints.tube.service.impl;
import java.util.List;
+
import com.ruoyi.alarmpoints.tube.domain.ArdTubes;
import com.ruoyi.alarmpoints.tube.domain.ArdTubesDetails;
import com.ruoyi.alarmpoints.tube.mapper.ArdTubesDetailsMapper;
@@ -9,7 +10,9 @@
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.stereotype.Service;
+
import javax.annotation.Resource;
/**
@@ -24,6 +27,7 @@
private ArdTubesMapper ardTubesMapper;
@Resource
private ArdTubesDetailsMapper ardTubesDetailsMapper;
+
/**
* 鏌ヨ绠$嚎绠$悊
*
@@ -44,13 +48,16 @@
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<ArdTubes> selectArdTubesList(ArdTubes ardTubes) {
- ArdTubesDetails tubesDetails=new ArdTubesDetails();
- tubesDetails.setTubeId(ardTubes.getId());
- List<ArdTubesDetails> ardTubesDetails = ardTubesDetailsMapper.selectArdTubesDetailsList(tubesDetails);
- ArdTubes arttube=new ArdTubes();
- arttube.setChildCount(ardTubesDetails.size());
- ardTubesMapper.updateArdTubes(arttube);
- return ardTubesMapper.selectArdTubesList(ardTubes);
+
+ List<ArdTubes> tubes = ardTubesMapper.selectArdTubesList(ardTubes);
+ for (ArdTubes tube : tubes) {
+ ArdTubesDetails tubesDetails = new ArdTubesDetails();
+ tubesDetails.setTubeId(tube.getId());
+ List<ArdTubesDetails> ardTubesDetails = ardTubesDetailsMapper.selectArdTubesDetailsList(tubesDetails);
+ tube.setChildCount(ardTubesDetails.size());
+ ardTubesMapper.updateArdTubes(tube);
+ }
+ return tubes;
}
/**
@@ -61,6 +68,7 @@
*/
@Override
public int insertArdTubes(ArdTubes ardTubes) {
+ ardTubes.setId(IdUtils.simpleUUID());
ardTubes.setChildCount(0);
ardTubes.setUserId(SecurityUtils.getUserId());
ardTubes.setCreateBy(SecurityUtils.getUsername());
@@ -90,11 +98,11 @@
*/
@Override
public int deleteArdTubesByIds(String[] ids) {
- for (String id: ids ) {
- ArdTubesDetails tubesDetails=new ArdTubesDetails();
+ for (String id : ids) {
+ ArdTubesDetails tubesDetails = new ArdTubesDetails();
tubesDetails.setTubeId(id);
List<ArdTubesDetails> ardTubesDetails = ardTubesDetailsMapper.selectArdTubesDetailsList(tubesDetails);
- if(ardTubesDetails.size()>0) {
+ if (ardTubesDetails.size() > 0) {
for (ArdTubesDetails tubesDetail : ardTubesDetails) {
int i = ardTubesDetailsMapper.deleteArdTubesDetailsById(tubesDetail.getId());
}
@@ -111,10 +119,10 @@
*/
@Override
public int deleteArdTubesById(String id) {
- ArdTubesDetails tubesDetails=new ArdTubesDetails();
+ ArdTubesDetails tubesDetails = new ArdTubesDetails();
tubesDetails.setTubeId(id);
List<ArdTubesDetails> ardTubesDetails = ardTubesDetailsMapper.selectArdTubesDetailsList(tubesDetails);
- if(ardTubesDetails.size()>0) {
+ if (ardTubesDetails.size() > 0) {
for (ArdTubesDetails tubesDetail : ardTubesDetails) {
int i = ardTubesDetailsMapper.deleteArdTubesDetailsById(tubesDetail.getId());
}
--
Gitblit v1.9.3