feat(user): 修改status字段类型
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package cn.celess.blog.enmu;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Author: 小海
|
||||
* @Date: 2020-05-22 21:32
|
||||
@@ -36,4 +38,13 @@ public enum UserAccountStatusEnum {
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static UserAccountStatusEnum get(int code) {
|
||||
for (UserAccountStatusEnum value : UserAccountStatusEnum.values()) {
|
||||
if (value.code == code) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.celess.blog.entity.model;
|
||||
|
||||
import cn.celess.blog.enmu.UserAccountStatusEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -38,5 +39,5 @@ public class UserModel {
|
||||
|
||||
private String token;
|
||||
|
||||
private int status;
|
||||
private UserAccountStatusEnum status;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.celess.blog.util;
|
||||
|
||||
import cn.celess.blog.enmu.UserAccountStatusEnum;
|
||||
import cn.celess.blog.entity.*;
|
||||
import cn.celess.blog.entity.model.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -46,6 +47,7 @@ public class ModalTrans {
|
||||
}
|
||||
UserModel userModel = new UserModel();
|
||||
BeanUtils.copyProperties(user, userModel);
|
||||
userModel.setStatus(UserAccountStatusEnum.get(user.getStatus()));
|
||||
userModel.setAvatarImgUrl(user.getAvatarImgUrl() == null || user.getAvatarImgUrl().length() == 0 ?
|
||||
null :
|
||||
"http://cdn.celess.cn/" + user.getAvatarImgUrl());
|
||||
|
||||
Reference in New Issue
Block a user