xiangpei
2024-05-27 13a68df58b3f937db5ba6437c814bafdcd8d37f8
src/main/java/com/mindskip/xzs/controller/admin/ExamTemplatesController.java
@@ -17,6 +17,8 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.stream.Collectors;
@RestController("AdminExamTemplatesController")
@RequestMapping(value = "/api/admin/exam/templates")
@@ -44,7 +46,11 @@
            vo.setName(e.getName());
            vo.setId(e.getId());
            vo.setCtime(e.getCtime());
            Integer[] ids = examTemplatesSubjectMapper.getTemplatesId(e.getId()).stream().map(ExamTemplatesSubject::getSubjectId).toArray(Integer[]::new);
            List<ExamTemplatesSubject> subjectList = examTemplatesSubjectMapper.getTemplatesId(e.getId());
            Integer[] ids = subjectList.stream().map(ExamTemplatesSubject::getSubjectId).toArray(Integer[]::new);
            String subjectNames = subjectList.stream().map(ExamTemplatesSubject::getSubjectName).collect(Collectors.joining("、"));
            vo.setSubjectNames(subjectNames);
            vo.setSubjectId(ids);
            return vo;
        });