Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
zyx.net
2022-08-11 11:01:04 +08:00
5 changed files with 151 additions and 138 deletions
@@ -511,9 +511,6 @@ INSERT INTO `laws_weilai`.`sys_permission`(`id`, `parent_id`, `name`, `url`, `co
-- 角色表-增加对外报告管理员角色 2022-7-28 已同步生产环境 -- 角色表-增加对外报告管理员角色 2022-7-28 已同步生产环境
INSERT INTO `sys_role` VALUES ('1552536424587862017', '对外报告管理员', 'ExternalReportsManager', '对外报告文件夹列表的管理员', 'admin', '2022-7-28 14:08:23', NULL, NULL, NULL, NULL); INSERT INTO `sys_role` VALUES ('1552536424587862017', '对外报告管理员', 'ExternalReportsManager', '对外报告文件夹列表的管理员', 'admin', '2022-7-28 14:08:23', NULL, NULL, NULL, NULL);
-- 菜单管理 添加对外报告文件夹管理按钮权限 2022-07-28 已同步生产环境
INSERT INTO `sys_permission` VALUES ('1552182885208608770', '1549937961282908162', '对外报告文件夹管理', '', NULL, NULL, NULL, 2, 'externalReports:folder', '1', 1.00, 0, NULL, 1, 1, 0, 0, NULL, 'admin', '2022-7-27 14:43:33', NULL, NULL, 0, 0, '1', 0, 'External Report Folder Management ');
-- 对外报告文件夹表 2022-7-29 已同步生产环境 -- 对外报告文件夹表 2022-7-29 已同步生产环境
DROP TABLE IF EXISTS `ext_repo_folder`; DROP TABLE IF EXISTS `ext_repo_folder`;
CREATE TABLE `ext_repo_folder` ( CREATE TABLE `ext_repo_folder` (
@@ -11,7 +11,6 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.oss.CosBootUtil; import com.jero.common.util.oss.CosBootUtil;
import com.jero.modules.extRepo.entity.ExtRepoData; import com.jero.modules.extRepo.entity.ExtRepoData;
import com.jero.modules.extRepo.entity.ExtRepoDataPage; 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.IExtRepoDataService;
import com.jero.modules.extRepo.service.IExtRepoFolderService; import com.jero.modules.extRepo.service.IExtRepoFolderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -185,16 +184,8 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
Result<ExtRepoData> result = new Result(); Result<ExtRepoData> result = new Result();
ExtRepoData erd = extRepoDataService.queryById(id); ExtRepoData erd = extRepoDataService.queryById(id);
if (null != erd) { if (null != erd) {
int count = getRootFolderCount();
if (erd.getSupFolder().equals("root") && count <= 1) {
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("此文件夹不可删除!");
} else {
result.error500("This folder cannot be deleted!");
}
} else {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (sysUser.getUsername().equals(erd.getCreateBy())) { if (extRepoFolderService.isManager() || sysUser.getUsername().equals(erd.getCreateBy())) {
extRepoDataService.deleteById(id); extRepoDataService.deleteById(id);
CosBootUtil.delete(erd.getFileKey()); CosBootUtil.delete(erd.getFileKey());
if (CutEnum.CN.getValue().equals(cut)) { if (CutEnum.CN.getValue().equals(cut)) {
@@ -209,7 +200,6 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
result.error500("You do not have permission!"); result.error500("You do not have permission!");
} }
} }
}
} else { } else {
if (CutEnum.CN.getValue().equals(cut)) { if (CutEnum.CN.getValue().equals(cut)) {
result.error500("删除失败!"); result.error500("删除失败!");
@@ -220,11 +210,6 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
return result; return result;
} }
private int getRootFolderCount() {
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
return extRepoFolderService.count(queryWrapper);
}
/** /**
* 批量删除 * 批量删除
@@ -1,5 +1,6 @@
package com.jero.modules.extRepo.controller; package com.jero.modules.extRepo.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum; import com.jero.common.constant.enums.CutEnum;
@@ -63,6 +64,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) { public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
Result<ExtRepoFolder> result = new Result(); Result<ExtRepoFolder> result = new Result();
if (extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) { if (extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
if (!extRepoFolder.isAddSub()) {
//增加同级文件夹
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
extRepoFolder.setSupFolder(folder.getSupFolder());
}
extRepoFolderService.add(extRepoFolder); extRepoFolderService.add(extRepoFolder);
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) { if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
result.success("添加成功!"); result.success("添加成功!");
@@ -122,6 +128,15 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
if (extRepoFolderService.haveManageAuth(id)) { if (extRepoFolderService.haveManageAuth(id)) {
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id); List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
if (resList.isEmpty()) { if (resList.isEmpty()) {
ExtRepoFolder erf = extRepoFolderService.queryById(id);
int count = getRootFolderCount();
if (erf.getSupFolder().equals("root") && count <= 1) {
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("此文件夹不可删除!");
} else {
result.error500("This folder cannot be deleted!");
}
} else {
List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id); List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id);
for (ExtRepoData erd : erdList) { for (ExtRepoData erd : erdList) {
extRepoDataService.deleteById(erd.getId()); extRepoDataService.deleteById(erd.getId());
@@ -132,6 +147,7 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
} else { } else {
result.success("Data deletion successfully!"); result.success("Data deletion successfully!");
} }
}
} else { } else {
if (CutEnum.CN.getValue().equals(cut)) { if (CutEnum.CN.getValue().equals(cut)) {
result.error500("请先删除子文件夹!"); result.error500("请先删除子文件夹!");
@@ -149,6 +165,13 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
return result; return result;
} }
private int getRootFolderCount() {
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
return extRepoFolderService.count(queryWrapper);
}
/** /**
* 通过id查询 * 通过id查询
* *
@@ -96,4 +96,7 @@ public class ExtRepoFolder implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String cut; private String cut;
@TableField(exist = false)
private boolean addSub;
} }
@@ -387,11 +387,16 @@
::v-deep .ant-select-tree-treenode-switcher-close { ::v-deep .ant-select-tree-treenode-switcher-close {
width: 255px; width: 255px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
::v-deep .ant-select-tree-node-content-wrapper{
::v-deep .ant-select-tree-node-content-wrapper {
float: right;
margin-top: -2px!important;
}
::v-deep .ant-select-tree-title {
width: 100%;
display: block;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;