ソースを参照

我的作业代码提交

pans 6 ヶ月 前
コミット
86b62874c1

+ 1 - 1
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/mapper/mapping/CourseOpenMapper.xml

@@ -98,7 +98,7 @@
           b.ACCOUNT
       FROM
           COURSE_OPEN a
-      LEFT JOIN SYS_USER b ON  a.GRADES_ID = b.GRADES_ID
+      JOIN SYS_USER b ON  a.GRADES_ID = b.GRADES_ID
       WHERE
           a.SEMESTER_ID = #{semesterId}
         AND a.COURSE_ID = #{courseId}

+ 4 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/ExamPaperController.java

@@ -30,7 +30,10 @@ public class ExamPaperController extends BaseApiController {
         return CommonResult.data(examPaperService.page(model));
     }
 
-
+    @RequestMapping(value = "/selectPage", method = RequestMethod.POST)
+    public CommonResult<Page<ExamPaper>> selectPage(@RequestBody ExamPaperPageRequestVM model) {
+        return CommonResult.data(examPaperService.selectPage(model));
+    }
 
     @RequestMapping(value = "/taskExamPage", method = RequestMethod.POST)
     public CommonResult<Page<ExamPaper>> taskExamPageList(@RequestBody ExamPaperPageRequestVM model) {

+ 10 - 8
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperController.java

@@ -1,21 +1,17 @@
 package vip.xiaonuo.exam.controller.student;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.web.bind.annotation.*;
 import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.ExamPaper;
 import vip.xiaonuo.exam.service.ExamPaperAnswerService;
 import vip.xiaonuo.exam.service.ExamPaperService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
 import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperEditRequestVM;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageResponseVM;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.web.bind.annotation.*;
+import vip.xiaonuo.exam.vo.ExamPaperVo;
 
 import javax.validation.Valid;
 
@@ -46,4 +42,10 @@ public class ExamPaperController extends BaseApiController {
     public CommonResult<Page<ExamPaper>> pageList(@RequestBody @Valid ExamPaperPageVM model) {
         return CommonResult.data(examPaperService.studentPage(model));
     }
+
+
+    @RequestMapping(value = "/selectList", method = RequestMethod.POST)
+    public CommonResult<Page<ExamPaperVo>> selectList(@RequestBody @Valid ExamPaperPageVM model) {
+        return CommonResult.data(examPaperService.selectList(model));
+    }
 }

+ 5 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperMapper.java

@@ -10,6 +10,7 @@ import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperFilter;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperInfo;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
+import vip.xiaonuo.exam.vo.ExamPaperVo;
 
 import java.util.Date;
 import java.util.List;
@@ -36,4 +37,8 @@ public interface ExamPaperMapper extends BaseMapper<ExamPaper> {
     List<ExamPaper> selectByIds(@Param("ids") List<String> ids);
 
     Page<ExamPaper> selectExamList(@Param("bo") ExamPaperRequestVM model, @Param("page") Page<ExamPaper> page);
+
+    Page<ExamPaperVo> selectList(@Param("bo") ExamPaperPageVM model,@Param("page") Page<ExamPaper> page);
+
+    Page<ExamPaper> selectPage(@Param("bo") ExamPaperPageRequestVM requestVM, @Param("page") Page<ExamPaper> page);
 }

+ 50 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperMapper.xml

@@ -262,7 +262,28 @@
   </select>
 
 
-
+  <select id="selectPage" resultMap="BaseResultMap" parameterType="vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperPageRequestVM">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM t_exam_paper
+    <where>
+      and deleted=0
+      <if test="bo.id != null ">
+        and id= #{bo.id}
+      </if>
+      <if test="bo.level != null ">
+        and grade_level= #{bo.level}
+      </if>
+      <if test="bo.paperType != null ">
+        and paper_type= #{bo.paperType}
+      </if>
+      <if test="bo.name != null ">
+        and name like CONCAT('%',#{bo.name}, '%')
+      </if>
+      and is_select=0
+    </where>
+    order by create_time desc
+  </select>
 
 
   <select id="taskExamPage" resultMap="BaseResultMap" parameterType="vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperPageRequestVM">
@@ -383,4 +404,32 @@
     </if>
       order by create_time desc
   </select>
+
+  <select id="selectList" resultType="vip.xiaonuo.exam.vo.ExamPaperVo">
+    SELECT
+      tep.id,
+      tep.name,
+      su.ID userId,
+      cc.ID hourId,
+      cc.NAME hourName,
+      ch.ID chapterId,
+      ch.NAME chapterName ,
+      ch.COURSE_ID courseId,
+      ci.COURSE_NAME courseName,
+      co.GRADES_ID gradesId,
+      tepa.status,
+      tepa.id answerId
+    FROM
+      t_exam_paper tep
+    LEFT JOIN t_exam_paper_answer tepa ON tepa.exam_paper_id = tep.id
+    LEFT JOIN COURSE_RELATE cr ON cr.RELATE_ID = tep.id AND cr.FUNC_TYPE = 4
+    LEFT JOIN COURSE_CLASSHOUR cc ON cr.MAIN_ID = cc.ID
+    LEFT JOIN COURSE_CHAPTER ch ON cc.CHAPTER_ID = ch.ID
+    LEFT JOIN COURSE_INFO ci ON ch.COURSE_ID = ci.COURSE_ID
+    LEFT JOIN COURSE_OPEN co ON ch.course_id = co.COURSE_ID
+    LEFT JOIN SYS_USER su ON su.GRADES_ID = co.GRADES_ID
+    WHERE
+      tep.paper_type = #{bo.paperType}
+      AND su.ID = #{bo.userId}
+  </select>
 </mapper>

+ 6 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperService.java

@@ -9,7 +9,9 @@ import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperFilter;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperInfo;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
+import vip.xiaonuo.exam.vo.ExamPaperVo;
 
+import javax.validation.Valid;
 import java.util.List;
 
 public interface ExamPaperService extends BaseService<ExamPaper> {
@@ -31,4 +33,8 @@ public interface ExamPaperService extends BaseService<ExamPaper> {
     List<Integer> selectMothCount();
 
     Page<ExamPaper> selectExamList(ExamPaperRequestVM model);
+
+    Page<ExamPaperVo> selectList(@Valid ExamPaperPageVM model);
+
+    Page<ExamPaper> selectPage(ExamPaperPageRequestVM model);
 }

+ 25 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperServiceImpl.java

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
+import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.exam.api.CourseChapterPaperApi;
 import vip.xiaonuo.exam.domain.CourseChapterPaper;
 import vip.xiaonuo.exam.domain.ExamPaper;
@@ -35,6 +36,7 @@ import vip.xiaonuo.exam.viewmodel.admin.question.QuestionEditRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperFilter;
 import vip.xiaonuo.exam.viewmodel.student.dashboard.PaperInfo;
 import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
+import vip.xiaonuo.exam.vo.ExamPaperVo;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -77,6 +79,18 @@ public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements
         return pageInfo;
     }
 
+
+    @Override
+    public Page<ExamPaper> selectPage(ExamPaperPageRequestVM requestVM) {
+        Page<ExamPaper> page = new Page<ExamPaper>(requestVM.getCurrent(), requestVM.getSize());
+        page.setSearchCount(true); // 设置计算总记录数
+        Page<ExamPaper> pageInfo = examPaperMapper.selectPage(requestVM,page);
+        pageInfo.getRecords().forEach(examPaper -> {
+            examPaper.setCreateTimeStr(DateTimeUtil.dateFormat(examPaper.getCreateTime()));
+        });
+        return pageInfo;
+    }
+
     @Override
     public Page<ExamPaper> taskExamPage(ExamPaperPageRequestVM requestVM) {
         Page<ExamPaper> page = new Page<ExamPaper>(requestVM.getCurrent(), requestVM.getSize());
@@ -194,6 +208,17 @@ public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements
         return page;
     }
 
+    @Override
+    public Page<ExamPaperVo> selectList(ExamPaperPageVM model) {
+
+        Page<ExamPaper> page = new Page<ExamPaper>(model.getCurrent(), model.getSize());
+        page.setSearchCount(true); // 设置计算总记录数
+        model.setUserId(StpLoginUserUtil.getLoginUser().getId());
+        return examPaperMapper.selectList(model,page);
+    }
+
+
+
     private void examPaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, ExamPaper examPaper, List<ExamPaperTitleItemVM> titleItemsVM) {
         Integer gradeLevel = null;
         if(examPaperEditRequestVM.getSubjectId() != null){

+ 4 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TExamServiceImpl.java

@@ -14,6 +14,7 @@ package vip.xiaonuo.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
@@ -129,7 +130,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
         }
         if(query){
             List<String>  studentAccounts=courseOpenMapper.selectAccount(tExamAddParam.getSemesterId(),tExamAddParam.getCourseId());
-            if(studentAccounts != null){
+            if(CollectionUtil.isNotEmpty(studentAccounts)){
                 String studentIdsStr = String.join(",", studentAccounts);
                 tExam.setStudentIds(studentIdsStr);
             }else{
@@ -198,17 +199,16 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
 
         if(query){
             List<String>  studentAccounts=courseOpenMapper.selectAccount(tExamEditParam.getSemesterId(),tExamEditParam.getCourseId());
-            if(studentAccounts != null){
+            if(CollectionUtil.isNotEmpty(studentAccounts)){
                 String studentIdsStr = String.join(",", studentAccounts);
                 tExamEditParam.setStudentIds(studentIdsStr);
             }else{
-                return CommonResult.error("没有查询到学生信息!!!");
+                return CommonResult.error("根据学期和课程没有查询到学生信息!!!");
             }
         }
 
 
 
-
         if(tExamEditParam.getPaperId() != null && !tExamEditParam.getPaperId().isEmpty()){
             ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamEditParam.getPaperId()));
             if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){

+ 10 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/viewmodel/student/exam/ExamPaperPageVM.java

@@ -13,6 +13,8 @@ public class ExamPaperPageVM extends BasePage {
     private Integer current;
     private Integer size;
 
+    private String userId;
+
     public Integer getPaperType() {
         return paperType;
     }
@@ -52,4 +54,12 @@ public class ExamPaperPageVM extends BasePage {
     public void setSize(Integer size) {
         this.size = size;
     }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
 }

+ 59 - 0
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/vo/ExamPaperVo.java

@@ -0,0 +1,59 @@
+package vip.xiaonuo.exam.vo;
+
+import lombok.Data;
+
+@Data
+public class ExamPaperVo {
+    /**
+     * 试卷id
+     */
+    private Integer id;
+    /**
+     * 试卷名称
+     */
+    private String name;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 课时id
+     */
+    private String hourId;
+
+    /**
+     * 课时名称
+     */
+    private String hourName;
+    /**
+     * 章节id
+     */
+    private String chapterId;
+    /**
+     * 章节名称
+     */
+    private String chapterName;
+    /**
+     * 课程id
+     */
+    private String courseId;
+    /**
+     * 课程名称
+     */
+    private String courseName;
+    /**
+     * 班级id
+     */
+    private Integer gradesId;
+    /**
+     * 试卷状态
+     */
+    private Integer status;
+    /**
+     * 试卷回答id
+     */
+    private Integer answerId;
+
+
+
+}