Compare commits

..

No commits in common. "d0187511bc0183fb322aa67638691baa26fdca2b" and "1acaec87a739ae35ffffe57ba5a5ed24174df767" have entirely different histories.

2 changed files with 13 additions and 22 deletions

View File

@ -32,7 +32,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID; import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
@ -234,14 +237,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) { if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) {
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName()); queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
} }
IPage<RoleDTO> result = roleMapper.getPageRoleDTO(page, queryWrapper); return 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 { public enum FilePermission {
// 权限枚举值 // 权限枚举值
VIEW("view", "查看"), VIEW("view", "查看文件"),
MOVE("move", "移动/复制"), MOVE("move", "移动/复制文件"),
EDIT("edit", "编辑"), EDIT("edit", "编辑文件"),
DELETE("delete", "删除"), DELETE("delete", "删除文件"),
UPLOAD("upload", "上传"), UPLOAD("upload", "上传文件"),
DOWNLOAD("download", "下载"), DOWNLOAD("download", "下载文件"),
IMPORT("import", "导入"), IMPORT("import", "导入文件"),
EXPORT("export", "导出"); EXPORT("export", "导出文件");
// 枚举属性 // 枚举属性
private final String code; // 权限代码 private final String code; // 权限代码
@ -53,10 +53,5 @@ public enum FilePermission {
public String getDescription() { public String getDescription() {
return description; return description;
} }
// 转换成权限描述
public static String toDescription(String code) {
return fromCode(code).getDescription();
}
} }