From 730fe7a503a47127ac6cc606609ac571cb38fedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Fri, 28 Jan 2022 23:56:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(SysDeptServiceImpl.java):=20=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=97=A0=E6=B3=95=E6=9F=A5=E8=AF=A2=E9=A1=B6=E7=BA=A7?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=EF=BC=8C?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=EF=BC=8C=E7=AD=89=E5=BE=85=E5=90=8E=E7=BB=AD=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E5=96=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../youlai/admin/mapper/SysDeptMapper.java | 2 +- .../service/impl/SysDeptServiceImpl.java | 28 ++++--------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java index 6d23b86ba..4655b8c8a 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java @@ -14,7 +14,7 @@ import java.util.List; @Mapper public interface SysDeptMapper extends BaseMapper { - @DataPermission + // @DataPermission @Override List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper); } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java index 5c7e2e83f..8767e0e2e 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java @@ -10,13 +10,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.youlai.admin.constant.SystemConstants; import com.youlai.admin.mapper.SysDeptMapper; import com.youlai.admin.pojo.entity.SysDept; -import com.youlai.admin.pojo.vo.dept.DeptVO; import com.youlai.admin.pojo.vo.IdLabelVO; +import com.youlai.admin.pojo.vo.dept.DeptVO; import com.youlai.admin.service.ISysDeptService; import com.youlai.admin.service.ISysUserService; import com.youlai.common.constant.GlobalConstants; -import com.youlai.common.web.util.JwtUtils; -import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import org.apache.logging.log4j.util.Strings; import org.springframework.stereotype.Service; @@ -30,11 +29,11 @@ import java.util.stream.Collectors; * @author haoxr * @date 2021-08-22 */ -@AllArgsConstructor @Service +@RequiredArgsConstructor public class SysDeptServiceImpl extends ServiceImpl implements ISysDeptService { - private ISysUserService iSysUserService; + private final ISysUserService iSysUserService; /** * 部门表格(Table)层级列表 @@ -120,24 +119,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl .eq(SysDept::getStatus, GlobalConstants.STATUS_YES) .orderByAsc(SysDept::getSort) ); - - boolean isRoot = JwtUtils.isRoot(); - Long parentId; - if (isRoot) { // 超级管理员 - parentId = SystemConstants.ROOT_DEPT_ID; - } else { - Long deptId = JwtUtils.getDeptId(); - if (deptId == null) { - return Collections.emptyList(); - } - SysDept dept = this.getById(deptId); - if (dept == null) { - return Collections.emptyList(); - } - parentId = dept.getParentId(); - - } - List deptSelectList = recursionTreeSelectList(parentId, deptList); + List deptSelectList = recursionTreeSelectList( SystemConstants.ROOT_DEPT_ID, deptList); return deptSelectList; }