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;