package com.heketai.website.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.heketai.website.common.vo.JwtToken;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author xjl
 * @since 2019-11-13
 */
@TableName("sys_user")
@Data
@EqualsAndHashCode(callSuper=true)
public class SysUser extends Model<SysUser> {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("主键")
    private Integer id;

    @ApiModelProperty("用户名")
    private String account;

    @JsonIgnore
    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("昵称")
    private String nickname;

    @ApiModelProperty("状态(0不启用|1启用)")
    private Boolean status;

    @ApiModelProperty("创建时间")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date modifyTime;

    @ApiModelProperty("最后一次登录时间")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    @ApiModelProperty("用户对应的角色集合")
    @TableField(exist = false)
    private List<SysRole> roleList;

    @ApiModelProperty("用户对应的菜单树")
    @TableField(exist = false)
    private List<SysMenu> menuList;

    @ApiModelProperty("token字符串")
    @TableField(exist = false)
    private JwtToken jwtToken;
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
