package com.tourguide.modules.user.dto;
|
|
import com.tourguide.modules.user.entity.AdminUser;
|
import java.time.LocalDateTime;
|
|
/** 管理后台账号的脱敏返回对象,不包含密码字段。 */
|
public class UserResponse {
|
private final Long id;
|
private final String username;
|
private final String nickname;
|
private final String mobile;
|
private final String avatar;
|
private final String roleCode;
|
private final Integer status;
|
private final LocalDateTime createdAt;
|
|
private UserResponse(AdminUser user) {
|
this.id = user.getId();
|
this.username = user.getUsername();
|
this.nickname = user.getNickname();
|
this.mobile = user.getMobile();
|
this.avatar = user.getAvatar();
|
this.roleCode = user.getRoleCode();
|
this.status = user.getStatus();
|
this.createdAt = user.getCreatedAt();
|
}
|
public static UserResponse from(AdminUser user) { return new UserResponse(user); }
|
public Long getId() { return id; }
|
public String getUsername() { return username; }
|
public String getNickname() { return nickname; }
|
public String getMobile() { return mobile; }
|
public String getAvatar() { return avatar; }
|
public String getRoleCode() { return roleCode; }
|
public Integer getStatus() { return status; }
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
}
|