package com.gci.boot.modules.basedata.entity;

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

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gci.boot.annotation.Query.OrderQuery;
import com.gci.boot.annotation.Query.SelectQuery;
import com.gci.boot.annotation.repeat.FieldRepeat;
import com.gci.boot.annotation.repeat.TableRepeat;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.excel.DictConverter;
import com.gci.boot.common.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 外部通讯录
 * </p>
 *
 * @author xushuhan
 * @since 2023-08-24
 */
@Getter
@Setter
@TableName("tb_external_address_book")
@ApiModel(value = "TbExternalAddressBook对象", description = "")
@TableRepeat(aClass = TbExternalAddressBook.class,groups = {SaveValidated.class,UpdateValidated.class})
@ColumnWidth(20)
public class TbExternalAddressBook implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelIgnore
    @ApiModelProperty("id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ExcelProperty(value = "姓名", index = 0)
    @ApiModelProperty("姓名")
    @FieldRepeat(message = "姓名不能重复！")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    private String userName;

    @ExcelProperty(value = "联系电话", index = 1)
    @ApiModelProperty("联系电话")
    @FieldRepeat(message = "联系电话不能重复！")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    private String phone;

    @ExcelProperty(value = "职位", index = 2)
    @ApiModelProperty("职位")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    private String position;

    @ExcelProperty(value = "所属项目", converter = DictConverter.class, index = 3)
    @ApiModelProperty("所属项目")
    @Dict(dictTable = "tb_projects", dicText = "project_name", dicCode = "id")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    private String project;

    @ExcelProperty(value = "所属单位", index = 4)
    @ApiModelProperty("所属单位")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    private String company;

    @ExcelIgnore
    @ApiModelProperty("所属机构")
    private String sysOrgCode;

    @ExcelIgnore
    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @OrderQuery
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty("更新人")
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    @ExcelProperty(value = "更新人",converter = DictConverter.class)
    private String updateBy;

    @ApiModelProperty("更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "更新时间")
    private Date updateTime;

    @ExcelIgnore
    @ApiModelProperty("删除标志")
    private Integer delFlag;


}
