Selaa lähdekoodia

单位缓存

master
yaoq 2 vuotta sitten
vanhempi
commit
caef46b597
1 muutettua tiedostoa jossa 22 lisäystä ja 4 poistoa
  1. +22
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/party/PartyCache.java

+ 22
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/party/PartyCache.java Näytä tiedosto

@@ -3,6 +3,7 @@ package cc.smtweb.system.bpm.web.sys.user.party;
import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.AbstractEntityCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.util.PubUtil;

import java.util.Set;

@@ -23,11 +24,28 @@ public class PartyCache extends AbstractEntityCache<Party> {

public PartyCache() {
//缓存key:按父ID
regList(mk_pr, "pt_parent_id");
regList(mk_pr, "pt_parent_id");
}

//缓存key:按父ID
public final Set<Party> getByPr(String key) {
return getListByKey(mk_pr, key);
//获取儿子
public final Set<Party> getChildren(Long key) {
return getListByKey(mk_pr, String.valueOf(key));
}

//获取顶级集合
public final Set<Party> getTopSet() {
return getChildren(-1L);
}

//是否顶级
public final boolean isTop(Long key) {
Party party = get(key);
return party != null && party.getParentId() <= 0;
}

//是否末级
public final boolean isLeaf(Long key) {
Set<Party> children = getChildren(key);
return PubUtil.isEmpty(children);
}
}

Ladataan…
Peruuta
Tallenna