|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import com.ruoyi.common.annotation.DataScope; | 
|---|
|  |  |  | import com.ruoyi.common.constant.UserConstants; | 
|---|
|  |  |  | 
|---|
|  |  |  | return getChildList(list, t).size() > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Long> deptIdBySub(Long deptId) { | 
|---|
|  |  |  | QueryWrapper<SysDept> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | queryWrapper.select("dept_id").apply("string_to_array( ancestors, ',' ) @> ARRAY [ '"+deptId+"']"); | 
|---|
|  |  |  | //                in("cast(ancestors as bigint)",deptId); | 
|---|
|  |  |  | List<SysDept> list = deptMapper.selectList(queryWrapper); | 
|---|
|  |  |  | List<Long> deptList = new ArrayList<>(); | 
|---|
|  |  |  | deptList.add(deptId); | 
|---|
|  |  |  | for (int i = 0; i < list.size(); i++) { | 
|---|
|  |  |  | deptList.add(list.get(i).getDeptId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return deptList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|