diff --git a/src/main/java/jty/expressdistributionsystem/DTO/UserLoginByAccountDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/UserLoginByAccountDTO.java index db1e3d2..1a1a6b8 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/UserLoginByAccountDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/UserLoginByAccountDTO.java @@ -13,4 +13,7 @@ public class UserLoginByAccountDTO { @NotBlank(message = "密码不能为空") @Pattern(regexp = "^.+$") private String password; + + @NotBlank(message = "请选择你的登录任务") + private Integer mark; } diff --git a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java index fa60b12..320ade6 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java @@ -67,6 +67,9 @@ public class CommonController { return new Result<>(401, "账号或者密码错误", ""); } User user = optionalUser.get(); + if(userLoginByAccountDTO.getMark() != user.getMark()) { + return new Result<>(401, "请选择正确身份", ""); + } if (user.getDisabled() == 1) { return new Result<>(403, "该账号已被禁用, 请联系管理员", ""); }