package cc.smtweb.system.bpm.web.sys.base.billType;

import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.AbstractEntityCache;
import cc.smtweb.framework.core.cache.CacheManager;

/**
 * Created by 1 at 2022-08-25 18:13:32
 * 实体【[单据类型](SYS_BILL_TYPE)】的缓存类
 */
@SwCache(ident = "SYS_BILL_TYPE", title = "单据类型")
public class BillTypeCache extends AbstractEntityCache<BillType> {
    //缓存key：按编码
    public final static String mk_code = "code";

    public static BillTypeCache getInstance() {
        return CacheManager.getIntance().getCache(BillTypeCache.class);
    }

    public BillTypeCache() {
        //缓存key：按编码
        regMap(mk_code, "sbtp_code");
    }

    //缓存key：按编码
    public final BillType getByCode(String key) {
        return getByKey(mk_code, key);
    }

    public String getName(long id) {
        BillType bean = get(id);
        return bean != null ? bean.getName(): String.valueOf(id);
    }
}
