package com.chushang.inspection.project.po;

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.chushang.common.core.validator.Create;
import com.chushang.common.core.validator.Update;
import com.chushang.common.mybatis.annotation.Condition;
import com.chushang.common.mybatis.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
  * @auther: zhao
  * @date: 2024/6/18 15:39
  */
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "inspection_config")
public class InspectionConfig extends BaseEntity {
    /**
     * 配置id 主键
     */
    @TableId(value = "config_id", type = IdType.ASSIGN_ID)
    @NotNull(message = "配置id 不能为空", groups = Update.class)
    @Null(message = "配置id 必须为空", groups = Create.class)
    private Long configId;
    /**
     * 任务id
     */
    @TableField(value = "task_id")
    @Condition(name = "task_id", type = Condition.ConditionType.eq)
    @NotNull(message = "所属任务不能为空", groups = Create.class)
    private Long taskId;
    /**
     * 对应部门Id
     */
    @TableField(value = "dept_id")
    private Long deptId;
    /**
     * 配置名称 name
     */
    @TableField(value = "config_name")
    @Condition(name = "config_name", type = Condition.ConditionType.eq)
    private String configName;
    /**
     * 配置别名
     */
    @TableField(value = "`alias`")
    @Condition(name = "`alias`", type = Condition.ConditionType.eq)
    @NotNull(message = "巡检单别名不能为空", groups = {Update.class,Create.class})
    private String alias;
    /**
     * 模板名称
     */
    @TableField(value = "`template`")
    @Condition(name = "`template`", type = Condition.ConditionType.eq)
    private String template;
    /**
     * 模板所属路径
     */
    @TableField(value = "template_url")
    private String templateUrl;
    /**
     * 模板所属fid
     */
    @TableField(value = "template_fid")
    private String templateFid;

    @TableField(value = "`templateId`")
    @NotNull(message = "巡检单模板id不能为空", groups = {Update.class,Create.class})
    private Long templateId;

}
