BUG修复
This commit is contained in:
parent
60f35138bb
commit
01664d1cbc
|
|
@ -120,8 +120,8 @@ public class BaseAreaController extends ControllerBase {
|
|||
@ApiMark(moduleName = "区域管理", apiName = "删除")
|
||||
public ApiResult<Boolean> del(@RequestBody List<Long> ids){
|
||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
||||
|
||||
baseAreaService.delByIds(ids, AdminUserUtil.getUserNo(), AdminUserUtil.getUserName());
|
||||
baseAreaService.getBaseMapper().deleteByIds(ids);
|
||||
// baseAreaService.delByIds(ids, AdminUserUtil.getUserNo(), AdminUserUtil.getUserName());
|
||||
return ApiResult.success(true);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,11 +139,11 @@ public class DepartmentController extends ControllerBase {
|
|||
@PostMapping("disable")
|
||||
@MethodInfoMark(value = "禁用",menuName = "部门管理")
|
||||
@ApiMark(moduleName = "部门管理", apiName = "禁用")
|
||||
public ApiResult<Boolean> disable(@RequestBody List<Integer> ids ){
|
||||
public ApiResult<Boolean> disable(@RequestBody List<Long> ids ){
|
||||
VUtils.trueThrowBusinessError(CollUtil.isEmpty(ids)).throwMessage("请选择要启用的数据");
|
||||
|
||||
List<TBaseDepartment> tBaseDepartments = departmentService.getBaseMapper().selectByIds(ids);
|
||||
List<Integer> childIds=new ArrayList<>();
|
||||
List<Long> childIds=new ArrayList<>();
|
||||
childIds.addAll(ids);
|
||||
for (TBaseDepartment tBaseDepartment : tBaseDepartments) {
|
||||
adminDepartmentService.getAllChildIds(tBaseDepartment, childIds);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import javax.validation.constraints.NotBlank;
|
|||
@Data
|
||||
public class DepartmentDTO {
|
||||
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "编码不能为空")
|
||||
private String deptCode;
|
||||
|
|
@ -16,5 +16,5 @@ public class DepartmentDTO {
|
|||
private String deptName;
|
||||
|
||||
|
||||
private Integer deptParentId=0;
|
||||
private Long deptParentId=0L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class AdminDepartmentService {
|
|||
List<BaseDepartmentVO> dataResult = Convert.toList(BaseDepartmentVO.class, result.getRecords());
|
||||
if(StrUtil.isNotBlank(query.getDeptCodeOrName())){
|
||||
List<BaseDepartmentVO> alldept = Convert.toList(BaseDepartmentVO.class,departmentService.lambdaQuery().eq(TBaseDepartment::getDataValidStatus,1).list()) ;
|
||||
Map<Integer, BaseDepartmentVO> collect = alldept.stream().collect(Collectors.toMap(BaseDepartmentVO::getId, Function.identity()));
|
||||
Map<Long, BaseDepartmentVO> collect = alldept.stream().collect(Collectors.toMap(BaseDepartmentVO::getId, Function.identity()));
|
||||
List<BaseDepartmentVO> allParents=new ArrayList<>();
|
||||
for (BaseDepartmentVO data:dataResult){
|
||||
allParents.addAll(getAllParents(data, collect)) ;
|
||||
|
|
@ -48,7 +48,7 @@ public class AdminDepartmentService {
|
|||
|
||||
}
|
||||
|
||||
public List<Integer> getAllChildIds(TBaseDepartment vo ,List<Integer> ids){
|
||||
public List<Long> getAllChildIds(TBaseDepartment vo ,List<Long> ids){
|
||||
List<BaseDepartmentVO> immediateChildren = findChildDepartmentsByParentId(vo.getId());
|
||||
ids.addAll(immediateChildren.stream().map(u->u.getId()).collect(Collectors.toSet()));
|
||||
for (BaseDepartmentVO child : immediateChildren) {
|
||||
|
|
@ -68,15 +68,15 @@ public class AdminDepartmentService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<BaseDepartmentVO> findChildDepartmentsByParentId(int parentId) {
|
||||
private List<BaseDepartmentVO> findChildDepartmentsByParentId(Long parentId) {
|
||||
List<TBaseDepartment> depts = departmentService.lambdaQuery().eq(TBaseDepartment::getDeptParentId, parentId).eq(TBaseDepartment::getDataValidStatus,1).list();
|
||||
return Convert.toList(BaseDepartmentVO.class,depts);
|
||||
|
||||
}
|
||||
|
||||
private List<BaseDepartmentVO> getAllParents(BaseDepartmentVO node, Map<Integer, BaseDepartmentVO> idToNodeMap) {
|
||||
private List<BaseDepartmentVO> getAllParents(BaseDepartmentVO node, Map<Long, BaseDepartmentVO> idToNodeMap) {
|
||||
List<BaseDepartmentVO> parents = new ArrayList<>();
|
||||
Integer parentId = node.getDeptParentId();
|
||||
Long parentId = node.getDeptParentId();
|
||||
while (parentId != null && parentId>0) {
|
||||
BaseDepartmentVO parentNode = idToNodeMap.get(parentId);
|
||||
if (parentNode == null) break; // 防止数据不一致导致无限循环
|
||||
|
|
@ -94,7 +94,7 @@ public class AdminDepartmentService {
|
|||
*/
|
||||
private List<BaseDepartmentVO> buildTree(List<BaseDepartmentVO> nodes) {
|
||||
// 使用Map存储id到Node的映射,便于快速查找父节点
|
||||
Map<Integer, BaseDepartmentVO> idToNodeMap = nodes.stream()
|
||||
Map<Long, BaseDepartmentVO> idToNodeMap = nodes.stream()
|
||||
.collect(Collectors.toMap(BaseDepartmentVO::getId, Function.identity()));
|
||||
|
||||
List<BaseDepartmentVO> roots = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
public class DepartmentSimpleVO {
|
||||
|
||||
// 部门id
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
//部门名称
|
||||
private String name;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class TBaseDepartment implements Serializable {
|
|||
* id 自增id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
|
|
@ -44,7 +44,7 @@ public class TBaseDepartment implements Serializable {
|
|||
/**
|
||||
* 部门父类ID
|
||||
*/
|
||||
private Integer deptParentId;
|
||||
private Long deptParentId;
|
||||
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
|
|
|
|||
Loading…
Reference in New Issue