From 180019adaea719b3662b077e73d98cb91281d45e Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Sat, 19 Oct 2024 00:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=80=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=8A=A0=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expressdistributionsystem/controller/UserController.java | 5 ++++- src/main/java/jty/expressdistributionsystem/entity/User.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index 7951a9b..7d6952e 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -63,9 +63,12 @@ public class UserController { if (optionalUser.isEmpty() || !Md5Util.getMD5String(userLoginByAccountDTO.getPassword()).equals(optionalUser.get().getPassword())) { return new Result<>(401, "账号或者密码错误", ""); } + User user = optionalUser.get(); + if(user.getDisabled() == 1){ + return new Result<>(403, "该账号已被禁用, 请联系管理员", ""); + } // 禁用自动填充 MyMetaObjectHandler.setSkipUpdateFill(true); - User user = optionalUser.get(); user.setLoginTime(LocalDateTime.now()); userMapper.update(user, new UpdateWrapper().eq("id", user.getId())); // 校验通过 diff --git a/src/main/java/jty/expressdistributionsystem/entity/User.java b/src/main/java/jty/expressdistributionsystem/entity/User.java index 5b6e18e..243bffb 100644 --- a/src/main/java/jty/expressdistributionsystem/entity/User.java +++ b/src/main/java/jty/expressdistributionsystem/entity/User.java @@ -54,6 +54,9 @@ public class User implements Serializable { @TableField("likes") private Integer likes; + @TableField("disabled") + private Integer disabled; + @TableField(value = "create_time", fill = FieldFill.INSERT) private LocalDateTime createTime;