From 0dd09dec1b5b2f8869c27c0bde2bd6e4881a5fd3 Mon Sep 17 00:00:00 2001 From: liangwen <2357318727@qq.com> Date: Thu, 11 Sep 2025 14:40:08 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=94=A8=E6=88=B7=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=88=A0=E6=9F=A5=E6=94=B9=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E8=AE=BF=E9=97=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=AD=97=E6=AE=B5=EF=BC=9B=202=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=87=E4=BB=B6=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?API=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0=EF=BC=9B=203=E3=80=81?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AF=B9=E5=BA=94=E8=A7=92=E8=89=B2=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=A0=91=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=9B=204=E3=80=81=E4=BF=AE=E6=94=B9=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=96=87=E4=BB=B6=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0=EF=BC=9B=205=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E7=B1=BB=E5=8F=8ATreeSelec?= =?UTF-8?q?t=E6=A0=91=E7=8A=B6=E7=B1=BB=E6=9E=84=E9=80=A0=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysRoleController.java | 49 ++++- .../file/api/ISysRoleUserFileService.java | 18 ++ .../com/ruoyi/file/api/IUserFileService.java | 7 + .../ruoyi/file/controller/FileController.java | 64 ++++-- .../java/com/ruoyi/file/domain/UserFile.java | 3 + .../com/ruoyi/file/dto/file/UserFileDTO.java | 182 +++++++++++++++++ .../com/ruoyi/file/mapper/UserFileMapper.java | 4 +- .../file/service/SysRoleUserFileService.java | 74 +++++++ .../ruoyi/file/service/UserFileService.java | 103 +++++++++- .../com/ruoyi/file/util/FileTreeSelect.java | 61 ++++++ .../com/ruoyi/file/vo/file/FileListVO.java | 2 + .../main/resources/mapper/UserFileMapper.xml | 46 ++++- .../ruoyi/common/core/domain/TreeSelect.java | 21 -- .../core/domain/entity/KnowledgeCategory.java | 122 ------------ .../core/domain/entity/SysFacility.java | 122 ------------ .../common/core/domain/entity/SysRole.java | 29 ++- .../core/domain/entity/WorkOrderCategory.java | 188 ------------------ .../service/impl/SysRoleServiceImpl.java | 46 ++--- .../resources/mapper/system/SysRoleMapper.xml | 40 ++-- 19 files changed, 649 insertions(+), 532 deletions(-) create mode 100644 hb-file/src/main/java/com/ruoyi/file/api/ISysRoleUserFileService.java create mode 100644 hb-file/src/main/java/com/ruoyi/file/dto/file/UserFileDTO.java create mode 100644 hb-file/src/main/java/com/ruoyi/file/service/SysRoleUserFileService.java create mode 100644 hb-file/src/main/java/com/ruoyi/file/util/FileTreeSelect.java delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/KnowledgeCategory.java delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysFacility.java delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WorkOrderCategory.java diff --git a/hb-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/hb-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 834f957..5427b3a 100644 --- a/hb-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/hb-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -3,7 +3,13 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.ruoyi.common.utils.lang.LangUnit; +import com.ruoyi.file.api.ISysRoleUserFileService; +import com.ruoyi.file.api.IUserFileService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -36,9 +42,11 @@ import com.ruoyi.system.service.ISysUserService; /** * 角色信息 - * + * * @author ruoyi */ +@Api(tags = "6 角色信息接口") +@ApiSupport(order = 6) @RestController @RequestMapping("/system/role") public class SysRoleController extends BaseController @@ -61,6 +69,12 @@ public class SysRoleController extends BaseController @Autowired private LangUnit langUnit; + @Autowired + private IUserFileService userFileService; + + @Autowired + private ISysRoleUserFileService sysRoleUserFileService; + @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") public TableDataInfo list(SysRole role) @@ -138,7 +152,7 @@ public class SysRoleController extends BaseController langUnit.getValueTag("sysRole.edit.1003","失败,角色权限已存在") ); } role.setUpdateBy(getUsername()); - + if (roleService.updateRole(role) > 0) { // 更新缓存用户权限 @@ -274,4 +288,35 @@ public class SysRoleController extends BaseController ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); return ajax; } + + + /** + * 获取对应角色文件树列表 + */ + @ApiOperation(value = "6.1 获取对应角色文件树列表") + @ApiOperationSupport(order = 1) + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/fileTree/{roleId}") + public AjaxResult fileTree(@PathVariable("roleId") Long roleId) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", sysRoleUserFileService.selectUserFileIdListByRoleId(roleId)); + ajax.put("files", userFileService.selectUserFileTreeList()); + return ajax; + } + + /** + * 修改保存文件数据权限 + */ + @ApiOperation(value = "6.2 修改保存文件数据权限") + @ApiOperationSupport(order = 2) + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/fileScope") + public AjaxResult fileScope(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + return toAjax(sysRoleUserFileService.authDataScope(role)); + } } diff --git a/hb-file/src/main/java/com/ruoyi/file/api/ISysRoleUserFileService.java b/hb-file/src/main/java/com/ruoyi/file/api/ISysRoleUserFileService.java new file mode 100644 index 0000000..56d2767 --- /dev/null +++ b/hb-file/src/main/java/com/ruoyi/file/api/ISysRoleUserFileService.java @@ -0,0 +1,18 @@ +package com.ruoyi.file.api; + +import com.ruoyi.common.core.domain.entity.SysRole; + +import java.util.List; + +public interface ISysRoleUserFileService { + + List selectUserFileIdListByRoleId(Long roleId); + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int authDataScope(SysRole role); +} diff --git a/hb-file/src/main/java/com/ruoyi/file/api/IUserFileService.java b/hb-file/src/main/java/com/ruoyi/file/api/IUserFileService.java index 5374f09..0394b62 100644 --- a/hb-file/src/main/java/com/ruoyi/file/api/IUserFileService.java +++ b/hb-file/src/main/java/com/ruoyi/file/api/IUserFileService.java @@ -3,6 +3,7 @@ package com.ruoyi.file.api; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.file.domain.UserFile; +import com.ruoyi.file.util.FileTreeSelect; import com.ruoyi.file.vo.file.FileListVO; import org.apache.ibatis.annotations.Param; @@ -23,4 +24,10 @@ public interface IUserFileService extends IService { List selectUserFileByLikeRightFilePath(@Param("filePath") String filePath, @Param("userId") Long userId); + /** + * 查询文件树结构信息 + * + * @return 文件树结构信息 + */ + public List selectUserFileTreeList(); } diff --git a/hb-file/src/main/java/com/ruoyi/file/controller/FileController.java b/hb-file/src/main/java/com/ruoyi/file/controller/FileController.java index f45ae0c..908e6b4 100644 --- a/hb-file/src/main/java/com/ruoyi/file/controller/FileController.java +++ b/hb-file/src/main/java/com/ruoyi/file/controller/FileController.java @@ -9,6 +9,8 @@ import co.elastic.clients.elasticsearch.core.search.Hit; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.qiwenshare.common.anno.MyLog; import com.qiwenshare.common.exception.QiwenException; import com.qiwenshare.common.result.RestResult; @@ -32,9 +34,9 @@ import com.ruoyi.file.util.TreeNode; import com.ruoyi.file.vo.file.FileDetailVO; import com.ruoyi.file.vo.file.FileListVO; import com.ruoyi.file.vo.file.SearchFileVO; -import io.swagger.v3.oas.annotations.Operation; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.eclipse.jetty.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -52,7 +54,9 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.regex.Pattern; -@Tag(name = "file", description = "该接口为文件接口,主要用来做一些文件的基本操作,如创建目录,删除,移动,复制等。") +//@Tag(name = "file", description = "该接口为文件接口,主要用来做一些文件的基本操作,如创建目录,删除,移动,复制等。") +@Api(tags = "5 文件接口") +@ApiSupport(order = 5) @RestController @Slf4j @RequestMapping("/file") @@ -77,7 +81,7 @@ public class FileController { public static final String CURRENT_MODULE = "文件接口"; - @Operation(summary = "创建文件", description = "创建文件", tags = {"file"}) + //@Operation(summary = "创建文件", description = "创建文件", tags = {"file"}) @ResponseBody @RequestMapping(value = "/createFile", method = RequestMethod.POST) public RestResult createFile(@Valid @RequestBody CreateFileDTO createFileDTO) { @@ -156,7 +160,7 @@ public class FileController { } } - @Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"}) + //@Operation(summary = "创建文件夹", description = "目录(文件夹)的创建", tags = {"file"}) @RequestMapping(value = "/createFold", method = RequestMethod.POST) @MyLog(operation = "创建文件夹", module = CURRENT_MODULE) @ResponseBody @@ -179,7 +183,9 @@ public class FileController { return RestResult.success(); } - @Operation(summary = "文件搜索", description = "文件搜索", tags = {"file"}) + //@Operation(summary = "文件搜索", description = "文件搜索", tags = {"file"}) + @ApiOperation(value = "5.1 文件搜索") + @ApiOperationSupport(order = 1) @GetMapping(value = "/search") @MyLog(operation = "文件搜索", module = CURRENT_MODULE) @ResponseBody @@ -245,7 +251,7 @@ public class FileController { } - @Operation(summary = "文件重命名", description = "文件重命名", tags = {"file"}) + //@Operation(summary = "文件重命名", description = "文件重命名", tags = {"file"}) @RequestMapping(value = "/renamefile", method = RequestMethod.POST) @MyLog(operation = "文件重命名", module = CURRENT_MODULE) @ResponseBody @@ -278,7 +284,9 @@ public class FileController { return RestResult.success(); } - @Operation(summary = "获取文件列表", description = "用来做前台列表展示", tags = {"file"}) + //@Operation(summary = "获取文件列表", description = "用来做前台列表展示", tags = {"file"}) + @ApiOperation(value = "5.2 获取文件列表") + @ApiOperationSupport(order = 2) @RequestMapping(value = "/getfilelist", method = RequestMethod.GET) @ResponseBody public RestResult getFileList( @@ -296,7 +304,7 @@ public class FileController { } - @Operation(summary = "批量删除文件", description = "批量删除文件", tags = {"file"}) + //@Operation(summary = "批量删除文件", description = "批量删除文件", tags = {"file"}) @RequestMapping(value = "/batchdeletefile", method = RequestMethod.POST) @MyLog(operation = "批量删除文件", module = CURRENT_MODULE) @ResponseBody @@ -315,7 +323,7 @@ public class FileController { return RestResult.success().message("批量删除文件成功"); } - @Operation(summary = "删除文件", description = "可以删除文件或者目录", tags = {"file"}) + //@Operation(summary = "删除文件", description = "可以删除文件或者目录", tags = {"file"}) @RequestMapping(value = "/deletefile", method = RequestMethod.POST) @MyLog(operation = "删除文件", module = CURRENT_MODULE) @ResponseBody @@ -329,7 +337,7 @@ public class FileController { } - @Operation(summary = "解压文件", description = "解压文件。", tags = {"file"}) + //@Operation(summary = "解压文件", description = "解压文件。", tags = {"file"}) @RequestMapping(value = "/unzipfile", method = RequestMethod.POST) @MyLog(operation = "解压文件", module = CURRENT_MODULE) @ResponseBody @@ -345,7 +353,7 @@ public class FileController { } - @Operation(summary = "文件复制", description = "可以复制文件或者目录", tags = {"file"}) + //@Operation(summary = "文件复制", description = "可以复制文件或者目录", tags = {"file"}) @RequestMapping(value = "/copyfile", method = RequestMethod.POST) @MyLog(operation = "文件复制", module = CURRENT_MODULE) @ResponseBody @@ -373,7 +381,7 @@ public class FileController { } - @Operation(summary = "文件移动", description = "可以移动文件或者目录", tags = {"file"}) + //@Operation(summary = "文件移动", description = "可以移动文件或者目录", tags = {"file"}) @RequestMapping(value = "/movefile", method = RequestMethod.POST) @MyLog(operation = "文件移动", module = CURRENT_MODULE) @ResponseBody @@ -399,7 +407,7 @@ public class FileController { } - @Operation(summary = "批量移动文件", description = "可以同时选择移动多个文件或者目录", tags = {"file"}) + //@Operation(summary = "批量移动文件", description = "可以同时选择移动多个文件或者目录", tags = {"file"}) @RequestMapping(value = "/batchmovefile", method = RequestMethod.POST) @MyLog(operation = "批量移动文件", module = CURRENT_MODULE) @ResponseBody @@ -428,7 +436,7 @@ public class FileController { } - @Operation(summary = "获取文件树", description = "文件移动的时候需要用到该接口,用来展示目录树", tags = {"file"}) + //@Operation(summary = "获取文件树", description = "文件移动的时候需要用到该接口,用来展示目录树", tags = {"file"}) @RequestMapping(value = "/getfiletree", method = RequestMethod.GET) @ResponseBody public RestResult getFileTree() { @@ -474,7 +482,7 @@ public class FileController { } - @Operation(summary = "修改文件", description = "支持普通文本类文件的修改", tags = {"file"}) + //@Operation(summary = "修改文件", description = "支持普通文本类文件的修改", tags = {"file"}) @RequestMapping(value = "/update", method = RequestMethod.POST) @ResponseBody public RestResult updateFile(@RequestBody UpdateFileDTO updateFileDTO) { @@ -509,7 +517,7 @@ public class FileController { return RestResult.success().message("修改文件成功"); } - @Operation(summary = "查询文件详情", description = "查询文件详情", tags = {"file"}) + //@Operation(summary = "查询文件详情", description = "查询文件详情", tags = {"file"}) @RequestMapping(value = "/detail", method = RequestMethod.GET) @ResponseBody public RestResult queryFileDetail( @@ -518,7 +526,25 @@ public class FileController { return RestResult.success().data(vo); } - - + //@Operation(summary = "修改文件访问权限", description = "修改文件访问权限", tags = {"file"}) + @ApiOperation(value = "5.4 修改文件访问权限") + @ApiOperationSupport(order = 4) + @RequestMapping(value = "/updateaccesspermission", method = RequestMethod.GET) + @ResponseBody + public RestResult updateAccessPermission( + @Parameter(description = "用户文件Id", required = true) String userFileId, + @Parameter(description = "访问权限 0禁止其他用户访问 1登录后可访问 2具备权限可访问", required = true) String accessPermission){ + try { + UserFile userFile = new UserFile(); + userFile.setUserFileId(userFileId); + userFile.setAccessPermission(accessPermission); + userFile.setModifyUserId(SecurityUtils.getUserId()); + userFile.setModifyTime(DateUtil.getCurrentTime()); + userFileService.updateById(userFile); + } catch (Exception e) { + throw new QiwenException(999999, "修改文件访问权限异常"); + } + return RestResult.success().message("修改文件访问权限成功"); + } } diff --git a/hb-file/src/main/java/com/ruoyi/file/domain/UserFile.java b/hb-file/src/main/java/com/ruoyi/file/domain/UserFile.java index 0d44692..2384f12 100644 --- a/hb-file/src/main/java/com/ruoyi/file/domain/UserFile.java +++ b/hb-file/src/main/java/com/ruoyi/file/domain/UserFile.java @@ -66,6 +66,9 @@ public class UserFile { @TableField(exist = false) private Long fileSize; + @Column(columnDefinition="char(1) comment '修改用户id'") + private String accessPermission; + public UserFile() {}; public UserFile(QiwenFile qiwenFile, Long userId, String fileId) { this.userFileId = IdUtil.getSnowflakeNextIdStr(); diff --git a/hb-file/src/main/java/com/ruoyi/file/dto/file/UserFileDTO.java b/hb-file/src/main/java/com/ruoyi/file/dto/file/UserFileDTO.java new file mode 100644 index 0000000..3472d28 --- /dev/null +++ b/hb-file/src/main/java/com/ruoyi/file/dto/file/UserFileDTO.java @@ -0,0 +1,182 @@ +package com.ruoyi.file.dto.file; + +import java.util.ArrayList; +import java.util.List; + +public class UserFileDTO { + private String userFileId; + + private Long userId; + + private String fileId; + + private String fileName; + + private String filePath; + + private String extendName; + + private Integer isDir; + + private String uploadTime; + + private Integer deleteFlag; + + private String deleteTime; + + private String deleteBatchNum; + private String createTime; + private Long createUserId; + private String modifyTime; + private Long modifyUserId; + + private Long fileSize; + + private String accessPermission; + + private List children = new ArrayList(); + + public String getUserFileId() { + return userFileId; + } + + public void setUserFileId(String userFileId) { + this.userFileId = userFileId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getExtendName() { + return extendName; + } + + public void setExtendName(String extendName) { + this.extendName = extendName; + } + + public Integer getIsDir() { + return isDir; + } + + public void setIsDir(Integer isDir) { + this.isDir = isDir; + } + + public String getUploadTime() { + return uploadTime; + } + + public void setUploadTime(String uploadTime) { + this.uploadTime = uploadTime; + } + + public Integer getDeleteFlag() { + return deleteFlag; + } + + public void setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + } + + public String getDeleteTime() { + return deleteTime; + } + + public void setDeleteTime(String deleteTime) { + this.deleteTime = deleteTime; + } + + public String getDeleteBatchNum() { + return deleteBatchNum; + } + + public void setDeleteBatchNum(String deleteBatchNum) { + this.deleteBatchNum = deleteBatchNum; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public Long getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(Long createUserId) { + this.createUserId = createUserId; + } + + public String getModifyTime() { + return modifyTime; + } + + public void setModifyTime(String modifyTime) { + this.modifyTime = modifyTime; + } + + public Long getModifyUserId() { + return modifyUserId; + } + + public void setModifyUserId(Long modifyUserId) { + this.modifyUserId = modifyUserId; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public String getAccessPermission() { + return accessPermission; + } + + public void setAccessPermission(String accessPermission) { + this.accessPermission = accessPermission; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} diff --git a/hb-file/src/main/java/com/ruoyi/file/mapper/UserFileMapper.java b/hb-file/src/main/java/com/ruoyi/file/mapper/UserFileMapper.java index bd5e735..8f6609c 100644 --- a/hb-file/src/main/java/com/ruoyi/file/mapper/UserFileMapper.java +++ b/hb-file/src/main/java/com/ruoyi/file/mapper/UserFileMapper.java @@ -3,9 +3,9 @@ package com.ruoyi.file.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.file.dto.file.UserFileDTO; import com.ruoyi.file.domain.UserFile; import com.ruoyi.file.vo.file.FileListVO; -import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -17,4 +17,6 @@ public interface UserFileMapper extends BaseMapper { Long selectStorageSizeByUserId(@Param("userId") Long userId); List selectByUserFileId(String userFileId); + + List selectFileTreeByUserId(Long userId); } diff --git a/hb-file/src/main/java/com/ruoyi/file/service/SysRoleUserFileService.java b/hb-file/src/main/java/com/ruoyi/file/service/SysRoleUserFileService.java new file mode 100644 index 0000000..0287dcd --- /dev/null +++ b/hb-file/src/main/java/com/ruoyi/file/service/SysRoleUserFileService.java @@ -0,0 +1,74 @@ +package com.ruoyi.file.service; + +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.file.api.ISysRoleUserFileService; +import com.ruoyi.file.domain.SysRoleUserFile; +import com.ruoyi.file.mapper.SysRoleUserFileMapper; +import com.ruoyi.system.domain.SysRoleDept; +import com.ruoyi.system.mapper.SysRoleMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class SysRoleUserFileService implements ISysRoleUserFileService { + + @Autowired + SysRoleUserFileMapper roleUserFileMapper; + + @Autowired + SysRoleMapper roleMapper; + + @Override + public List selectUserFileIdListByRoleId(Long roleId) { + return roleUserFileMapper.selectUserFileIdListByRoleId(roleId); + } + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int authDataScope(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与部门关联 + roleUserFileMapper.deleteRoleUserFileByRoleId(role.getRoleId()); + // 新增角色和部门信息(数据权限) + return insertRoleUserFile(role); + } + + /** + * 新增角色部门信息(数据权限) + * + * @param role 角色对象 + */ + public int insertRoleUserFile(SysRole role) + { + int rows = 1; + // 新增角色与部门(数据权限)管理 + List list = new ArrayList(); + for (String userFileId : role.getUserFileIds()) + { + SysRoleUserFile ru = new SysRoleUserFile(); + ru.setRoleId(role.getRoleId()); + ru.setUserFileId(userFileId); + list.add(ru); + } + if (list.size() > 0) + { + rows = roleUserFileMapper.batchRoleUserFile(list); + } + return rows; + } +} diff --git a/hb-file/src/main/java/com/ruoyi/file/service/UserFileService.java b/hb-file/src/main/java/com/ruoyi/file/service/UserFileService.java index 87ee52a..bb34270 100644 --- a/hb-file/src/main/java/com/ruoyi/file/service/UserFileService.java +++ b/hb-file/src/main/java/com/ruoyi/file/service/UserFileService.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.qiwenshare.common.constant.FileConstant; import com.qiwenshare.common.util.DateUtil; +import com.ruoyi.file.dto.file.UserFileDTO; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.file.api.IUserFileService; @@ -18,7 +19,9 @@ import com.ruoyi.file.domain.RecoveryFile; import com.ruoyi.file.domain.UserFile; import com.ruoyi.file.io.QiwenFile; import com.ruoyi.file.mapper.RecoveryFileMapper; +import com.ruoyi.file.mapper.SysRoleUserFileMapper; import com.ruoyi.file.mapper.UserFileMapper; +import com.ruoyi.file.util.FileTreeSelect; import com.ruoyi.file.vo.file.FileListVO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -27,8 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.stream.Collectors; @@ -43,6 +45,9 @@ public class UserFileService extends ServiceImpl imple RecoveryFileMapper recoveryFileMapper; @Resource FileDealComp fileDealComp; + @Resource + SysRoleUserFileMapper roleUserFileMapper; + public static Executor executor = Executors.newFixedThreadPool(20); @@ -197,7 +202,6 @@ public class UserFileService extends ServiceImpl imple return userFileMapper.selectList(lambdaQueryWrapper); } - @Override public void deleteUserFile(String userFileId, Long sessionUserId) { UserFile userFile = userFileMapper.selectById(userFileId); @@ -241,7 +245,7 @@ public class UserFileService extends ServiceImpl imple List fileList = selectUserFileByLikeRightFilePath(filePath, userId); List userFileIds = fileList.stream().map(UserFile::getUserFileId).collect(Collectors.toList()); - //标记删除标志 + //标记删除标志 if (CollectionUtils.isNotEmpty(userFileIds)) { LambdaUpdateWrapper userFileLambdaUpdateWrapper1 = new LambdaUpdateWrapper<>(); userFileLambdaUpdateWrapper1.set(UserFile::getDeleteFlag, RandomUtil.randomInt(FileConstant.deleteFileRandomSize)) @@ -257,5 +261,96 @@ public class UserFileService extends ServiceImpl imple }); } + /** + * 查询文件树结构信息(递归获取) + */ + @Override + public List selectUserFileTreeList() { + LoginUser sessionUserBean = SecurityUtils.getLoginUser(); + List userFileList = userFileMapper.selectFileTreeByUserId(sessionUserBean.getUserId()); + + List treeSelectList = new ArrayList<>(); + + // 根节点 + FileTreeSelect rootNode = new FileTreeSelect(); + rootNode.setLabel(QiwenFile.separator); + rootNode.setId("0"); + rootNode.setChildren(new ArrayList<>()); + + for (UserFileDTO userFile : userFileList) { + QiwenFile qiwenFile = new QiwenFile(userFile.getFilePath(), userFile.getFileName(), false); + String filePath = qiwenFile.getPath(); + + Queue queue = new LinkedList<>(); + String[] strArr = filePath.split(QiwenFile.separator); + for (String s : strArr) { + if (s != null && !"".equals(s)) { + queue.add(s); + } + } + if (queue.isEmpty()) { + continue; + } + + rootNode = insertTreeNode(rootNode, QiwenFile.separator, queue, userFile); + } + + // 排序 + List treeNodeList = rootNode.getChildren(); + //treeNodeList.sort(Comparator.comparingLong(FileTreeSelect::getId)); + + treeSelectList.addAll(treeNodeList); + + return treeSelectList; + } + + + + /** + * 递归插入节点(所有节点 id 都取自 UserFile.userFileId) + */ + public FileTreeSelect insertTreeNode(FileTreeSelect treeNode, String filePath, Queue nodeNameQueue, UserFileDTO userFile) { + List childrenTreeNodes = treeNode.getChildren(); + String currentNodeName = nodeNameQueue.peek(); + if (currentNodeName == null) { + return treeNode; + } + + QiwenFile qiwenFile = new QiwenFile(filePath, currentNodeName, true); + filePath = qiwenFile.getPath(); + + FileTreeSelect childNode = findChild(childrenTreeNodes, currentNodeName); + + if (childNode == null) { // 没有该子节点 -> 插入 + childNode = new FileTreeSelect(); + childNode.setLabel(nodeNameQueue.poll()); + childNode.setChildren(new ArrayList<>()); + + // ⚠️ 所有节点都绑定 userFileId(目录/文件都在 UserFile 表里) + childNode.setId(userFile.getUserFileId()); + + childrenTreeNodes.add(childNode); + } else { + nodeNameQueue.poll(); + } + + if (!nodeNameQueue.isEmpty()) { + insertTreeNode(childNode, filePath, nodeNameQueue, userFile); + } + + return treeNode; + } + + /** + * 查找已有子节点 + */ + private FileTreeSelect findChild(List children, String label) { + for (FileTreeSelect child : children) { + if (label.equals(child.getLabel())) { + return child; + } + } + return null; + } } diff --git a/hb-file/src/main/java/com/ruoyi/file/util/FileTreeSelect.java b/hb-file/src/main/java/com/ruoyi/file/util/FileTreeSelect.java new file mode 100644 index 0000000..f6e6b5d --- /dev/null +++ b/hb-file/src/main/java/com/ruoyi/file/util/FileTreeSelect.java @@ -0,0 +1,61 @@ +package com.ruoyi.file.util; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; +import java.util.List; + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class FileTreeSelect implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private String id; + + /** 节点名称 */ + private String label; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public FileTreeSelect() + { + + } + + public String getId() + { + return id; + } + + public void setId(String id) + { + this.id = id; + } + + public String getLabel() + { + return label; + } + + public void setLabel(String label) + { + this.label = label; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/hb-file/src/main/java/com/ruoyi/file/vo/file/FileListVO.java b/hb-file/src/main/java/com/ruoyi/file/vo/file/FileListVO.java index ffcd919..39d3d19 100644 --- a/hb-file/src/main/java/com/ruoyi/file/vo/file/FileListVO.java +++ b/hb-file/src/main/java/com/ruoyi/file/vo/file/FileListVO.java @@ -42,4 +42,6 @@ public class FileListVO { private Integer imageWidth; private Integer imageHeight; + private String accessPermission; + } diff --git a/hb-file/src/main/resources/mapper/UserFileMapper.xml b/hb-file/src/main/resources/mapper/UserFileMapper.xml index 522910f..7a3d92d 100644 --- a/hb-file/src/main/resources/mapper/UserFileMapper.xml +++ b/hb-file/src/main/resources/mapper/UserFileMapper.xml @@ -6,22 +6,44 @@ - + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - SELECT userfile.*, file.fileSize as fileSize FROM userfile LEFT JOIN file ON file.fileId = userfile.fileId WHERE userfile.userFileId = #{userFileId} + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java index 81ca8fd..85e4bea 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java @@ -44,27 +44,6 @@ public class TreeSelect implements Serializable this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } - public TreeSelect(KnowledgeCategory category) - { - this.id = category.getCategoryId(); - this.label = category.getCategoryName(); - this.children = category.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); - } - - public TreeSelect(SysFacility facility) - { - this.id = facility.getFacilityId(); - this.label = facility.getFacilityName(); - this.children = facility.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); - } - - public TreeSelect(WorkOrderCategory category) - { - this.id = category.getCategoryId(); - this.label = category.getCategoryName(); - this.children = category.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); - } - public Long getId() { return id; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/KnowledgeCategory.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/KnowledgeCategory.java deleted file mode 100644 index 35e60c9..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/KnowledgeCategory.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -import java.util.ArrayList; -import java.util.List; - -/** - * 知识分类对象 knowledge_category - * - * @author liangwen - * @date 2024-03-26 - */ -public class KnowledgeCategory extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 分类id */ - @Excel(name = "分类id") - private Long categoryId; - - /** 分类名 */ - @Excel(name = "分类名") - private String categoryName; - - /** 父ID */ - @Excel(name = "父ID") - private Long parentId; - - /** 祖级列表 */ - private String ancestors; - - /** 显示顺序 */ - @Excel(name = "显示顺序") - private Integer orderNum; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 删除标志 */ - private String delFlag; - - /** 部门id */ - private Long deptId; - - /** 子分类 */ - private List children = new ArrayList(); - - public Long getCategoryId() { - return categoryId; - } - - public void setCategoryId(Long categoryId) { - this.categoryId = categoryId; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public Integer getOrderNum() { - return orderNum; - } - - public void setOrderNum(Integer orderNum) { - this.orderNum = orderNum; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDelFlag() { - return delFlag; - } - - public void setDelFlag(String delFlag) { - this.delFlag = delFlag; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - public String getAncestors() { - return ancestors; - } - - public void setAncestors(String ancestors) { - this.ancestors = ancestors; - } - - public Long getDeptId() { - return deptId; - } - - public void setDeptId(Long deptId) { - this.deptId = deptId; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysFacility.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysFacility.java deleted file mode 100644 index 4049dc5..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysFacility.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -import java.util.ArrayList; -import java.util.List; - -/** - * 厂房信息对象 sys_facility - * - * @author liangwen - * @date 2024-07-11 - */ -public class SysFacility extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 厂房ID */ - private Long facilityId; - - /** 父ID */ - @Excel(name = "父ID") - private Long parentId; - - /** 祖级列表 */ - private String ancestors; - - /** 厂房名称 */ - @Excel(name = "厂房名称") - private String facilityName; - - /** 厂房位置 */ - @Excel(name = "厂房位置") - private String facilityLocation; - - /** 厂房面积 */ - @Excel(name = "厂房面积") - private Double facilityArea; - - /** 厂房状态 */ - @Excel(name = "厂房状态") - private String status; - - /** 删除标志 */ - private String delFlag; - - /** 子厂房 */ - private List children = new ArrayList(); - - public Long getFacilityId() { - return facilityId; - } - - public void setFacilityId(Long facilityId) { - this.facilityId = facilityId; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public String getAncestors() { - return ancestors; - } - - public void setAncestors(String ancestors) { - this.ancestors = ancestors; - } - - public String getFacilityName() { - return facilityName; - } - - public void setFacilityName(String facilityName) { - this.facilityName = facilityName; - } - - public String getFacilityLocation() { - return facilityLocation; - } - - public void setFacilityLocation(String facilityLocation) { - this.facilityLocation = facilityLocation; - } - - public Double getFacilityArea() { - return facilityArea; - } - - public void setFacilityArea(Double facilityArea) { - this.facilityArea = facilityArea; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDelFlag() { - return delFlag; - } - - public void setDelFlag(String delFlag) { - this.delFlag = delFlag; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 488d49c..2f18c31 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -12,7 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 角色表 sys_role - * + * * @author ruoyi */ public class SysRole extends BaseEntity @@ -35,10 +35,14 @@ public class SysRole extends BaseEntity @Excel(name = "角色排序") private Integer roleSort; - /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ - @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") + /** 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) */ + @Excel(name = "数据范围", readConverterExp = "1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限") private String dataScope; + /** 文件权限范围(1:全部文件权限 2:自定义文件权限 3:仅限公开文件权限 4:仅本人文件权限) */ + @Excel(name = "文件权限", readConverterExp = "1:全部文件权限 2:自定义文件权限 3:仅公开文件权限 4:仅本人文件权限") + private String fileScope; + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ private boolean menuCheckStrictly; @@ -61,6 +65,9 @@ public class SysRole extends BaseEntity /** 部门组(数据权限) */ private Long[] deptIds; + /** 用户文件组(数据权限) */ + private String[] userFileIds; + /** 角色菜单权限 */ private Set permissions; @@ -139,6 +146,14 @@ public class SysRole extends BaseEntity this.dataScope = dataScope; } + public String getFileScope() { + return fileScope; + } + + public void setFileScope(String fileScope) { + this.fileScope = fileScope; + } + public boolean isMenuCheckStrictly() { return menuCheckStrictly; @@ -209,6 +224,14 @@ public class SysRole extends BaseEntity this.deptIds = deptIds; } + public String[] getUserFileIds() { + return userFileIds; + } + + public void setUserFileIds(String[] userFileIds) { + this.userFileIds = userFileIds; + } + public Set getPermissions() { return permissions; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WorkOrderCategory.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WorkOrderCategory.java deleted file mode 100644 index a271413..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/WorkOrderCategory.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -import java.util.ArrayList; -import java.util.List; - -/** - * 工单类型对象 work_order_category - * - * @author liangwen - * @date 2025-05-24 - */ -public class WorkOrderCategory extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 类型id */ - private Long categoryId; - - private String categoryName; - - /** 工单类型 */ - @Excel(name = "工单类型") - private String workOrderType; - - /** 父ID */ - @Excel(name = "父ID") - private Long parentId; - - /** 祖级列表 */ - private String ancestors; - - /** 显示顺序 */ - @Excel(name = "显示顺序") - private Integer orderNum; - - /** 处理人账号 */ - @Excel(name = "处理人id") - private Long handlerUserId; - - @Excel(name = "处理人账号") - private String handlerUser; - - @Excel(name = "处理人账号昵称") - private String handlerUserNickName; - - /** 对应知识库分类Id */ - private Long relKnowledgeCategoryId; - - /** 提醒周期 */ - @Excel(name = "提醒周期") - private String remindCycle; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** 部门id */ - private Long deptId; - - /** 子分类 */ - private List children = new ArrayList(); - - public Long getCategoryId() { - return categoryId; - } - - public void setCategoryId(Long categoryId) { - this.categoryId = categoryId; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public String getWorkOrderType() { - return workOrderType; - } - - public void setWorkOrderType(String workOrderType) { - this.workOrderType = workOrderType; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public String getAncestors() { - return ancestors; - } - - public void setAncestors(String ancestors) { - this.ancestors = ancestors; - } - - public Integer getOrderNum() { - return orderNum; - } - - public void setOrderNum(Integer orderNum) { - this.orderNum = orderNum; - } - - public Long getHandlerUserId() { - return handlerUserId; - } - - public void setHandlerUserId(Long handlerUserId) { - this.handlerUserId = handlerUserId; - } - - public String getHandlerUser() { - return handlerUser; - } - - public void setHandlerUser(String handlerUser) { - this.handlerUser = handlerUser; - } - - public String getHandlerUserNickName() { - return handlerUserNickName; - } - - public void setHandlerUserNickName(String handlerUserNickName) { - this.handlerUserNickName = handlerUserNickName; - } - - public Long getRelKnowledgeCategoryId() { - return relKnowledgeCategoryId; - } - - public void setRelKnowledgeCategoryId(Long relKnowledgeCategoryId) { - this.relKnowledgeCategoryId = relKnowledgeCategoryId; - } - - public String getRemindCycle() { - return remindCycle; - } - - public void setRemindCycle(String remindCycle) { - this.remindCycle = remindCycle; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDelFlag() { - return delFlag; - } - - public void setDelFlag(String delFlag) { - this.delFlag = delFlag; - } - - public Long getDeptId() { - return deptId; - } - - public void setDeptId(Long deptId) { - this.deptId = deptId; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index b9b8f32..0d21ffc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -27,7 +27,7 @@ import com.ruoyi.system.service.ISysRoleService; /** * 角色 业务层处理 - * + * * @author ruoyi */ @Service @@ -47,12 +47,12 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 根据条件分页查询角色数据 - * + * * @param role 角色信息 * @return 角色数据集合信息 */ @Override - @DataScope(deptAlias = "d") + //@DataScope(deptAlias = "d") public List selectRoleList(SysRole role) { return roleMapper.selectRoleList(role); @@ -60,7 +60,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 根据用户ID查询角色 - * + * * @param userId 用户ID * @return 角色列表 */ @@ -85,7 +85,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 根据用户ID查询权限 - * + * * @param userId 用户ID * @return 权限列表 */ @@ -106,7 +106,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 查询所有角色 - * + * * @return 角色列表 */ @Override @@ -117,7 +117,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 根据用户ID获取角色选择框列表 - * + * * @param userId 用户ID * @return 选中角色ID列表 */ @@ -129,7 +129,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 通过角色ID查询角色 - * + * * @param roleId 角色ID * @return 角色对象信息 */ @@ -141,7 +141,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 校验角色名称是否唯一 - * + * * @param role 角色信息 * @return 结果 */ @@ -159,7 +159,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 校验角色权限是否唯一 - * + * * @param role 角色信息 * @return 结果 */ @@ -177,7 +177,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 校验角色是否允许操作 - * + * * @param role 角色信息 */ @Override @@ -191,7 +191,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 校验角色是否有数据权限 - * + * * @param roleId 角色id */ @Override @@ -211,7 +211,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 通过角色ID查询角色使用数量 - * + * * @param roleId 角色ID * @return 结果 */ @@ -223,7 +223,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 新增保存角色信息 - * + * * @param role 角色信息 * @return 结果 */ @@ -238,7 +238,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 修改保存角色信息 - * + * * @param role 角色信息 * @return 结果 */ @@ -255,7 +255,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 修改角色状态 - * + * * @param role 角色信息 * @return 结果 */ @@ -267,7 +267,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 修改数据权限信息 - * + * * @param role 角色信息 * @return 结果 */ @@ -285,7 +285,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 新增角色菜单信息 - * + * * @param role 角色对象 */ public int insertRoleMenu(SysRole role) @@ -333,7 +333,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 通过角色ID删除角色 - * + * * @param roleId 角色ID * @return 结果 */ @@ -350,7 +350,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 批量删除角色信息 - * + * * @param roleIds 需要删除的角色ID * @return 结果 */ @@ -377,7 +377,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 取消授权用户角色 - * + * * @param userRole 用户和角色关联信息 * @return 结果 */ @@ -389,7 +389,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 批量取消授权用户角色 - * + * * @param roleId 角色ID * @param userIds 需要取消授权的用户数据ID * @return 结果 @@ -402,7 +402,7 @@ public class SysRoleServiceImpl implements ISysRoleService /** * 批量选择授权用户角色 - * + * * @param roleId 角色ID * @param userIds 需要授权的用户数据ID * @return 结果 diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 52306c2..7c7137f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -19,17 +19,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - + - select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, - r.status, r.del_flag, r.create_time, r.remark + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.file_scope, r.menu_check_strictly, r.dept_check_strictly, + r.status, r.del_flag, r.create_time, r.remark from sys_role r left join sys_user_role ur on ur.role_id = r.role_id left join sys_user u on u.user_id = ur.user_id left join sys_dept d on u.dept_id = d.dept_id - + - + - + - + - + - + - + - + - + insert into sys_role( role_id, @@ -100,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" role_key, role_sort, data_scope, + file_scope, menu_check_strictly, dept_check_strictly, status, @@ -112,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{roleKey}, #{roleSort}, #{dataScope}, + #{fileScope}, #{menuCheckStrictly}, #{deptCheckStrictly}, #{status}, @@ -120,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sysdate() ) - + update sys_role @@ -128,6 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" role_key = #{roleKey}, role_sort = #{roleSort}, data_scope = #{dataScope}, + file_scope = #{fileScope}, menu_check_strictly = #{menuCheckStrictly}, dept_check_strictly = #{deptCheckStrictly}, status = #{status}, @@ -137,16 +141,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where role_id = #{roleId} - + update sys_role set del_flag = '2' where role_id = #{roleId} - + update sys_role set del_flag = '2' where role_id in #{roleId} - + - - \ No newline at end of file + +