新增组织查询调整 ids

This commit is contained in:
chenbowen
2025-10-29 08:51:35 +08:00
parent 10e2637838
commit 744567d999
4 changed files with 73 additions and 8 deletions

View File

@@ -3,6 +3,8 @@ package com.zt.plat.module.system.controller.admin.dept.vo.dept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 部门列表 Request VO")
@Data
public class DeptListReqVO {
@@ -21,4 +23,7 @@ public class DeptListReqVO {
@Schema(description = "是否集团", example = "false")
private Boolean isGroup;
@Schema(description = "部门编号集合,支持多部门查询", example = "[\"1001\", \"1002\"]")
private List<String> ids;
}

View File

@@ -1,5 +1,7 @@
package com.zt.plat.module.system.dal.mysql.dept;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zt.plat.framework.common.enums.CommonStatusEnum;
@@ -11,6 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author chenbowen
@@ -19,12 +22,21 @@ import java.util.List;
public interface DeptMapper extends BaseMapperX<DeptDO> {
default List<DeptDO> selectList(DeptListReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<DeptDO>()
.likeIfPresent(DeptDO::getName, reqVO.getName())
.eqIfPresent(DeptDO::getCode, reqVO.getCode())
.eqIfPresent(DeptDO::getStatus, reqVO.getStatus())
.eqIfPresent(DeptDO::getIsCompany, reqVO.getIsCompany())
);
LambdaQueryWrapperX<DeptDO> query = new LambdaQueryWrapperX<DeptDO>()
.likeIfPresent(DeptDO::getName, reqVO.getName())
.eqIfPresent(DeptDO::getCode, reqVO.getCode())
.eqIfPresent(DeptDO::getStatus, reqVO.getStatus())
.eqIfPresent(DeptDO::getIsCompany, reqVO.getIsCompany())
.eqIfPresent(DeptDO::getIsGroup, reqVO.getIsGroup());
if (CollUtil.isNotEmpty(reqVO.getIds())) {
List<Long> ids = reqVO.getIds().stream()
.filter(StrUtil::isNotBlank)
.map(String::trim)
.map(Long::valueOf)
.collect(Collectors.toList());
query.inIfPresent(DeptDO::getId, ids);
}
return selectList(query);
}
default DeptDO selectByParentIdAndName(Long parentId, String name) {