Search in sources :

Example 1 with Dept

use of io.github.ihongs.serv.master.Dept in project HongsCORE by ihongs.

the class AuthKit method getMoreDepts.

/**
 * 获取所在的下级分组
 * @param uid
 * @return
 * @throws HongsException
 */
public static Set getMoreDepts(String uid) throws HongsException {
    Table rel = DB.getInstance("master").getTable("dept_user");
    List<Map> lst = rel.fetchCase().filter("user_id = ?", uid).select("dept_id").getAll();
    Set set = new HashSet();
    Dept dp = new Dept();
    for (Map row : lst) {
        String id = (String) row.get("dept_id");
        set.addAll(dp.getChildIds(id, true));
    }
    return set;
}
Also used : Table(io.github.ihongs.db.Table) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Dept(io.github.ihongs.serv.master.Dept) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 2 with Dept

use of io.github.ihongs.serv.master.Dept in project HongsCORE by ihongs.

the class AuthKit method getLessDepts.

/**
 * 获取所在的顶层分组
 * @param deptIds
 * @return
 * @throws HongsException
 */
public static Set getLessDepts(Set<String> deptIds) throws HongsException {
    Set set = new TreeSet();
    Dept dp = new Dept();
    for (String id : deptIds) {
        set.add(getDeptPath(id, dp));
    }
    return getPeakPids(set);
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Dept(io.github.ihongs.serv.master.Dept) TreeSet(java.util.TreeSet)

Example 3 with Dept

use of io.github.ihongs.serv.master.Dept in project HongsCORE by ihongs.

the class AuthKit method getLessDepts.

/**
 * 获取所在的顶层分组
 * @param uid
 * @return
 * @throws HongsException
 */
public static Set getLessDepts(String uid) throws HongsException {
    Table rel = DB.getInstance("master").getTable("dept_user");
    List<Map> lst = rel.fetchCase().filter("user_id = ?", uid).select("dept_id").getAll();
    Set set = new TreeSet();
    Dept dp = new Dept();
    for (Map row : lst) {
        String id = (String) row.get("dept_id");
        set.add(getDeptPath(id, dp));
    }
    return getPeakPids(set);
}
Also used : Table(io.github.ihongs.db.Table) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Dept(io.github.ihongs.serv.master.Dept) TreeSet(java.util.TreeSet) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with Dept

use of io.github.ihongs.serv.master.Dept in project HongsCORE by ihongs.

the class AuthKit method getMoreDepts.

/**
 * 获取所在的下级分组
 * @param deptIds
 * @return
 * @throws HongsException
 */
public static Set getMoreDepts(Set<String> deptIds) throws HongsException {
    Set set = new HashSet();
    Dept dp = new Dept();
    for (String id : deptIds) {
        set.addAll(dp.getChildIds(id, true));
    }
    return set;
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Dept(io.github.ihongs.serv.master.Dept) HashSet(java.util.HashSet)

Aggregations

Dept (io.github.ihongs.serv.master.Dept)4 HashSet (java.util.HashSet)4 Set (java.util.Set)4 TreeSet (java.util.TreeSet)4 Table (io.github.ihongs.db.Table)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2