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

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-09-19 16:55:23
 * 实体【[数据权限定义](SYS_DATA_RIGHT_DEFINE)】的缓存类
 */
@SwCache(ident = "SYS_DATA_RIGHT_DEFINE", title = "数据权限定义")
public class DataRightDefineCache extends AbstractEntityCache<DataRightDefine> {
    //缓存key：按编码
    public final static String mk_code = "code";
    //缓存key：按所属项目
    public final static String mk_mp = "mp";

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

    public DataRightDefineCache() {
        //缓存key：按编码
        regMap(mk_code, "sdrd_code");
        //缓存key：按所属项目
        regList(mk_mp, "sdrd_mp_id");
    }

    //缓存key：按编码
    public final DataRightDefine getByCode(String key) {
        return getByKey(mk_code, key);
    }
    //缓存key：按所属项目
    public final Set<DataRightDefine> getByMp(String key) {
        return getListByKey(mk_mp, key);
    }
}
