From 2e3d44d4f9fabde952746c22f206dd7028cb948e Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Thu, 24 Oct 2024 15:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B6=E6=AE=B5=E5=9B=9B=EF=BC=9A=E5=BF=AB?= =?UTF-8?q?=E9=80=92=E5=91=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expressdistributionsystem/DTO/UserLoginByAccountDTO.java | 3 +++ .../expressdistributionsystem/controller/CommonController.java | 3 +++ 2 files changed, 6 insertions(+) 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, "该账号已被禁用, 请联系管理员", ""); }