|
@@ -1,23 +1,66 @@
|
|
|
package com.qmth.teachcloud.report.api;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.TBExamResult;
|
|
|
+import com.qmth.teachcloud.report.business.entity.TBExam;
|
|
|
+import com.qmth.teachcloud.report.business.enums.SemesterEnum;
|
|
|
+import com.qmth.teachcloud.report.business.service.TBExamService;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
@Api(tags = "教研分析学校公用Controller")
|
|
|
@RestController
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.reportSchool}")
|
|
|
public class SysReportController {
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBExamService tbExamService;
|
|
|
+
|
|
|
@ApiOperation(value = "学期列表")
|
|
|
@RequestMapping(value = "/common/list_semester", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "学期信息", response = Result.class)})
|
|
|
- public Result taskQuery(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId) {
|
|
|
- return ResultUtil.ok();
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "考试信息", response = TBExamResult.class)})
|
|
|
+ public Result listSemester(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId) {
|
|
|
+ QueryWrapper<TBExam> tbExamQueryWrapper = new QueryWrapper<>();
|
|
|
+ tbExamQueryWrapper.select(" DISTINCT id,semester ").eq("school_id", Long.parseLong(schoolId));
|
|
|
+ List<TBExam> tbExamList = tbExamService.list(tbExamQueryWrapper);
|
|
|
+ List<TBExamResult> tbExamResultList = null;
|
|
|
+ if (Objects.nonNull(tbExamList) && tbExamList.size() > 0) {
|
|
|
+ tbExamResultList = new ArrayList<>();
|
|
|
+ for (TBExam tbExam : tbExamList) {
|
|
|
+ tbExamResultList.add(new TBExamResult(tbExam.getId(), tbExam.getSemester()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(tbExamResultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "考试列表")
|
|
|
+ @RequestMapping(value = "/common/list_exam", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "考试信息", response = TBExamResult.class)})
|
|
|
+ public Result listExam(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId,
|
|
|
+ @ApiParam(value = "学期枚举", required = true) @RequestParam SemesterEnum semesterEnum) {
|
|
|
+ QueryWrapper<TBExam> tbExamQueryWrapper = new QueryWrapper<>();
|
|
|
+ tbExamQueryWrapper.select(" DISTINCT id,exam_name as examName,exam_code as examCode ")
|
|
|
+ .eq("school_id", Long.parseLong(schoolId))
|
|
|
+ .eq("semester", semesterEnum);
|
|
|
+ List<TBExam> tbExamList = tbExamService.list(tbExamQueryWrapper);
|
|
|
+ List<TBExamResult> tbExamResultList = null;
|
|
|
+ if (Objects.nonNull(tbExamList) && tbExamList.size() > 0) {
|
|
|
+ tbExamResultList = new ArrayList<>();
|
|
|
+ for (TBExam tbExam : tbExamList) {
|
|
|
+ tbExamResultList.add(new TBExamResult(tbExam.getId(), tbExam.getExamName(), tbExam.getExamCode()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(tbExamResultList);
|
|
|
}
|
|
|
}
|