From e55c8b0a92eb9715edd90c31dfd4de51a47b588b Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 04 十一月 2022 17:40:08 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java |   54 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
index a9d6988..bcf3a7d 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
@@ -1,6 +1,7 @@
 package com.sandu.ximon.admin.service;
 
 import com.alibaba.fastjson.JSON;
+import com.alipay.service.schema.util.StringUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.PageHelper;
@@ -60,31 +61,33 @@
         return save(file);
     }
 
-    public boolean deleteFile(Long fileId) {
-        IpVolumeFile byId = getById(fileId);
-        String bucketName;
-        if (SecurityUtils.getClientId() == null) {
-            bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName();
-        } else {
-            bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId();
-        }
-        if (byId == null) {
-            throw new BusinessException("鎵句笉鍒板搴旀枃浠�");
-        }
-        boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName());
+    public boolean deleteFile(List<Long> fileIds) {
+        fileIds.forEach(fileId -> {
+            IpVolumeFile byId = getById(fileId);
+            String bucketName;
+            if (SecurityUtils.getClientId() == null) {
+                bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName();
+            } else {
+                bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId();
+            }
+            if (byId == null) {
+                throw new BusinessException("鎵句笉鍒板搴旀枃浠�");
+            }
+            boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName());
 //        if (!b) {
 //            throw new BusinessException("鏈嶅姟鍣ㄥ垹闄ゅけ璐�");
 //        }
-        /**
-         * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍寮�濮�
-         */
-        String content = "鍒犻櫎鏂囦欢id:" + fileId + "闊虫煴鏂囦欢鍚嶇О锛�" + byId.getFileName() + "锛屾枃浠跺ぇ灏忥細" + byId.getOriginSize() + "锛屾枃浠惰矾寰勶細" + byId.getFileUrl();
-        StoreOperationRecordsUtils.storeOperationData(null, null, "闊虫煴鏂囦欢鍒犻櫎", content);
-        /**
-         * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍缁撴潫
-         */
+            /**
+             * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍寮�濮�
+             */
+            String content = "鍒犻櫎鏂囦欢id:" + fileId + "闊虫煴鏂囦欢鍚嶇О锛�" + byId.getFileName() + "锛屾枃浠跺ぇ灏忥細" + byId.getOriginSize() + "锛屾枃浠惰矾寰勶細" + byId.getFileUrl();
+            StoreOperationRecordsUtils.storeOperationData(null, null, "闊虫煴鏂囦欢鍒犻櫎", content);
+            /**
+             * 闊虫煴鏂囦欢鍒犻櫎 鏃ュ織璁板綍缁撴潫
+             */
 
-        return removeById(fileId);
+        });
+        return removeByIds(fileIds);
     }
 
     public List<IpVolumeFile> ipVolumeFileList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) {
@@ -128,13 +131,15 @@
         //鎺掑簭鏂瑰紡
         String orderBy = orderByResult + " " + orderBySeq;
 
-        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
+        if (baseConditionVO != null) {
+            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
+        }
         List<IpVolumeFile> list = list(wrapper);
 
         return list;
     }
 
-    public List<IpVolumeFile> listFiles() {
+    public List<IpVolumeFile> listFiles(String keyword) {
         LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class);
 
         //涓嶆槸瓒呯
@@ -144,6 +149,9 @@
                         file.eq(IpVolumeFile::getUserId, SecurityUtils.getUserId());
                     });
         }
+        if (keyword != null && !StringUtil.isEmpty(keyword)) {
+            wrapper.like(IpVolumeFile::getFileName, keyword);
+        }
         return list(wrapper);
     }
 

--
Gitblit v1.9.3