From ec63fb17c5ba3e5b2a5a4106c25b4e249a2f980f Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 22 十一月 2022 18:44:51 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
index 190ac59..b16fbe5 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
@@ -17,10 +17,8 @@
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -50,12 +48,10 @@
LedSFile sFile = new LedSFile();
BeanUtils.copyProperties(fileUploadDto, sFile);
sFile.setCilentId(SecurityUtils.getClientId());
- if (SecurityUtils.getClientId() != null) {
- sFile.setUserId(SecurityUtils.getUserId());
- sFile.setUserName(SecurityUtils.getUsername());
- if (clientService.findClientId()) {
- sFile.setCilentId(clientService.getClientId());
- }
+ sFile.setUserId(SecurityUtils.getUserId());
+ sFile.setUserName(SecurityUtils.getUsername());
+ if (clientService.findClientId()) {
+ sFile.setCilentId(clientService.getClientId());
}
/**
* 鐔欐睕鏂囦欢涓婁紶 鏃ュ織璁板綍寮�濮�
@@ -68,21 +64,24 @@
return save(sFile);
}
- public boolean deleteFile(Long id) {
- LedSFile byId = getById(id);
- if (byId == null) {
+ public boolean deleteFile(List<Long> fileIds) {
+ if (fileIds.isEmpty()) {
+ throw new BusinessException("鏂囦欢id涓嶈兘涓虹┖");
+ }
+ List<LedSFile> ledSFiles = listByIds(fileIds);
+ if (ledSFiles.isEmpty()) {
throw new BusinessException("鏈壘鍒拌鑺傜洰");
}
/**
* 鐔欐睕鏂囦欢鍒犻櫎 鏃ュ織璁板綍寮�濮�
*/
- String content = "鏂囦欢鍐呭id:" + id + "鏂囦欢鍐呭:" + JSON.toJSONString(byId);
+ String content = "鏂囦欢鍐呭id:" + fileIds + "鏂囦欢鍐呭:" + JSON.toJSONString(ledSFiles);
StoreOperationRecordsUtils.storeOperationData(null, null, "鐔欐睕鏂囦欢鍒犻櫎", content);
/**
* 鐔欐睕鏂囦欢鍒犻櫎 鏃ュ織璁板綍缁撴潫
*/
- return removeById(id);
+ return removeByIds(fileIds);
}
--
Gitblit v1.9.3