Browse Source

新增report公用api

wangliang 4 năm trước cách đây
mục cha
commit
b0083e46d7

+ 106 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBExamStudentResult.java

@@ -0,0 +1,106 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.qmth.teachcloud.report.business.entity.TBExamStudent;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/7
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class TBExamStudentResult extends TBExamStudent implements Serializable {
+
+    @ApiModelProperty(value = "开课学院名称")
+    private String teachCollegeName;
+
+    @ApiModelProperty(value = "开课学院编码")
+    private String teachCollegeCode;
+
+    @ApiModelProperty(value = "考察学院名称")
+    private String inspectCollegeName;
+
+    @ApiModelProperty(value = "考察学院编码")
+    private String inspectCollegeCode;
+
+    @ApiModelProperty(value = "教师姓名")
+    private String teachName;
+
+    @ApiModelProperty(value = "教师编码")
+    private String teachCode;
+
+    @ApiModelProperty(value = "班级名称")
+    private String clazzName;
+
+    @ApiModelProperty(value = "班级编码")
+    private String clazzCode;
+
+    public String getClazzName() {
+        return clazzName;
+    }
+
+    public void setClazzName(String clazzName) {
+        this.clazzName = clazzName;
+    }
+
+    public String getClazzCode() {
+        return clazzCode;
+    }
+
+    public void setClazzCode(String clazzCode) {
+        this.clazzCode = clazzCode;
+    }
+
+    public String getTeachCollegeName() {
+        return teachCollegeName;
+    }
+
+    public void setTeachCollegeName(String teachCollegeName) {
+        this.teachCollegeName = teachCollegeName;
+    }
+
+    public String getInspectCollegeName() {
+        return inspectCollegeName;
+    }
+
+    public void setInspectCollegeName(String inspectCollegeName) {
+        this.inspectCollegeName = inspectCollegeName;
+    }
+
+    public String getTeachCollegeCode() {
+        return teachCollegeCode;
+    }
+
+    public void setTeachCollegeCode(String teachCollegeCode) {
+        this.teachCollegeCode = teachCollegeCode;
+    }
+
+    public String getInspectCollegeCode() {
+        return inspectCollegeCode;
+    }
+
+    public void setInspectCollegeCode(String inspectCollegeCode) {
+        this.inspectCollegeCode = inspectCollegeCode;
+    }
+
+    public String getTeachName() {
+        return teachName;
+    }
+
+    public void setTeachName(String teachName) {
+        this.teachName = teachName;
+    }
+
+    public String getTeachCode() {
+        return teachCode;
+    }
+
+    public void setTeachCode(String teachCode) {
+        this.teachCode = teachCode;
+    }
+}

+ 39 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TBExamStudentMapper.java

