| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.lang.tree.TreeUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.utils.TreeUtils; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private boolean hasChild(List<SysDept> list, SysDept t) { |
| | | return getChildList(list, t).size() > 0; |
| | | } |
| | | |
| | | |
| | | public List<SysDept> selectLeafSysDeptListBySysUserDept(SysUserDept sysUserDept){ |
| | | List<SysDept> list = deptMapper.selectSysDeptListBySysUserDept(sysUserDept); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | List<SysDept> tree = TreeUtils.buildDeptTree(list); |
| | | list = TreeUtils.getLeafDepts(tree); |
| | | } |
| | | return list; |
| | | } |
| | | } |