项目一阶段功能增加:用户禁用功能

grs
yjxx 1 month ago
parent a65b2c1f2b
commit 180019adae

@ -63,9 +63,12 @@ public class UserController {
if (optionalUser.isEmpty() || !Md5Util.getMD5String(userLoginByAccountDTO.getPassword()).equals(optionalUser.get().getPassword())) { if (optionalUser.isEmpty() || !Md5Util.getMD5String(userLoginByAccountDTO.getPassword()).equals(optionalUser.get().getPassword())) {
return new Result<>(401, "账号或者密码错误", ""); return new Result<>(401, "账号或者密码错误", "");
} }
User user = optionalUser.get();
if(user.getDisabled() == 1){
return new Result<>(403, "该账号已被禁用, 请联系管理员", "");
}
// 禁用自动填充 // 禁用自动填充
MyMetaObjectHandler.setSkipUpdateFill(true); MyMetaObjectHandler.setSkipUpdateFill(true);
User user = optionalUser.get();
user.setLoginTime(LocalDateTime.now()); user.setLoginTime(LocalDateTime.now());
userMapper.update(user, new UpdateWrapper<User>().eq("id", user.getId())); userMapper.update(user, new UpdateWrapper<User>().eq("id", user.getId()));
// 校验通过 // 校验通过

@ -54,6 +54,9 @@ public class User implements Serializable {
@TableField("likes") @TableField("likes")
private Integer likes; private Integer likes;
@TableField("disabled")
private Integer disabled;
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime; private LocalDateTime createTime;

Loading…
Cancel
Save