@@ -1,7 +1,11 @@
 package com.qmth.teachcloud.report.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
 import com.qmth.teachcloud.report.business.entity.TBExamStudent;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,39 @@ import com.qmth.teachcloud.report.business.entity.TBExamStudent;
  */
 public interface TBExamStudentMapper extends BaseMapper<TBExamStudent> {
 
+    /**
+     * 查询开课学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectTeachCollegeList(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+
+    /**
+     * 查询考察学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectInspectCollegeList(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+
+    /**
+     * 查询老师列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectTeachList(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+
+    /**
+     * 查询班级列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectClassList(@Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

+ 38 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TBExamStudentService.java

@@ -1,8 +1,11 @@
 package com.qmth.teachcloud.report.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
 import com.qmth.teachcloud.report.business.entity.TBExamStudent;
 
+import java.util.List;
+
 /**
  * <p>
  * 考生表 服务类
@@ -13,4 +16,39 @@ import com.qmth.teachcloud.report.business.entity.TBExamStudent;
  */
 public interface TBExamStudentService extends IService<TBExamStudent> {
 
+    /**
+     * 查询开课学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectTeachCollegeList(Long examId, String courseCode);
+
+    /**
+     * 查询考察学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectInspectCollegeList(Long examId, String courseCode);
+
+    /**
+     * 查询老师列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectTeachList(Long examId, String courseCode);
+
+    /**
+     * 查询班级列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectClassList(Long examId, String courseCode);
 }

+ 47 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java

@@ -1,11 +1,15 @@
 package com.qmth.teachcloud.report.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
 import com.qmth.teachcloud.report.business.entity.TBExamStudent;
 import com.qmth.teachcloud.report.business.mapper.TBExamStudentMapper;
 import com.qmth.teachcloud.report.business.service.TBExamStudentService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * <p>
  * 考生表 服务实现类
@@ -17,4 +21,47 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, TBExamStudent> implements TBExamStudentService {
 
+    @Resource
+    TBExamStudentMapper tbExamStudentMapper;
+
+    /**
+     * 查询开课学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<TBExamStudentResult> selectTeachCollegeList(Long examId, String courseCode) {
+        return tbExamStudentMapper.selectTeachCollegeList(examId, courseCode);
+    }
+
+    /**
+     * 查询考察学院列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<TBExamStudentResult> selectInspectCollegeList(Long examId, String courseCode) {
+        return tbExamStudentMapper.selectInspectCollegeList(examId, courseCode);
+    }
+
+    /**
+     * 查询老师列表
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<TBExamStudentResult> selectTeachList(Long examId, String courseCode) {
+        return tbExamStudentMapper.selectTeachList(examId, courseCode);
+    }
+
+    @Override
+    public List<TBExamStudentResult> selectClassList(Long examId, String courseCode) {
+        return tbExamStudentMapper.selectClassList(examId, courseCode);
+    }
 }

+ 64 - 0
teachcloud-report-business/src/main/resources/mapper/TBExamStudentMapper.xml

@@ -2,4 +2,68 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.teachcloud.report.business.mapper.TBExamStudentMapper">
 
+    <sql id="conditionSql">
+        <if test="examId != null and examId != ''">
+            and tbes.exam_id = #{examId}
+        </if>
+        <if test="courseCode != null and courseCode != ''">
+            and tbes.course_code = #{courseCode}
+        </if>
+    </sql>
+
+    <select id="selectTeachCollegeList" resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
+        select
+            DISTINCT tbes.teach_college_id as teachCollegeId,
+            tbsc.college_name as teachCollegeName,
+            tbsc.college_code as teachCollegeCode
+        from
+            t_b_exam_student tbes
+        join t_b_school_college tbsc on
+            tbsc.id = tbes.teach_college_id
+        <where>
+           <include refid="conditionSql" />
+        </where>
+    </select>
+
+    <select id="selectInspectCollegeList" resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
+        select
+            DISTINCT tbes.inspect_college_id as inspectCollegeId,
+            tbsc.college_name as inspectCollegeName,
+            tbsc.college_code as inspectCollegeCode
+        from
+            t_b_exam_student tbes
+        join t_b_school_college tbsc on
+            tbsc.id = tbes.inspect_college_id
+        <where>
+            <include refid="conditionSql" />
+        </where>
+    </select>
+
+    <select id="selectTeachList" resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
+        select
+            DISTINCT tbes.teacher_id as teacherId,
+            tbst.teacher_name as teachName,
+            tbst.teacher_code as teachCode
+        from
+            t_b_exam_student tbes
+        join t_b_school_teacher tbst on
+            tbst.id = tbes.teacher_id
+        <where>
+            <include refid="conditionSql" />
+        </where>
+    </select>
+
+    <select id="selectClassList" resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
+        select
+            DISTINCT tbes.clazz_id as clazzId,
+            tbsc.clazz_name as clazzName,
+            tbsc.clazz_code as clazzCode
+        from
+            t_b_exam_student tbes
+        join t_b_school_clazz tbsc on
+            tbsc.id = tbes.clazz_id
+        <where>
+            <include refid="conditionSql" />
+        </where>
+    </select>
 </mapper>

+ 54 - 2
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysReportController.java

@@ -2,12 +2,17 @@ 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.contant.SystemConstant;
 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.bean.result.TBExamStudentResult;
 import com.qmth.teachcloud.report.business.entity.TBExam;
+import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.enums.SemesterEnum;
+import com.qmth.teachcloud.report.business.service.TBExamCourseService;
 import com.qmth.teachcloud.report.business.service.TBExamService;
+import com.qmth.teachcloud.report.business.service.TBExamStudentService;
 import io.swagger.annotations.*;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -27,12 +32,18 @@ public class SysReportController {
     @Resource
     TBExamService tbExamService;
 
+    @Resource
+    TBExamCourseService tbExamCourseService;
+
+    @Resource
+    TBExamStudentService tbExamStudentService;
+
     @ApiOperation(value = "学期列表")
     @RequestMapping(value = "/common/list_semester", method = RequestMethod.POST)
     @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));
+        tbExamQueryWrapper.select(" DISTINCT id,semester ").eq("school_id", SystemConstant.convertIdToLong(schoolId));
         List<TBExam> tbExamList = tbExamService.list(tbExamQueryWrapper);
         List<TBExamResult> tbExamResultList = null;
         if (Objects.nonNull(tbExamList) && tbExamList.size() > 0) {
@@ -51,7 +62,7 @@ public class SysReportController {
                            @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("school_id", SystemConstant.convertIdToLong(schoolId))
                 .eq("semester", semesterEnum);
         List<TBExam> tbExamList = tbExamService.list(tbExamQueryWrapper);
         List<TBExamResult> tbExamResultList = null;
@@ -63,4 +74,45 @@ public class SysReportController {
         }
         return ResultUtil.ok(tbExamResultList);
     }
+
+    @ApiOperation(value = "课程列表")
+    @RequestMapping(value = "/common/list_course", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "科目信息", response = TBExamCourse.class)})
+    public Result listCourse(@ApiParam(value = "考试id", required = true) @RequestParam String examId) {
+        QueryWrapper<TBExamCourse> tbExamCourseQueryWrapper = new QueryWrapper<>();
+        tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getExamId, SystemConstant.convertIdToLong(examId));
+        return ResultUtil.ok(tbExamCourseService.list(tbExamCourseQueryWrapper));
+    }
+
+    @ApiOperation(value = "开课学院列表")
+    @RequestMapping(value = "/common/list_teach_college", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
+    public Result listTeachCollege(@ApiParam(value = "考试id", required = true) @RequestParam String examId,
+                                   @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
+        return ResultUtil.ok(tbExamStudentService.selectTeachCollegeList(SystemConstant.convertIdToLong(examId), courseCode));
+    }
+
+    @ApiOperation(value = "考察学院列表")
+    @RequestMapping(value = "/common/list_inspect_college", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
+    public Result listInspectCollege(@ApiParam(value = "考试id", required = true) @RequestParam String examId,
+                                     @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
+        return ResultUtil.ok(tbExamStudentService.selectInspectCollegeList(SystemConstant.convertIdToLong(examId), courseCode));
+    }
+
+    @ApiOperation(value = "教师列表")
+    @RequestMapping(value = "/common/list_teacher", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
+    public Result listTeacher(@ApiParam(value = "考试id", required = true) @RequestParam String examId,
+                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
+        return ResultUtil.ok(tbExamStudentService.selectTeachList(SystemConstant.convertIdToLong(examId), courseCode));
+    }
+
+    @ApiOperation(value = "班级列表")
+    @RequestMapping(value = "/common/list_class", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
+    public Result listClass(@ApiParam(value = "考试id", required = true) @RequestParam String examId,
+                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
+        return ResultUtil.ok(tbExamStudentService.selectClassList(SystemConstant.convertIdToLong(examId), courseCode));
+    }
 }