ソースを参照

教师出卷添加条件分页

tags/正式版本
王宁 2年前
コミット
cc08cbcf26

+ 11
- 3
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperController.java ファイルの表示

@@ -1,10 +1,14 @@
1 1
 package com.xhkjedu.sexam.controller.paper;
2 2
 
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
3 5
 import com.xhkjedu.sexam.model.exam.ESubject;
4 6
 import com.xhkjedu.sexam.model.paper.EPaper;
5 7
 import com.xhkjedu.sexam.model.paper.EPaperBack;
6 8
 import com.xhkjedu.sexam.service.paper.EPaperService;
7 9
 import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.utils.PageUtil;
11
+import com.xhkjedu.vo.PageResult;
8 12
 import com.xhkjedu.vo.ResultVo;
9 13
 import org.springframework.web.bind.annotation.*;
10 14
 
@@ -60,9 +64,13 @@ public class EPaperController {
60 64
     //教师出卷列表
61 65
     @PostMapping("/listt")
62 66
     public ResultVo examTeacherPaperList(@RequestBody ESubject subject){
63
-        N_Utils.validation(new Object[]{subject.getTeacherid(),"教师id",1});
64
-        List<Map> list = ePaperService.listExamPapersByTeacherid(subject.getTeacherid());
65
-        return new ResultVo(0,"成功获取教师出卷信息",list);
67
+        Integer page = subject.getPage();
68
+        Integer pageSize = subject.getPageSize();
69
+        N_Utils.validation(new Object[]{subject.getTeacherid(),"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
70
+        PageHelper.startPage(page, pageSize);
71
+        List<Map> rtnlst = ePaperService.listExamPapersByTeacherid(subject.getTeacherid(),subject.getEsstate());
72
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(rtnlst));
73
+        return new ResultVo(0,"成功获取教师出卷信息",pageResult);
66 74
     }
67 75
 
68 76
 

+ 17
- 3
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EPaperStudentController.java ファイルの表示

@@ -1,9 +1,12 @@
1 1
 package com.xhkjedu.sexam.controller.paperstudent;
2 2
 
3
-import com.xhkjedu.sexam.model.paper.EPaper;
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
4 5
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
5 6
 import com.xhkjedu.sexam.service.paperstudent.EPaperStudentService;
6 7
 import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
7 10
 import com.xhkjedu.vo.ResultVo;
8 11
 import org.springframework.web.bind.annotation.PostMapping;
9 12
 import org.springframework.web.bind.annotation.RequestBody;
@@ -29,8 +32,19 @@ public class EPaperStudentController {
29 32
     @PostMapping("/list")
30 33
     public ResultVo listExamPapersForStudent(@RequestBody EPaperStudent eps){
31 34
         N_Utils.validation(new Object[]{eps.getStudentid(),"学生id",1});
32
-        List<Map> rtnlst = ePaperStudentService.listExamPaperForStudent(eps);
33
-        return new ResultVo(0,"成功获取考试列表",rtnlst);
35
+        if(eps.getSstate() == 1){
36
+           //进行中
37
+            List<Map> rtnlst = ePaperStudentService.listExamPaperForStudent(eps);
38
+            return new ResultVo(0,"成功获取考试列表",rtnlst);
39
+        }else{
40
+            Integer page = eps.getPage();
41
+            Integer pageSize = eps.getPageSize();
42
+            N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
43
+            PageHelper.startPage(page, pageSize);
44
+            List<Map> rtnlst = ePaperStudentService.listExamPaperForStudent(eps);
45
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(rtnlst));
46
+            return new ResultVo(0,"成功获取考试列表",pageResult);
47
+        }
34 48
     }
35 49
 
36 50
 

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperMapper.java ファイルの表示

@@ -21,7 +21,7 @@ public interface EPaperMapper extends TkMapper<EPaper> {
21 21
     List<Map> listExamPapers(@Param("examid") Integer examid);
22 22
 
23 23
     //教师出卷列表
24
-    List<Map> listExamPapersByTeacherid(@Param("teacherid") Integer teacherid);
24
+    List<Map> listExamPapersByTeacherid(@Param("teacherid") Integer teacherid,@Param("esstate") Integer esstate);
25 25
 
26 26
     //试卷详情
27 27
     Map getExamPaperDetailByEsid(@Param("esid") Integer esid);

+ 2
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java ファイルの表示

@@ -90,7 +90,7 @@ public class EPaperQtypeService {
90 90
         }
91 91
         //保存后清除试题栏中试题
92 92
         userBasketMapper.deleteByUseridAndSubjectid(paper.getCreateid(),espVo.getSubjectid());
93
-        return new ResultVo(0,"保存成功");
93
+        return new ResultVo(0,"保存成功",epid);
94 94
     }
95 95
 
96 96
     //设置试卷基本信息
@@ -184,6 +184,7 @@ public class EPaperQtypeService {
184 184
                 if(q.getQlevel()==1){
185 185
                     q.setQuestionpid("000");
186 186
                 }
187
+                q.setCtype(q.getQctype());
187 188
                 queslist.add(q);
188 189
             }
189 190
 

+ 2
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperService.java ファイルの表示

@@ -81,8 +81,8 @@ public class EPaperService {
81 81
     }
82 82
 
83 83
     //教师出卷列表
84
-    public List<Map> listExamPapersByTeacherid(Integer teacherid){
85
-        return ePaperMapper.listExamPapersByTeacherid(teacherid);
84
+    public List<Map> listExamPapersByTeacherid(Integer teacherid,Integer esstate){
85
+        return ePaperMapper.listExamPapersByTeacherid(teacherid,esstate);
86 86
     }
87 87
 
88 88
 

+ 8
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java ファイルの表示

@@ -9,7 +9,7 @@ import java.util.List;
9 9
 import java.util.Map;
10 10
 
11 11
 /**
12
- * @Description
12
+ * @Description 学生试卷信息
13 13
  * @Author WN
14 14
  * Date 2022/7/26 14:00
15 15
  **/
@@ -18,6 +18,13 @@ public class EPaperStudentService {
18 18
     @Resource
19 19
     private EPaperStudentMapper ePaperStudentMapper;
20 20
 
21
+    /**
22
+     * @Description  学生试卷列表
23
+     * @Param [eps]
24
+     * @Return java.util.List<java.util.Map>
25
+     * @Author wn
26
+     * @Date 2022/7/27 10:35
27
+     **/
21 28
     public List<Map> listExamPaperForStudent(EPaperStudent eps){
22 29
         return ePaperStudentMapper.listExamPaperForStudent(eps);
23 30
     }

+ 14
- 1
sexam/src/main/resources/mapper/paper/EPaperMapper.xml ファイルの表示

@@ -20,7 +20,20 @@
20 20
         left join e_base e on es.examid=e.examid
21 21
         left join t_user u on ep.handleid=u.userid
22 22
         left join t_user u2 on es.teacherid=u2.userid
23
-        where es.teacherid=#{teacherid} order by es.examid desc, es.esid asc
23
+        where es.teacherid=#{teacherid}
24
+        <if test="esstate == 1">
25
+            and es.esstate=1
26
+        </if>
27
+        <if test="esstate != 1">
28
+            and es.esstate!=1
29
+        </if>
30
+        group by es.esid
31
+        <if test="esstate == 1">
32
+            order by es.sdate desc,es.endtime desc
33
+        </if>
34
+        <if test="esstate != 1">
35
+            order by abs(UNIX_TIMESTAMP(concat(es.sdate,' ',es.begintime))-UNIX_TIMESTAMP())
36
+        </if>
24 37
     </select>
25 38
 
26 39
     <!--试卷详情-->

+ 14
- 15
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml ファイルの表示

@@ -2,7 +2,7 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper">
4 4
 
5
-    <!--学生考试列表-->
5
+    <!--学生进行中考试列表-->
6 6
     <select id="listExamPaperForStudent" resultType="java.util.Map">
7 7
         select es.esid,es.examid,es.subjectid,ts.subjectname,es.sdate,es.begintime,es.endtime,
8 8
                e.examname,e.gradeid,e.examtype,ep.epid
@@ -10,19 +10,18 @@
10 10
         left join e_base e on es.examid=e.examid
11 11
         left join e_class_student s on es.examid=s.examid
12 12
         left join t_subject ts on es.subjectid=ts.subjectid
13
-        where s.studentid=#{eps.studentid}
14
-        <if test="eps.sstate==1">
15
-            and e.examstate=1
16
-        </if>
17
-        <if test="eps.sstate==2">
18
-            and e.examstate=2
19
-        </if>
20
-        group by es.esid
21
-        <if test="eps.sstate==1">
22
-            order by abs(UNIX_TIMESTAMP(concat(es.sdate,' ',es.begintime))-UNIX_TIMESTAMP())
23
-        </if>
24
-        <if test="eps.sstate==2 or eps.sstate==0">
25
-            order by es.sdate desc,es.endtime desc
26
-        </if>
13
+        where s.studentid=#{eps.studentid} and e.examstate=1
14
+        order by abs(UNIX_TIMESTAMP(concat(es.sdate,' ',es.begintime))-UNIX_TIMESTAMP())
27 15
     </select>
16
+
17
+    <!--学生及已结束考试-->
18
+    <select id="listExamsForStudent" resultType="java.util.Map">
19
+        select e.examid,e.examname,e.examdate,e.gradeid,e.examtype,e.exammode,e.examcomm,
20
+               es.esid,es.subjectid,es.subjectname,es.sdate,es.begintime,es.endtime
21
+        from e_subject es left join e_base e on es.examid=e.examid
22
+                          left join e_class_student cs on es.examid=cs.examid
23
+        where cs.studentid=14 and e.examstate=0 group by es.esid
24
+        order by e.examdate desc,es.sdate desc,es.begintime desc
25
+    </select>
26
+
28 27
 </mapper>

+ 7
- 1
sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java ファイルの表示

@@ -14,10 +14,16 @@ import java.util.Map;
14 14
 
15 15
 @SpringBootTest
16 16
 class SexamApplicationTests {
17
+    @Resource
18
+    private EPaperQtypeService ePaperQtypeService;
17 19
 
18 20
     @Test
19 21
     void contextLoads() {
20
-
22
+        EPaper ePaper = new EPaper();
23
+        ePaper.setEpid(68);
24
+        ePaper.setPnum(15);
25
+        ePaper.setPscore(172.0);
26
+//        ePaperQtypeService.savePaperAnalyzeForQuestion(ePaper);
21 27
     }
22 28
 
23 29
 }

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java ファイルの表示

@@ -335,7 +335,7 @@ public class QuestionService {
335 335
         questionDirectorMapper.batchSave(saveQDirs);//保存试题关联章节
336 336
 
337 337
         //删除试题栏中原题,加入新题
338
-        userBasketMapper.deleteByQuestioniduid(question.getCreateid(),oldQuestion.getQuestionid());
338
+       /* userBasketMapper.deleteByQuestioniduid(question.getCreateid(),oldQuestion.getQuestionid());
339 339
         TUserBasket ub = new TUserBasket();
340 340
         ub.setUserid(question.getCreateid());
341 341
         ub.setSubjectid(question.getSubjectid());
@@ -343,7 +343,7 @@ public class QuestionService {
343 343
         ub.setQtypename(question.getQtypename());
344 344
         ub.setQuestionid(question.getQuestionid());
345 345
         ub.setCreatetime(question.getCreatetime());
346
-        userBasketMapper.insertSelective(ub);//保存新试题进入试题栏
346
+        userBasketMapper.insertSelective(ub);//保存新试题进入试题栏*/
347 347
 
348 348
         return question.getQuestionid();
349 349
     }

読み込み中…
キャンセル
保存