UserInfoVO.java 3.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package top.charles7c.cnadmin.auth.model.vo;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
22
import java.util.Set;
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

import lombok.Data;

import io.swagger.v3.oas.annotations.media.Schema;

import com.fasterxml.jackson.annotation.JsonIgnore;

import cn.hutool.core.util.DesensitizedUtil;

import top.charles7c.cnadmin.common.enums.GenderEnum;

/**
 * 用户信息
 *
 * @author Charles7c
 * @since 2022/12/29 20:15
 */
@Data
@Schema(description = "用户信息")
public class UserInfoVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
47
     * ID
48
     */
49
    @Schema(description = "ID", example = "1")
50
    private Long id;
51 52 53 54

    /**
     * 用户名
     */
55
    @Schema(description = "用户名", example = "zhangsan")
56 57 58 59 60
    private String username;

    /**
     * 昵称
     */
61
    @Schema(description = "昵称", example = "张三")
62 63 64
    private String nickname;

    /**
65
     * 性别(0:未知,1:男,2:女)
66
     */
67
    @Schema(description = "性别(0:未知,1:男,2:女)", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1")
68 69 70 71 72
    private GenderEnum gender;

    /**
     * 邮箱
     */
73
    @Schema(description = "邮箱", example = "123456789@qq.com")
74 75
    private String email;

76 77 78
    /**
     * 手机号码
     */
79
    @Schema(description = "手机号码", example = "13811111111")
80 81
    private String phone;

82 83 84
    /**
     * 头像地址
     */
85 86
    @Schema(description = "头像地址",
        example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg")
87 88 89
    private String avatar;

    /**
90
     * 描述
91
     */
92
    @Schema(description = "描述", example = "张三描述信息")
93
    private String description;
94 95

    /**
96
     * 最后一次修改密码时间
97
     */
98
    @Schema(description = "最后一次修改密码时间", example = "2023-08-08 08:08:08", type = "string")
99 100 101 102 103 104 105 106 107 108 109
    private LocalDateTime pwdResetTime;

    /**
     * 创建时间
     */
    @JsonIgnore
    private LocalDateTime createTime;

    /**
     * 注册日期
     */
110
    @Schema(description = "注册日期", example = "2023-08-08")
111 112
    private LocalDate registrationDate;

113
    /**
114
     * 部门 ID
115
     */
116
    @Schema(description = "部门 ID", example = "1")
117 118 119 120 121
    private Long deptId;

    /**
     * 所属部门
     */
122
    @Schema(description = "所属部门", example = "测试部")
123 124
    private String deptName;

125
    /**
126
     * 权限码集合
127
     */
128
    @Schema(description = "权限码集合", example = "[\"system:user:list\",\"system:user:add\"]")
129 130 131 132 133
    private Set<String> permissions;

    /**
     * 角色编码集合
     */
134
    @Schema(description = "角色编码集合", example = "[\"test\"]")
135
    private Set<String> roles;
136 137 138 139 140 141 142 143 144

    public String getPhone() {
        return DesensitizedUtil.mobilePhone(phone);
    }

    public LocalDate getRegistrationDate() {
        return createTime.toLocalDate();
    }
}