package cn.lihongjie.coal.meter.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;

@Data
@Entity
public class MeterEntity extends OrgCommonEntity {
    @Comment("类型")
    private String type;


    @Comment("初始值")
    private Double initValue;

    @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 = 'meter.type'\n"
                    + "  and i.code = type)")
    private String typeName;

    @Comment("安装位置")
    private String location;
}
