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

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 java.io.Serializable;
import java.util.Date;
import java.util.List;

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;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 耗材模板
 * </p>
 *
 * @author 2464
 * @since 2023-09-12
 */
@Getter
@Setter
@TableName("tb_consumables_template")
@ApiModel(value = "TbConsumablesTemplate对象", description = "耗材模板")
@TableRepeat(aClass = TbConsumablesTemplate.class,groups = {SaveValidated.class,UpdateValidated.class})
public class TbConsumablesTemplate implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotBlank(message = "id不能为空！",groups = {UpdateValidated.class})
    private String id;

    @ApiModelProperty("车辆种类")
    @NotBlank(message = "车辆种类不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "vehicle_type")
    @FieldRepeat(message = "相同项目内车辆种类不能重复！",other = "projectId")
    private String vehicleType;

    @ApiModelProperty("备注")
    private String remark;

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

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("更新时间")
    private Date updateTime;

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

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

    @ApiModelProperty("所属项目id")
    @NotBlank(message = "所属项目不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "id",dictTable = "tb_projects",dicText = "project_name")
    private String projectId;

    @TableField(exist = false)
    @Valid
    @NotEmpty(message = "耗材列表不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    private List<TbConsumablesTemplatePart> partList;
}
