From f6839337d85392dde294caf959e3f171230ba08b Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 10 七月 2025 11:11:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java
index 76be3b6..21b036e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java
@@ -1,15 +1,20 @@
package com.ruoyi.system.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.TProjectDeptMapper;
import com.ruoyi.system.model.TProjectDept;
import com.ruoyi.system.query.DeptListQuery;
import com.ruoyi.system.service.TProjectDeptService;
import com.ruoyi.system.vo.system.ProjectDeptListVO;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
+import java.util.stream.Collectors;
/**
* <p>
@@ -22,10 +27,24 @@
@Service
public class TProjectDeptServiceImpl extends ServiceImpl<TProjectDeptMapper, TProjectDept> implements TProjectDeptService {
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
public PageInfo<ProjectDeptListVO> pageList(DeptListQuery query) {
+ List<SysUser> sysUsers = sysUserMapper.selectAllList();
PageInfo<ProjectDeptListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
List<ProjectDeptListVO> list = this.baseMapper.pageList(query,pageInfo);
+ List<TProjectDept> projectDepts = this.baseMapper.selectList(new LambdaQueryWrapper<TProjectDept>()
+ .ne(TProjectDept::getParentId, 0));
+ for (ProjectDeptListVO projectDeptListVO : list) {
+ List<TProjectDept> collect = projectDepts.stream().filter(e -> e.getParentId().equals(projectDeptListVO.getId()))
+ .collect(Collectors.toList());
+ for (TProjectDept tProjectDept : collect) {
+ List<SysUser> collect1 = sysUsers.stream().filter(e -> e.getDeptId().equals(tProjectDept.getId())).collect(Collectors.toList());
+ tProjectDept.setUserCount(collect1.size());
+ }
+ projectDeptListVO.setChildren(collect);
+ }
pageInfo.setRecords(list);
return pageInfo;
}
--
Gitblit v1.7.1