Compare commits

..

2 Commits

2 changed files with 22 additions and 13 deletions

View File

@ -32,10 +32,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
@ -237,7 +234,14 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) {
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
}
return roleMapper.getPageRoleDTO(page, queryWrapper);
IPage<RoleDTO> result = roleMapper.getPageRoleDTO(page, queryWrapper);
for (RoleDTO roleDTO : result.getRecords()) {
if (roleDTO.getAllowedActions() != null ) {
String chineseString = Arrays.stream(roleDTO.getAllowedActions().split(",")).map(FilePermission::toDescription).collect(Collectors.joining(","));
roleDTO.setAllowedActions(chineseString);
}
}
return result;
}
/**

View File

@ -6,14 +6,14 @@ import java.util.List;
public enum FilePermission {
// 权限枚举值
VIEW("view", "查看文件"),
MOVE("move", "移动/复制文件"),
EDIT("edit", "编辑文件"),
DELETE("delete", "删除文件"),
UPLOAD("upload", "上传文件"),
DOWNLOAD("download", "下载文件"),
IMPORT("import", "导入文件"),
EXPORT("export", "导出文件");
VIEW("view", "查看"),
MOVE("move", "移动/复制"),
EDIT("edit", "编辑"),
DELETE("delete", "删除"),
UPLOAD("upload", "上传"),
DOWNLOAD("download", "下载"),
IMPORT("import", "导入"),
EXPORT("export", "导出");
// 枚举属性
private final String code; // 权限代码
@ -53,5 +53,10 @@ public enum FilePermission {
public String getDescription() {
return description;
}
// 转换成权限描述
public static String toDescription(String code) {
return fromCode(code).getDescription();
}
}