feat:用户根据当前部门和当前部门及其子部门查询
This commit is contained in:
1 parent
91d310fa04
commit
9db145a4ac
3 files changed
+21
No files matched your search
@@ -23,6 +23,7 @@ import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections4.set.ListOrderedSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -65,4 +66,11 @@ public class UserDTO extends SysUser {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
/**
|
||||
* false 当前部门
|
||||
* true 当前部门及子部门
|
||||
*/
|
||||
private Boolean isDeepDept;
|
||||
private List<Long> deptIds;
|
||||
|
||||
}
|
||||
+7
@@ -221,6 +221,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
*/
|
||||
@Override
|
||||
public IPage getUsersWithRolePage(Page page, UserDTO userDTO) {
|
||||
if (userDTO.getIsDeepDept() && ObjectUtil.isNotEmpty(userDTO.getDeptId())) {
|
||||
List<SysDept> deptList = sysDeptService.listDescendant(userDTO.getDeptId());
|
||||
userDTO.setDeptId(null);
|
||||
if (ObjectUtil.isNotEmpty(deptList)) {
|
||||
userDTO.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
IPage<UserVO> list = baseMapper.getUserVosPage(page, userDTO, DataScope.of());
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
List<Long> userIds = list.getRecords().stream().map(UserVO::getUserId).distinct().toList();
|
||||
|
||||
@@ -178,6 +178,12 @@
|
||||
<if test="query.deptId != null and query.deptId != ''">
|
||||
AND u.dept_id = #{query.deptId}
|
||||
</if>
|
||||
<if test="query.deptIds != null and query.deptIds.size() != 0">
|
||||
and u.dept_id IN
|
||||
<foreach collection="query.deptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.phone != null and query.phone != ''">
|
||||
<bind name="phoneLike" value="'%'+query.phone+'%'"/>
|
||||
AND u.phone LIKE #{phoneLike}
|
||||
|
||||
Reference in new issue
Block a user