package com.dk.mdm.model.query.core;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dk.common.infrastructure.annotaiton.ExportTitle;
import com.dk.common.infrastructure.handler.IntListTypeHandler;
import com.dk.common.infrastructure.handler.TimestampTypeHandler;
import com.dk.common.model.pojo.PageInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

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

/**
 *  用户
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ExportTitle("用户")
@TableName(value = "t_user", autoResultMap = true)
@ApiModel(value="实体类：用户", description="表名：t_user")
public class UserQuery extends PageInfo<UserQuery> implements Serializable {

    /*
     * 数据库字段
     */

    /**
     * 用户ID
     */
    @TableId(value = "user_id", type = IdType.AUTO)
    @ApiModelProperty(value = "用户ID")
    private Integer userId;


    /**
     * 用户编码
     */
    @Excel(name = "用户编码")
    @ApiModelProperty(value = "用户编码")
    private String userCode;


    /**
     * 用户名称
     */
    @Excel(name = "用户名称")
    @ApiModelProperty(value = "用户名称")
    private String userName;


    /**
     * 登录密码
     */
    @Excel(name = "登录密码")
    @ApiModelProperty(value = "登录密码")
    private String userPwd;


    /**
     * 是否是初始密码
     */
    @Excel(name = "是否是初始密码")
    @ApiModelProperty(value = "是否是初始密码")
    private Boolean flgInitPwd;


    /**
     * 密码修改时间
     */
    @Excel(name = "密码修改时间")
    @ApiModelProperty(value = "密码修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime pwdDate;


    /**
     * 用户类型 (1：文员 2：生产工号（班组） -1：接口用户)
     */
    @Excel(name = "用户类型 (1：文员 2：生产工号（班组） -1：接口用户)")
    @ApiModelProperty(value = "用户类型 (1：文员 2：生产工号（班组） -1：接口用户)")
    private Integer userType;


    /**
     * 客户端ID (接口用户：oauth的clientid)
     */
    @Excel(name = "客户端ID (接口用户：oauth的clientid)")
    @ApiModelProperty(value = "客户端ID (接口用户：oauth的clientid)")
    private String clientId;


    /**
     * 用户角色
     */
    @Excel(name = "用户角色")
    @ApiModelProperty(value = "用户角色")
    @TableField(typeHandler = IntListTypeHandler.class)
    private List<Integer> roleIds;


    /**
     * 组织部门
     */
    @Excel(name = "组织部门")
    @ApiModelProperty(value = "组织部门")
    private Integer orgId;


    /**
     * 绑定员工 (文员时为对应员工，生产工号（班组）时为班长)
     */
    @Excel(name = "绑定员工 (文员时为对应员工，生产工号（班组）时为班长)")
    @ApiModelProperty(value = "绑定员工 (文员时为对应员工，生产工号（班组）时为班长)")
    private Integer staffId;


    @ApiModelProperty(value = "")
    private String remarks;


    @ApiModelProperty(value = "")
    private Boolean flgValid;


    @ApiModelProperty(value = "")
    private Integer ftyId;


    @Excel(name = "", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @ApiModelProperty(value = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opCreateTime;


    @ApiModelProperty(value = "")
    private Long opCreateUserId;


    @Excel(name = "", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @ApiModelProperty(value = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opUpdateTime;


    @ApiModelProperty(value = "")
    private Long opUpdateUserId;

    @ApiModelProperty(value = "")
    private String opAppCode;

    @ApiModelProperty(value = "")
    private String appCode;

    @ApiModelProperty(value = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opTimestamp;


    @ApiModelProperty(value = "")
    private String opDbUser;

    /**
     * @desc   : 有效标识list
     * @author : 姜宁
     * @date   : 2023/1/29 13:54
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "有效标识 (1：正常 0：停用)")
    private List<Boolean> flgValidList;

    /**
     * @desc   : 组织部门list
     * @author : 姜宁
     * @date   : 2023/1/29 14:44
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "组织部门id集合")
    private List<Integer> orgIds;

    /*
     * 相关属性
     * @TableField(exist = false)
     */

    /*
     * 关联属性 + 查询条件
     * @TableField(exist = false)
     */


    private static final long serialVersionUID = 1L;

}
