From 22cbc8ec7da3b7345574a298385c85de5ae8c985 Mon Sep 17 00:00:00 2001
From: liux <963924687@qq.com>
Date: Mon, 5 Jan 2026 12:14:08 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84=E6=9D=83?=
=?UTF-8?q?=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../system/service/impl/SysDeptServiceImpl.java | 14 ++++++++++----
.../main/resources/mapper/system/SysDeptMapper.xml | 10 +++++++++-
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysDeptServiceImpl.java
index 97752fe..4455c9e 100644
--- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysDeptServiceImpl.java
+++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysDeptServiceImpl.java
@@ -92,11 +92,17 @@ public class SysDeptServiceImpl implements ISysDeptService {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
Long userId = SecurityUtils.getLoginUser().getUserid();
// 管理员和省公司可查看所有数据
- if (userId != null && deptId != null
- && !userId.equals(ADMIN_ID)
- && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
- dept.setDeptId(deptId);
+// if (userId != null && deptId != null
+// && !userId.equals(ADMIN_ID)
+// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
+// dept.setDeptId(deptId);
+// }
+ if(ADMIN_ID.equals(userId)){
+ dept.setCompanyId(1L);
+ }else{
+ dept.setCompanyId(deptId);
}
+
return deptMapper.selectDeptList(dept);
}
diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 71e3bce..f260742 100644
--- a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -75,7 +75,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where d.del_flag = '0'
- AND (find_in_set(#{companyId}, ancestors) or dept_id = #{companyId})
+
+ and d.dept_id in
+ (
+ select dept_id from sys_dept where dept_id = #{companyId}
+ union
+ select dept_id from sys_dept where parent_id = #{companyId}
+ union
+ select dept_id from sys_dept where find_in_set(#{companyId}, ancestors)
+ )
AND dept_id = #{deptId}