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_organization", autoResultMap = true)
@ApiModel(value="实体类：组织部门", description="表名：t_organization")
public class OrganizationQuery extends PageInfo<OrganizationQuery> implements Serializable {

    /*
     * 数据库字段
     */

    /**
     * 组织ID
     */
    @TableId(value = "org_id", type = IdType.AUTO)
    @ApiModelProperty(value = "组织ID")
    private Integer orgId;


    /**
     * 组织代码
     */
    @Excel(name = "组织代码")
    @ApiModelProperty(value = "组织代码")
    private String orgCode;


    /**
     * 组织名称
     */
    @Excel(name = "组织名称")
    @ApiModelProperty(value = "组织名称")
    private String orgName;


    /**
     * 父级ID
     */
    @Excel(name = "父级ID")
    @ApiModelProperty(value = "父级ID")
    private Integer parentId;


    /**
     * 显示顺序
     */
    @Excel(name = "显示顺序")
    @ApiModelProperty(value = "显示顺序")
    private Integer displayNo;


    /**
     * 层级序号
     */
    @Excel(name = "层级序号")
    @ApiModelProperty(value = "层级序号")
    private Integer levelNo;


    /**
     * 层级代码
     */
    @Excel(name = "层级代码")
    @ApiModelProperty(value = "层级代码")
    private String levelCode;


    /**
     * 层级全称 (【 / 】)
     */
    @Excel(name = "层级全称 (【 / 】)")
    @ApiModelProperty(value = "层级全称 (【 / 】)")
    private String levelName;


    /**
     * 备注
     */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remarks;


    /**
     * 有效标识 (1：正常 0：停用)
     */
    @Excel(name = "有效标识 (1：正常 0：停用)")
    @ApiModelProperty(value = "有效标识 (1：正常 0：停用)")
    private Boolean flgValid;


    /**
     * 工厂ID
     */
    @Excel(name = "工厂ID")
    @ApiModelProperty(value = "工厂ID")
    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;


    /**
     * 创建用户 (触发器自动处理)
     */
    @Excel(name = "创建用户 (触发器自动处理)")
    @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;


    /**
     * 修改用户 (触发器自动处理)
     */
    @Excel(name = "修改用户 (触发器自动处理)")
    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
    private Long opUpdateUserId;


    /**
     * 数据操作应用 (触发器自动处理)
     */
    @Excel(name = "数据操作应用 (触发器自动处理)")
    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
    private String opAppCode;


    /**
     * 数据时间戳 (触发器自动处理)
     */
    @Excel(name = "数据时间戳 (触发器自动处理)")
    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opTimestamp;


    /**
     * 数据操作数据库用户 (触发器自动处理)
     */
    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
    private String opDbUser;

    /**
     * 顶级ID
     */
    @Excel(name = "顶级ID")
    @ApiModelProperty(value = "顶级ID")
    private Integer topId;

    /**
     * 上层ID (上层全部id)
     */
    @Excel(name = "上层ID (上层全部id)")
    @ApiModelProperty(value = "上层ID (上层全部id)")
    @TableField(typeHandler = IntListTypeHandler.class)
    private List<Integer> levelUpper;


    /**
     * 下层ID (下层全部id)
     */
    @Excel(name = "下层ID (下层全部id)")
    @ApiModelProperty(value = "下层ID (下层全部id)")
    @TableField(typeHandler = IntListTypeHandler.class)
    private List<Integer> levelLower;


    /**
     * 末级标识 (是否叶子节点)
     */
    @Excel(name = "末级标识 (是否叶子节点)")
    @ApiModelProperty(value = "末级标识 (是否叶子节点)")
    private Boolean levelLeaf;

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

    /*
     * 关联属性 + 查询条件
     * @TableField(exist = false)
     */
    /**
     * @desc   : 有效标识list
     * @author : 姜宁
     * @date   : 2023/1/10 16:42
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "有效标识 (1：正常 0：停用)")
    private List<Boolean> flgValidList;

    private static final long serialVersionUID = 1L;

}
