소스 검색

开学报到编辑

大数据与最优化研究所 4 달 전
부모
커밋
b0c28f8e0b
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

+ 8 - 6
src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

@@ -38,6 +38,7 @@ import com.xjrsoft.module.student.vo.StudentReportPlanVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -85,12 +86,13 @@ public class StudentReportPlanController {
         }
         StudentReportPlanVo planVo = BeanUtil.toBean(studentReportPlan, StudentReportPlanVo.class);
         List<Long> classIds = studentReportPlan.getStudentReportPlanClassRelationList().stream().map(StudentReportPlanClassRelation::getClassId).collect(Collectors.toList());
-
-        List<BaseClass> classList = classService.listByIds(classIds);
-        Map<Long, String> classMaps = classList.stream().collect(Collectors.toMap(BaseClass::getId, BaseClass::getName));
-        List<StudentReportPlanClassRelationVo> classRelationList = planVo.getStudentReportPlanClassRelationList();
-        for (StudentReportPlanClassRelationVo baseClass : classRelationList) {
-            baseClass.setClassName(classMaps.get(baseClass.getClassId()));
+        if(CollectionUtils.isNotEmpty(classIds)){
+            List<BaseClass> classList = classService.listByIds(classIds);
+            Map<Long, String> classMaps = classList.stream().collect(Collectors.toMap(BaseClass::getId, BaseClass::getName));
+            List<StudentReportPlanClassRelationVo> classRelationList = planVo.getStudentReportPlanClassRelationList();
+            for (StudentReportPlanClassRelationVo baseClass : classRelationList) {
+                baseClass.setClassName(classMaps.get(baseClass.getClassId()));
+            }
         }
 
         return RT.ok(planVo);