Browse Source

教师出卷添加条件分页

tags/正式版本
王宁 2 years ago
parent
commit
cc08cbcf26

+ 11
- 3
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperController.java View File

1
 package com.xhkjedu.sexam.controller.paper;
1
 package com.xhkjedu.sexam.controller.paper;
2
 
2
 
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
3
 import com.xhkjedu.sexam.model.exam.ESubject;
5
 import com.xhkjedu.sexam.model.exam.ESubject;
4
 import com.xhkjedu.sexam.model.paper.EPaper;
6
 import com.xhkjedu.sexam.model.paper.EPaper;
5
 import com.xhkjedu.sexam.model.paper.EPaperBack;
7
 import com.xhkjedu.sexam.model.paper.EPaperBack;
6
 import com.xhkjedu.sexam.service.paper.EPaperService;
8
 import com.xhkjedu.sexam.service.paper.EPaperService;
7
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.utils.PageUtil;
11
+import com.xhkjedu.vo.PageResult;
8
 import com.xhkjedu.vo.ResultVo;
12
 import com.xhkjedu.vo.ResultVo;
9
 import org.springframework.web.bind.annotation.*;
13
 import org.springframework.web.bind.annotation.*;
10
 
14
 
60
     //教师出卷列表
64
     //教师出卷列表
61
     @PostMapping("/listt")
65
     @PostMapping("/listt")
62
     public ResultVo examTeacherPaperList(@RequestBody ESubject subject){
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 View File

1
 package com.xhkjedu.sexam.controller.paperstudent;
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
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
5
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
5
 import com.xhkjedu.sexam.service.paperstudent.EPaperStudentService;
6
 import com.xhkjedu.sexam.service.paperstudent.EPaperStudentService;
6
 import com.xhkjedu.utils.N_Utils;
7
 import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
7
 import com.xhkjedu.vo.ResultVo;
10
 import com.xhkjedu.vo.ResultVo;
8
 import org.springframework.web.bind.annotation.PostMapping;
11
 import org.springframework.web.bind.annotation.PostMapping;
9
 import org.springframework.web.bind.annotation.RequestBody;
12
 import org.springframework.web.bind.annotation.RequestBody;
29
     @PostMapping("/list")
32
     @PostMapping("/list")
30
     public ResultVo listExamPapersForStudent(@RequestBody EPaperStudent eps){
33
     public ResultVo listExamPapersForStudent(@RequestBody EPaperStudent eps){
31
         N_Utils.validation(new Object[]{eps.getStudentid(),"学生id",1});
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 View File

21
     List<Map> listExamPapers(@Param("examid") Integer examid);
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
     Map getExamPaperDetailByEsid(@Param("esid") Integer esid);
27
     Map getExamPaperDetailByEsid(@Param("esid") Integer esid);

+ 2
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

90
         }
90
         }
91
         //保存后清除试题栏中试题
91
         //保存后清除试题栏中试题
92
         userBasketMapper.deleteByUseridAndSubjectid(paper.getCreateid(),espVo.getSubjectid());
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
                 if(q.getQlevel()==1){
184
                 if(q.getQlevel()==1){
185
                     q.setQuestionpid("000");
185
                     q.setQuestionpid("000");
186
                 }
186
                 }
187
+                q.setCtype(q.getQctype());
187
                 queslist.add(q);
188
                 queslist.add(q);
188
             }
189
             }
189
 
190
 

+ 2
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperService.java View File

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 View File

9
 import java.util.Map;
9
 import java.util.Map;
10
 
10
 
11
 /**
11
 /**
12
- * @Description
12
+ * @Description 学生试卷信息
13
  * @Author WN
13
  * @Author WN
14
  * Date 2022/7/26 14:00
14
  * Date 2022/7/26 14:00
15
  **/
15
  **/
18
     @Resource
18
     @Resource
19
     private EPaperStudentMapper ePaperStudentMapper;
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
     public List<Map> listExamPaperForStudent(EPaperStudent eps){
28
     public List<Map> listExamPaperForStudent(EPaperStudent eps){
22
         return ePaperStudentMapper.listExamPaperForStudent(eps);
29
         return ePaperStudentMapper.listExamPaperForStudent(eps);
23
     }
30
     }

+ 14
- 1
sexam/src/main/resources/mapper/paper/EPaperMapper.xml View File

20
         left join e_base e on es.examid=e.examid
20
         left join e_base e on es.examid=e.examid
21
         left join t_user u on ep.handleid=u.userid
21
         left join t_user u on ep.handleid=u.userid
22
         left join t_user u2 on es.teacherid=u2.userid
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
     </select>
37
     </select>
25
 
38
 
26
     <!--试卷详情-->
39
     <!--试卷详情-->

+ 14
- 15
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper">
4
 
4
 
5
-    <!--学生考试列表-->
5
+    <!--学生进行中考试列表-->
6
     <select id="listExamPaperForStudent" resultType="java.util.Map">
6
     <select id="listExamPaperForStudent" resultType="java.util.Map">
7
         select es.esid,es.examid,es.subjectid,ts.subjectname,es.sdate,es.begintime,es.endtime,
7
         select es.esid,es.examid,es.subjectid,ts.subjectname,es.sdate,es.begintime,es.endtime,
8
                e.examname,e.gradeid,e.examtype,ep.epid
8
                e.examname,e.gradeid,e.examtype,ep.epid
10
         left join e_base e on es.examid=e.examid
10
         left join e_base e on es.examid=e.examid
11
         left join e_class_student s on es.examid=s.examid
11
         left join e_class_student s on es.examid=s.examid
12
         left join t_subject ts on es.subjectid=ts.subjectid
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
     </select>
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
 </mapper>
27
 </mapper>

+ 7
- 1
sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java View File

14
 
14
 
15
 @SpringBootTest
15
 @SpringBootTest
16
 class SexamApplicationTests {
16
 class SexamApplicationTests {
17
+    @Resource
18
+    private EPaperQtypeService ePaperQtypeService;
17
 
19
 
18
     @Test
20
     @Test
19
     void contextLoads() {
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 View File

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

Loading…
Cancel
Save