modify userInfo

This commit is contained in:
ray.ma 2025-04-24 15:48:51 +08:00
parent 1e3e66a1a6
commit 6dac497391
2 changed files with 8 additions and 3 deletions

View File

@ -2,8 +2,11 @@ package com.wj.manager.dto;
import com.wj.manager.entity.AccountEntity;
import com.wj.manager.enums.CollegeTypeEnum;
import com.wj.manager.enums.RoleTypeEnum;
import lombok.Data;
import java.util.List;
@Data
public class AccountInfoDTO {
private Long userId;
@ -14,6 +17,7 @@ public class AccountInfoDTO {
private String birthday;
private String phone;
private String college;
private List<String> roles;
public AccountInfoDTO(AccountEntity entity) {
this.userId = entity.getId();
@ -24,5 +28,6 @@ public class AccountInfoDTO {
this.birthday = entity.getBirthday();
this.phone = entity.getPhone();
this.college = CollegeTypeEnum.getNameByType(entity.getCollege());
this.roles = List.of(RoleTypeEnum.getByCode(entity.getRole()).getMessage());
}
}

View File

@ -7,9 +7,9 @@ import lombok.Getter;
@AllArgsConstructor
public enum RoleTypeEnum {
UNKNOWN(0, "未知"),
ADMIN(1, "管理员"),
TEACHER(2, "教师"),
STUDENT(3, "学生"),
ADMIN(1, "admin"),
TEACHER(2, "teacher"),
STUDENT(3, "student"),
;
private final Integer code;
private final String message;