package com.zxdmy.excite.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author 沈松
 * @since 2021-09-01
 */
@Schema(name = "SysUser", description = "系统用户实体")
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(name = "id",description = "用户主键")
    private Integer id;

    /**
     * 用户昵称
     */
    @Schema(name = "username",description = "用户昵称")
    private String username;

    /**
     * 用户头像
     */
    @Schema(name = "avatar",description = "用户头像")
    private String avatar;

    /**
     * 用户性别（0-未知 | 1-男 | 2-女）
     */
    private Integer sex;

    /**
     * 用户邮箱
     */
    private String loginName;

    /**
     * 用户手机号
     */
    private String phone;

    /**
     * 用户密码
     */
    @JsonIgnore
    private String password;

    /**
     * 用户状态
     */
//    @JsonIgnore
    private Integer status;

    /**
     * 用户备注信息
     */
    private String remark;

    /**
     * 登录IP
     */
    private String loginIp;

    /**
     * 登录时间
     */
    private LocalDateTime loginDate;

    /**
     * 是否删除（0-未删除 | 1-已删除）
     */
    @TableLogic
    @JsonIgnore
    private Integer isDelete;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
//    @JsonIgnore
    @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;

    /**
     * 删除时间
     */
    @JsonIgnore
    private LocalDateTime deleteTime;


}
