package cn.lihongjie.coal.coalParameterDef.entity;

import cn.lihongjie.coal.base.entity.OrgCommonEntity;

import jakarta.persistence.Entity;

import lombok.Data;

import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Formula;

@Entity
@Data
public class CoalParameterDefEntity extends OrgCommonEntity {

    @Comment("上级名称")
    private String parentName;

    @Comment("类型 0 手动输入 1 自动计算")
    private String inputType;

    @Formula(
            "(select i.name\n"
                    + "from t_dictionary d,\n"
                    + "     t_dictionary_item i\n"
                    + "where d.id = i.dictionary_id\n"
                    + "  and d.code = 'coalParameter.inputType'\n"
                    + "  and i.code = input_type)")
    private String inputTypeName;

    @Comment("计算公式")
    private String formula;

    @Comment("解析后的公式")
    private String formula0;

    @Comment("依赖的字段")
    private String dependents;

    @Comment("计算优先级")
    private Integer priority;
}
