package com.mortals.xhx.module.database.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.database.model.vo.DatabaseRuleVo;
import lombok.Data;
/**
* 数据库规则实体对象
*
* @author zxfei
* @date 2023-07-15
*/
@Data
public class DatabaseRuleEntity extends DatabaseRuleVo {
    private static final long serialVersionUID = 1L;

    /**
    * 规则名称
    */
    @Excel(name = "规则名称")
    private String name;
    /**
    * 数据源名称
    */
    @Excel(name = "数据源名称")
    private String source;
    /**
    * 源表
    */
    @Excel(name = "源表")
    private String sourceTable;
    /**
    * 规则类型(1.SQL规则,2.正则规则,3.值域规则,4.标准包)
    */
    @Excel(name = "规则类型", readConverterExp = "1=SQL规则,2.正则规则,3.值域规则,4.标准包")
    private String type;
    /**
    * SQL表达式
    */
    @Excel(name = "SQL表达式")
    private String expression;
    /**
    * SQL过滤条件
    */
    @Excel(name = "SQL过滤条件")
    private String prerequisite;
    /**
    * 等级(1.一般,2.重要,3.严重)
    */
    @Excel(name = "等级", readConverterExp = "1=一般,2.重要,3.严重")
    private String level;
    /**
    * 权重(1.一般,2.重要,3.关键指标,4.重要指标)
    */
    @Excel(name = "权重", readConverterExp = "1=一般,2.重要,3.关键指标,4.重要指标")
    private String weights;
    /**
    * 规则描述
    */
    @Excel(name = "规则描述")
    private String description;
    /**
    * 类型(1.规范性,2.一致性,3.准确性,4.及时性,5.关联性,6.完整性,7.重复性)
    */
    @Excel(name = "类型", readConverterExp = "1=规范性,2.一致性,3.准确性,4.及时性,5.关联性,6.完整性,7.重复性")
    private String dataType;
    /**
    * 任务状态(0.停用,1.启用)
    */
    @Excel(name = "任务状态", readConverterExp = "0=停用,1.启用")
    private String statuses;
    /**
    * 备注
    */
    private String remark;
    @Override
    public int hashCode() {
         return this.getId().hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (obj instanceof DatabaseRuleEntity) {
            DatabaseRuleEntity tmp = (DatabaseRuleEntity) obj;
            if (this.getId() == tmp.getId()) {
                 return true;
            }
        }
        return false;
    }

    public void initAttrValue(){

            this.name = "";

            this.source = "";

            this.sourceTable = "";

            this.type = "";

            this.expression = "";

            this.prerequisite = "";

            this.level = "";

            this.weights = "";

            this.description = "";

            this.dataType = "1";

            this.statuses = "0";

            this.remark = "";
    }
}