修改对外报告-修改最后一个一级文件夹不能删
This commit is contained in:
+27
-13
@@ -9,12 +9,11 @@ import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.oss.CosBootUtil;
|
||||
import com.jero.generater.modules.online.auth.entity.OnlAuthData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoDataPage;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -74,13 +73,13 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
|
||||
// 文件名称模糊查询
|
||||
String fileName = req.getParameter("fileName");
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
fileName = fileName.replace("%","\\%");
|
||||
fileName = fileName.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getFileName, fileName);
|
||||
}
|
||||
// 上传人模糊查询
|
||||
String createBy = req.getParameter("createBy");
|
||||
if (StringUtils.isNotBlank(createBy)) {
|
||||
createBy = createBy.replace("%","\\%");
|
||||
createBy = createBy.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getCreateBy, createBy);
|
||||
}
|
||||
// 更新时间查询
|
||||
@@ -186,20 +185,29 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser.getUsername().equals(erd.getCreateBy())) {
|
||||
extRepoDataService.deleteById(id);
|
||||
CosBootUtil.delete(erd.getFileKey());
|
||||
int count = getRootFolderCount();
|
||||
if (erd.getSupFolder().equals("root") && count <= 1) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
result.error500("此文件夹不可删除!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
result.error500("This folder cannot be deleted!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser.getUsername().equals(erd.getCreateBy())) {
|
||||
extRepoDataService.deleteById(id);
|
||||
CosBootUtil.delete(erd.getFileKey());
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -212,6 +220,12 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getRootFolderCount() {
|
||||
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
|
||||
return extRepoFolderService.count(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user