瀏覽代碼

学生报到计划

dzx 1 月之前
父節點
當前提交
ebf0a839ae

+ 15 - 1
src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

@@ -13,6 +13,7 @@ import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseSemester;
+import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.student.dto.AddStudentReportPlanDto;
 import com.xjrsoft.module.student.dto.StudentReportPlanPageDto;
@@ -21,6 +22,7 @@ import com.xjrsoft.module.student.dto.UpdateStudentReportPlanDto;
 import com.xjrsoft.module.student.entity.StudentReportPlan;
 import com.xjrsoft.module.student.entity.StudentReportPlanClassRelation;
 import com.xjrsoft.module.student.service.IStudentReportPlanService;
+import com.xjrsoft.module.student.vo.StudentReportPlanClassRelationVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanPageVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanTreeVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanVo;
@@ -40,6 +42,7 @@ import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -58,6 +61,7 @@ public class StudentReportPlanController {
 
     private final IStudentReportPlanService studentReportPlanService;
     private final IBaseSemesterService semesterService;
+    private final IBaseClassService classService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value="学生报到计划列表(分页)")
@@ -76,7 +80,17 @@ public class StudentReportPlanController {
         if (studentReportPlan == null) {
            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(studentReportPlan, StudentReportPlanVo.class));
+        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()));
+        }
+
+        return RT.ok(planVo);
     }
 
 

+ 3 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportPlanClassRelationVo.java

@@ -28,6 +28,9 @@ public class StudentReportPlanClassRelationVo {
     @ApiModelProperty("班级id")
     private Long classId;
 
+    @ApiModelProperty("班级名称")
+    private String className;
+
 
 
 }