用户管理查看禁用部门问题
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.repository;
|
package org.nl.modules.system.repository;
|
||||||
|
|
||||||
|
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||||
import org.nl.modules.system.domain.Dept;
|
import org.nl.modules.system.domain.Dept;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
@@ -42,6 +43,13 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
|
|||||||
*/
|
*/
|
||||||
List<Dept> findByPidIsNull();
|
List<Dept> findByPidIsNull();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取激活的部门
|
||||||
|
* @param enabled
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Dept> findAllByEnabled(Boolean enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID 查询
|
* 根据角色ID 查询
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
package org.nl.modules.system.repository;
|
package org.nl.modules.system.repository;
|
||||||
|
|
||||||
import org.nl.modules.system.domain.User;
|
import org.nl.modules.system.domain.User;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public class UserController {
|
|||||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||||
criteria.getDeptIds().add(criteria.getDeptId());
|
criteria.getDeptIds().add(criteria.getDeptId());
|
||||||
criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
|
criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
|
||||||
|
} else {
|
||||||
|
criteria.getDeptIds().addAll(deptService.getDeptEnabled());
|
||||||
}
|
}
|
||||||
// 数据权限
|
// 数据权限
|
||||||
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
|
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ public interface DeptService {
|
|||||||
*/
|
*/
|
||||||
List<Long> getDeptChildren(List<Dept> deptList);
|
List<Long> getDeptChildren(List<Dept> deptList);
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> getDeptEnabled();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -304,6 +304,16 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getDeptEnabled() {
|
||||||
|
List<Long> list = new ArrayList<>();
|
||||||
|
List<Dept> enabled = deptRepository.findAllByEnabled(true);
|
||||||
|
for (Dept dept : enabled) {
|
||||||
|
list.add(dept.getId());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Long> getChildIdSet(Long pid) {
|
public Set<Long> getChildIdSet(Long pid) {
|
||||||
String sql = "select dept_id from (\n" +
|
String sql = "select dept_id from (\n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user