From 9834372956915a84c6bcf61361944856172b798e Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Wed, 10 Jan 2024 11:01:13 +0800 Subject: [PATCH] update --- src/main/java/com/ydool/system/dto/UserDto.java | 3 +++ src/main/java/com/ydool/system/entity/User.java | 3 +++ .../com/ydool/system/request/UserRequest.java | 4 ++++ .../system/service/impl/UserServiceImpl.java | 5 +++++ .../com/ydool/system/wrapper/UserWrapper.java | 15 +++++++++++++++ 5 files changed, 30 insertions(+) diff --git a/src/main/java/com/ydool/system/dto/UserDto.java b/src/main/java/com/ydool/system/dto/UserDto.java index 6a18cb7..4da9800 100644 --- a/src/main/java/com/ydool/system/dto/UserDto.java +++ b/src/main/java/com/ydool/system/dto/UserDto.java @@ -15,4 +15,7 @@ public class UserDto extends User { @ApiModelProperty(value = "岗位名称") private String jobName; + + @ApiModelProperty(value = "权限名称") + private String permissionsName; } diff --git a/src/main/java/com/ydool/system/entity/User.java b/src/main/java/com/ydool/system/entity/User.java index c8a594c..5610ee1 100644 --- a/src/main/java/com/ydool/system/entity/User.java +++ b/src/main/java/com/ydool/system/entity/User.java @@ -79,4 +79,7 @@ public class User extends BaseEntity{ @ApiModelProperty(value = "电子签名") private String electronicSignature; + @ApiModelProperty(value = "权限 my:自己,dept:本部门,all:所有") + private String permissions; + } diff --git a/src/main/java/com/ydool/system/request/UserRequest.java b/src/main/java/com/ydool/system/request/UserRequest.java index 3570dcb..faa9859 100644 --- a/src/main/java/com/ydool/system/request/UserRequest.java +++ b/src/main/java/com/ydool/system/request/UserRequest.java @@ -47,4 +47,8 @@ public class UserRequest { @ApiModelProperty(value = "电子签名") private String electronicSignature; + + @ApiModelProperty(value = "权限 my:自己,dept:本部门,all:所有") + @NotBlank(message = "权限不能为空") + private String permissions; } diff --git a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java index 1c9edc9..4ca6b4b 100644 --- a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java @@ -450,6 +450,11 @@ public class UserServiceImpl extends BaseService implements IU if (ObjectUtil.isNotNull(user)) return "登录账号不能重复"; LoginNameUtil.valid(userRequest.getLoginName()); + List permissionsList = new ArrayList<>(); + permissionsList.add("my"); + permissionsList.add("dept"); + permissionsList.add("all"); + if (!permissionsList.contains(userRequest.getPermissions())) return "权限不正确"; return null; } } diff --git a/src/main/java/com/ydool/system/wrapper/UserWrapper.java b/src/main/java/com/ydool/system/wrapper/UserWrapper.java index 6b20d23..baea86e 100644 --- a/src/main/java/com/ydool/system/wrapper/UserWrapper.java +++ b/src/main/java/com/ydool/system/wrapper/UserWrapper.java @@ -52,5 +52,20 @@ public interface UserWrapper extends BaseWrapper { .last("limit 1") ); if (ObjectUtil.isNotNull(job)) dto.setJobName(job.getName()); + switch (obj.getPermissions()) + { + case "my": + dto.setPermissionsName("自己"); + break; + case "dept": + dto.setPermissionsName("本部门"); + break; + case "all": + dto.setPermissionsName("所有"); + break; + default: + dto.setPermissionsName("未知"); + break; + } } }