From 9c84530593e74c1596f84d42ab1ddc13910954c5 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期二, 26 十二月 2023 00:46:34 +0800 Subject: [PATCH] update 优化 框架整体提高查询性能 --- ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java index 36680e3..1907bd9 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java @@ -69,8 +69,10 @@ */ @Override public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) { + // 鍙煡璇㈡湭绂佺敤閮ㄩ棬 + bo.setStatus(UserConstants.DEPT_NORMAL); LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo); - List<SysDept> depts = baseMapper.selectList(lqw); + List<SysDeptVo> depts = baseMapper.selectDeptList(lqw); return buildDeptTreeSelect(depts); } @@ -83,6 +85,7 @@ lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus()); lqw.orderByAsc(SysDept::getParentId); lqw.orderByAsc(SysDept::getOrderNum); + lqw.orderByAsc(SysDept::getDeptId); return lqw; } @@ -93,7 +96,7 @@ * @return 涓嬫媺鏍戠粨鏋勫垪琛� */ @Override - public List<Tree<Long>> buildDeptTreeSelect(List<SysDept> depts) { + public List<Tree<Long>> buildDeptTreeSelect(List<SysDeptVo> depts) { if (CollUtil.isEmpty(depts)) { return CollUtil.newArrayList(); } @@ -218,8 +221,7 @@ if (LoginHelper.isSuperAdmin()) { return; } - SysDeptVo dept = baseMapper.selectDeptById(deptId); - if (ObjectUtil.isNull(dept)) { + if (baseMapper.countDeptById(deptId) == 0) { throw new ServiceException("娌℃湁鏉冮檺璁块棶閮ㄩ棬鏁版嵁锛�"); } } -- Gitblit v1.9.3