Browse Source

部门及子部门为空,添加判断

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
b259b381ee
2 changed files with 5 additions and 1 deletions
  1. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SectionEnum.java
  2. +3
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SectionEnum.java View File

DEPT_IS_NOT_EXIST(1220302, "部门不存在"), DEPT_IS_NOT_EXIST(1220302, "部门不存在"),
SECTION_ID_IS_NULL(1220303, "路段id为空"), SECTION_ID_IS_NULL(1220303, "路段id为空"),
SECTION_LIST_IS_NULL(1220304, "路段列表为空"), SECTION_LIST_IS_NULL(1220304, "路段列表为空"),
DEPT_SECTION_IS_NOT_EXIST(1220305, "部门关联的路段为空");
DEPT_SECTION_IS_NOT_EXIST(1220305, "部门关联的路段为空"),
DEPT_ID_IS_NULL(1220306, "部门及子部门的id为空");


/** /**
* 错误码 * 错误码

+ 3
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java View File

return JsonResult.error(SectionEnum.DEPT_IS_NOT_EXIST.getCode(), SectionEnum.DEPT_IS_NOT_EXIST.getMsg()); return JsonResult.error(SectionEnum.DEPT_IS_NOT_EXIST.getCode(), SectionEnum.DEPT_IS_NOT_EXIST.getMsg());
} }
List<String> deptList = deptMapper.selectAllChildListById(deptId); List<String> deptList = deptMapper.selectAllChildListById(deptId);
if(StringUtils.isEmpty(deptList) && deptList.size()<=0){
return JsonResult.error(SectionEnum.DEPT_ID_IS_NULL.getCode(),SectionEnum.DEPT_ID_IS_NULL.getMsg());
}
//根据部门列表查对应的部门路段数据列表 //根据部门列表查对应的部门路段数据列表
List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(Wrappers.<SectionDept>lambdaQuery() List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(Wrappers.<SectionDept>lambdaQuery()
.eq(SectionDept::getTenantId, tenantId) .eq(SectionDept::getTenantId, tenantId)

Loading…
Cancel
Save