src/main/java/com/ycl/jxkg/controller/admin/ExamPaperAnswerController.java
@@ -1,17 +1,19 @@ package com.ycl.jxkg.controller.admin; import com.github.pagehelper.PageInfo; import com.ycl.jxkg.base.BaseApiController; import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.entity.ExamPaperAnswer; import com.ycl.jxkg.domain.entity.Subject; import com.ycl.jxkg.domain.entity.User; import com.ycl.jxkg.service.*; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.service.ExamPaperAnswerService; import com.ycl.jxkg.service.SubjectService; import com.ycl.jxkg.service.UserService; import com.ycl.jxkg.utils.DateTimeUtil; import com.ycl.jxkg.utils.ExamUtil; import com.ycl.jxkg.utils.PageInfoHelper; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.github.pagehelper.PageInfo; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; @@ -25,6 +27,10 @@ private final SubjectService subjectService; private final UserService userService; @PostMapping("/pageExamPaper") public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageExamPaper(@RequestBody ExamPaperAnswerPageRequestVO model) { return Result.ok(examPaperAnswerService.pageExamPaper(model)); } @RequestMapping(value = "/page", method = RequestMethod.POST) public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVO model) { src/main/java/com/ycl/jxkg/domain/vo/admin/paper/ExamPaperAnswerPageRequestVO.java
@@ -3,9 +3,15 @@ import com.ycl.jxkg.base.BasePage; import lombok.Data; import java.util.List; @Data public class ExamPaperAnswerPageRequestVO extends BasePage { private Integer subjectId; private List<Integer> subjectId; private Integer examPaperId; private String name; } src/main/java/com/ycl/jxkg/domain/vo/student/exampaper/ExamPaperAnswerPageResponseVO.java
@@ -33,4 +33,14 @@ private String userName; /** * 试卷应考人数 */ private Integer personTotalNum; /** * 试卷参考人数 */ private Integer personAnswerNum; } src/main/java/com/ycl/jxkg/mapper/ExamPaperAnswerMapper.java
@@ -4,6 +4,7 @@ import com.ycl.jxkg.domain.entity.ExamPaperAnswer; import com.ycl.jxkg.domain.other.KeyValue; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -23,4 +24,6 @@ ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") Integer uid); List<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVO requestVM); List<ExamPaperAnswerPageResponseVO> pageExamPaper(ExamPaperAnswerPageRequestVO model); } src/main/java/com/ycl/jxkg/service/ExamPaperAnswerService.java
@@ -1,13 +1,14 @@ package com.ycl.jxkg.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.jxkg.domain.entity.ExamPaperAnswer; import com.github.pagehelper.PageInfo; import com.ycl.jxkg.domain.ExamPaperAnswerInfo; import com.ycl.jxkg.domain.entity.ExamPaperAnswer; import com.ycl.jxkg.domain.entity.User; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; import com.github.pagehelper.PageInfo; import java.util.List; @@ -52,4 +53,11 @@ List<Integer> selectMothCount(); PageInfo<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVO requestVM); /** * 答卷列表 * @param model 查询条件 * @return 数据 */ PageInfo<ExamPaperAnswerPageResponseVO> pageExamPaper(ExamPaperAnswerPageRequestVO model); } src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java
@@ -1,13 +1,20 @@ package com.ycl.jxkg.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.jxkg.domain.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ycl.jxkg.domain.ExamPaperAnswerInfo; import com.ycl.jxkg.domain.entity.*; import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; import com.ycl.jxkg.domain.other.KeyValue; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; import com.ycl.jxkg.enums.ExamPaperAnswerStatusEnum; import com.ycl.jxkg.enums.ExamPaperTypeEnum; import com.ycl.jxkg.enums.QuestionTypeEnum; import com.ycl.jxkg.domain.other.KeyValue; import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; import com.ycl.jxkg.mapper.ExamPaperAnswerMapper; import com.ycl.jxkg.mapper.ExamPaperMapper; import com.ycl.jxkg.mapper.QuestionMapper; @@ -18,12 +25,6 @@ import com.ycl.jxkg.utils.DateTimeUtil; import com.ycl.jxkg.utils.ExamUtil; import com.ycl.jxkg.utils.JsonUtil; import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO; import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO; import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -268,4 +269,10 @@ return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> examPaperAnswerMapper.adminPage(requestVM)); } @Override public PageInfo<ExamPaperAnswerPageResponseVO> pageExamPaper(ExamPaperAnswerPageRequestVO model) { return PageHelper.startPage(model.getPageIndex(), model.getPageSize()).doSelectPageInfo(() -> examPaperAnswerMapper.pageExamPaper(model)); } } src/main/resources/mapper/ExamPaperAnswerMapper.xml
@@ -65,16 +65,51 @@ </select> <select id="adminPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO"> <select id="adminPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO"> SELECT <include refid="Base_Column_List"/> FROM t_exam_paper_answer <where> <if test="subjectId != null"> and subject_id = #{subjectId} <if test="subjectId != null and subjectId.size() > 0"> AND subject_id IN <foreach collection="subjectId" item="item" open="(" separator="," close=")">#{item}</foreach> </if> <if test="examPaperId != null"> AND exam_paper_id = #{examPaperId} </if> </where> </select> <select id="pageExamPaper" resultType="com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO"> SELECT a.id, a.name AS paperName, a.score AS systemScore, a.question_count, a.subject_id, a.paper_type, b.name AS subjectName, c.real_name AS userName, IFNULL(COUNT(d.id), 0) AS personAnswerNum, IFNULL(COUNT(f.id), 0) AS personTotalNum FROM t_exam_paper a LEFT JOIN t_subject b ON a.subject_id = b.id LEFT JOIN t_user c ON a.create_user = c.id LEFT JOIN t_exam_paper_answer d ON a.id = d.exam_paper_id LEFT JOIN t_exam_paper_classes e ON a.id = e.exam_paper_id LEFT JOIN t_classes_user f ON e.classes_id = f.classes_id <where> a.deleted = 0 <if test="subjectId != null and subjectId.size() > 0"> AND a.subject_id IN <foreach collection="subjectId" item="item" open="(" separator="," close=")">#{item}</foreach> </if> <if test="name != null and name != ''"> AND INSTR(a.name, #{name}) </if> </where> GROUP BY a.id ORDER BY a.id DESC </select> </mapper>