package cc.smtweb.system.bpm.web.sys.user.area;

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

import java.util.Set;

/**
 * Created by 1 at 2022-07-26 18:31:03
 * 实体【[行政区划](SYS_AREA)】的缓存类
 */
@SwCache(ident = "SYS_AREA", title = "行政区划")
public class AreaCache extends AbstractEntityCache<Area> {
    //缓存key：按编码
    public final static String mk_code = "code";
    //缓存key：按父ID
    public final static String mk_pr = "pr";

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

    public AreaCache() {
        //缓存key：按编码  M
        regMap(mk_code, "ar_code");
        //缓存key：按父ID  L
        regList(mk_pr, "ar_parent_id");
    }

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

    //缓存key：按父ID
    public final Set<Area> getByPr(String key) {
        return getListByKey(mk_pr, key);
    }
}
