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

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

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.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
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-09-07
 */
@Getter
@Setter
@TableName("tb_vehicle_check_template")
@ApiModel(value = "TbVehicleCheckTemplate对象", description = "")
@TableRepeat(aClass = TbVehicleCheckTemplate.class,groups = {SaveValidated.class,UpdateValidated.class})
@ColumnWidth(20)
public class TbVehicleCheckTemplate implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty("模板名称")
    @SelectQuery
    @FieldRepeat(message = "模板名称不能重复!")
    @ExcelProperty(value = "模板名称", index = 0)
    private String name;

    @ApiModelProperty("车辆种类")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @Dict(dicCode = "vehicle_type")
    @ExcelProperty(value = "车辆种类", index = 1,converter = DictConverter.class)
    private String vehicleType;

    @ApiModelProperty("备注")
    @ExcelProperty(value = "备注", index = 3)
    private String remark;

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

    @ApiModelProperty("创建人")
    @ExcelIgnore
    private String createBy;

    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    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;


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

    @ApiModelProperty("验收类型")
    @ExcelProperty(value = "验收类型",converter = DictConverter.class)
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @Dict(dicCode = "check_type")
    private String checkType;

    //验收项目
    /*@TableField(exist = false)
    @ExcelIgnore
    private Map<String,List<TbVehicleCheckTemplateProject>> projects;*/

    @TableField(exist = false)
    @ExcelIgnore
    private List<TbVehicleCheckTemplateProject> projectList;

    @TableField(exist = false)
    @ExcelProperty(value = "项目名称", index = 2)
    private String projectNames;

}
