From e29c866d20c2092c776b1de42cf6ece30d4f97f5 Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Fri, 19 Sep 2025 16:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86-=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/entity/SysDept.java | 14 ++++++++++++- .../resources/mapper/system/SysDeptMapper.xml | 21 ++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/bonus-common/src/main/java/com/bonus/common/core/domain/entity/SysDept.java b/bonus-common/src/main/java/com/bonus/common/core/domain/entity/SysDept.java index 9ef9b46..1710deb 100644 --- a/bonus-common/src/main/java/com/bonus/common/core/domain/entity/SysDept.java +++ b/bonus-common/src/main/java/com/bonus/common/core/domain/entity/SysDept.java @@ -51,7 +51,19 @@ public class SysDept extends BaseEntity /** 父部门名称 */ private String parentName; - + /** + * 部署人员 + */ + private String userCount; + + public String getUserCount() { + return userCount; + } + + public void setUserCount(String userCount) { + this.userCount = userCount; + } + /** 子部门 */ private List children = new ArrayList(); diff --git a/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml b/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml index d8906c4..6be823b 100644 --- a/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -20,28 +20,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time - from sys_dept d + select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,COUNT(u.user_id) AS userCount + from sys_dept d + LEFT JOIN sys_user u ON u.dept_id = d.dept_id AND u.del_flag = '0' - where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1 + where d.dept_name=#{deptName} and d.parent_id = #{parentId} and d.del_flag = '0' + GROUP BY + d.dept_id + limit 1