| | |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.TreeSelectWell; |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public List<SysDept> all() { |
| | | return deptMapper.selectList(null); |
| | | } |
| | | |
| | | @Override |
| | | public List<TreeSelectWell> wellTree(List<SysDept> depts) { |
| | | List<SysDept> deptTrees = buildDeptTree(depts); |
| | | return deptTrees.stream().map(TreeSelectWell::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | } |