|
@@ -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.annotation.SwCache; |
|
|
import cc.smtweb.framework.core.cache.AbstractEntityCache; |
|
|
import cc.smtweb.framework.core.cache.AbstractEntityCache; |
|
|
import cc.smtweb.framework.core.cache.CacheManager; |
|
|
import cc.smtweb.framework.core.cache.CacheManager; |
|
|
|
|
|
import cc.smtweb.framework.core.util.PubUtil; |
|
|
|
|
|
|
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
|
|
|
|
|
@@ -23,11 +24,28 @@ public class PartyCache extends AbstractEntityCache<Party> { |
|
|
|
|
|
|
|
|
public PartyCache() { |
|
|
public PartyCache() { |
|
|
//缓存key:按父ID |
|
|
//缓存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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |