Browse Source

考试设置 考生管理

年级科目下教师
tags/正式版本
雍文秀 2 years ago
parent
commit
dc641c87e7

+ 46
- 6
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

@@ -6,6 +6,7 @@ import com.xhkjedu.sexam.model.exam.EBase;
6 6
 import com.xhkjedu.sexam.model.exam.EClassStudent;
7 7
 import com.xhkjedu.sexam.model.exam.ESubject;
8 8
 import com.xhkjedu.sexam.service.exam.EBaseService;
9
+import com.xhkjedu.sexam.vo.exam.ExamVo;
9 10
 import com.xhkjedu.utils.N_Utils;
10 11
 import com.xhkjedu.utils.PageUtil;
11 12
 import com.xhkjedu.vo.PageResult;
@@ -55,7 +56,10 @@ public class EBaseController {
55 56
      * @Date 2022/7/18 10:52
56 57
      **/
57 58
     @PostMapping("/set_exam")
58
-    public ResultVo setExam(@RequestBody List<ESubject> subjects) {
59
+    public ResultVo setExam(@RequestBody ExamVo map) {
60
+        Integer notice = map.getNotice();//是否发送通知1发送2不发送
61
+        Integer msg = map.getMsg();//是否发送短信1发送2不发送
62
+        List<ESubject> subjects = map.getSubjects();
59 63
         for (ESubject s : subjects) {
60 64
             try {
61 65
                 N_Utils.validation(new Object[]{s.getExamid(), "考试id", 1, s.getSubjectid(), "科目id", 2});
@@ -158,6 +162,22 @@ public class EBaseController {
158 162
         return new ResultVo(0, "获取考试班级成功", map);
159 163
     }
160 164
 
165
+    /**
166
+     * 考生管理--获取考试和班级信息
167
+     *
168
+     * @return com.xhkjedu.vo.ResultVo
169
+     * @Param [eBase]
170
+     * @Author ywx
171
+     * @Date 2022/7/19 10:56
172
+     **/
173
+    @PostMapping("/get_eclass")
174
+    public ResultVo getExamAndClass(@RequestBody EBase eBase) {
175
+        Integer examid = eBase.getExamid();
176
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
177
+        Map map = eBaseService.getExamAndClass(examid);
178
+        return new ResultVo(0, "获取考试班级成功", map);
179
+    }
180
+
161 181
     /**
162 182
      * 获取考试学生
163 183
      *
@@ -167,11 +187,15 @@ public class EBaseController {
167 187
      * @Date 2022/7/18 16:57
168 188
      **/
169 189
     @PostMapping("/list_stu")
170
-    public ResultVo listStu(@RequestBody EBase eBase) {
171
-        Integer examid = eBase.getExamid();
172
-        N_Utils.validation(new Object[]{examid, "考试id", 1});
173
-        List<Map> list = eBaseService.listStu(eBase);
174
-        return new ResultVo(0, "获取考试学生成功", list);
190
+    public ResultVo listStu(@RequestBody EClassStudent cs) {
191
+        Integer examid = cs.getExamid();
192
+        Integer page = cs.getPage();
193
+        Integer pageSize = cs.getPageSize();
194
+        N_Utils.validation(new Object[]{examid, "考试id", 1, page, "页码", 1, pageSize, "显示条数", 1});
195
+        PageHelper.startPage(page, pageSize);
196
+        List<Map> list = eBaseService.listStu(cs);
197
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
198
+        return new ResultVo(0, "获取考试学生成功", pageResult);
175 199
     }
176 200
 
177 201
     @PostMapping("/del_stu")
@@ -181,4 +205,20 @@ public class EBaseController {
181 205
         eBaseService.delStu(ecsid);
182 206
         return new ResultVo(0, "移除考试学生成功");
183 207
     }
208
+
209
+    /**
210
+     * 考试科目列表
211
+     *
212
+     * @return com.xhkjedu.vo.ResultVo
213
+     * @Param [eBase]
214
+     * @Author ywx
215
+     * @Date 2022/7/19 9:03
216
+     **/
217
+    @PostMapping("/list_subject")
218
+    public ResultVo listSubject(@RequestBody EBase eBase) {
219
+        Integer examid = eBase.getExamid();
220
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
221
+        Map map = eBaseService.listSubject(examid);
222
+        return new ResultVo(0, "获取考试科目列表成功", map);
223
+    }
184 224
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EBaseMapper.java View File

@@ -19,4 +19,7 @@ public interface EBaseMapper extends TkMapper<EBase> {
19 19
 
20 20
     //修改考试状态
21 21
     void updateExamState(@Param("examid") Integer examid, @Param("examstate") int examstate);
22
+
23
+    //考试基本信息
24
+    Map findById(@Param("examid") Integer examid);
22 25
 }

+ 1
- 2
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassStudentMapper.java View File

@@ -1,7 +1,6 @@
1 1
 package com.xhkjedu.sexam.mapper.exam;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.exam.EBase;
5 4
 import com.xhkjedu.sexam.model.exam.EClassStudent;
6 5
 import org.apache.ibatis.annotations.Param;
7 6
 
@@ -13,5 +12,5 @@ public interface EClassStudentMapper extends TkMapper<EClassStudent> {
13 12
     List<EClassStudent> listByClassIds(@Param("classids") List<Integer> classids);
14 13
 
15 14
     //考试学生
16
-    List<Map> listByExamId(@Param("base") EBase base);
15
+    List<Map> listByExamId(@Param("cs") EClassStudent cs);
17 16
 }

+ 5
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectMapper.java View File

@@ -6,6 +6,7 @@ import com.xhkjedu.sexam.vo.exam.ESubjectVo;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.util.List;
9
+import java.util.Map;
9 10
 
10 11
 public interface ESubjectMapper extends TkMapper<ESubject> {
11 12
     //考试设置
@@ -18,5 +19,8 @@ public interface ESubjectMapper extends TkMapper<ESubject> {
18 19
     void updateExamSubjectState(@Param("esubject") ESubject esubject);
19 20
 
20 21
     //根据试卷id更新考试科目状态
21
-    void updateEsubjectStateByEpid(@Param("esstate") Integer esstate,@Param("epid") Integer epid);
22
+    void updateEsubjectStateByEpid(@Param("esstate") Integer esstate, @Param("epid") Integer epid);
23
+
24
+    //考试科目列表
25
+    List<Map> listSubject(@Param("examid") Integer examid);
22 26
 }

+ 5
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EClassStudent.java View File

@@ -5,6 +5,7 @@ import lombok.Data;
5 5
 
6 6
 import javax.persistence.Id;
7 7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
8 9
 
9 10
 @Table(name = "e_class_student")
10 11
 @Data
@@ -21,4 +22,8 @@ public class EClassStudent extends BaseBean {
21 22
 
22 23
     //学生id
23 24
     private Integer studentid;
25
+
26
+    @Transient
27
+    //学生姓名
28
+    private String studentname;
24 29
 }

+ 23
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java View File

@@ -166,9 +166,22 @@ public class EBaseService {
166 166
         return map;
167 167
     }
168 168
 
169
+    //获取考试和班级信息
170
+    public Map getExamAndClass(Integer examid) {
171
+        Map map = eBaseMapper.findById(examid);
172
+        List<Map> classes = eClassMapper.listByExamId(examid);
173
+        map.put("classes", classes);
174
+        return map;
175
+    }
176
+
169 177
     //考试学生
170
-    public List<Map> listStu(EBase base) {
171
-        return eClassStudentMapper.listByExamId(base);
178
+    public List<Map> listStu(EClassStudent cs) {
179
+        List<Map> students = eClassStudentMapper.listByExamId(cs);
180
+        Integer examid = cs.getExamid();
181
+        List<Map> classes = eClassMapper.listByExamId(examid);
182
+        Map<Object, Object> classMap = classes.stream().collect(Collectors.toMap(m -> m.get("classid"), m -> m.get("classname")));
183
+        students.forEach(s -> s.put("classname", classMap.get(s.get("classid"))));
184
+        return students;
172 185
     }
173 186
 
174 187
     //移除考试学生
@@ -177,4 +190,12 @@ public class EBaseService {
177 190
         eClassStudentMapper.deleteByPrimaryKey(ecsid);
178 191
         eClassMapper.updateClassNumByCsId(ecsid);
179 192
     }
193
+
194
+    //考试科目列表
195
+    public Map listSubject(Integer examid) {
196
+        Map map = eBaseMapper.findById(examid);
197
+        List<Map> subjects = eSubjectMapper.listSubject(examid);
198
+        map.put("subjects", subjects);
199
+        return map;
200
+    }
180 201
 }

+ 24
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/exam/ExamVo.java View File

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sexam.vo.exam;
2
+
3
+import com.xhkjedu.sexam.model.exam.ESubject;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @author ywx
10
+ * @classname ExamVo
11
+ * @description 考试设置
12
+ * @date 2022/7/19 11:15
13
+ **/
14
+@Data
15
+public class ExamVo {
16
+    //是否发送通知1发送2不发送
17
+    private Integer notice;
18
+
19
+    //是否发送短信1发送2不发送
20
+    private Integer msg;
21
+
22
+    //考试科目表
23
+    private List<ESubject> subjects;
24
+}

+ 5
- 0
sexam/src/main/resources/mapper/exam/EBaseMapper.xml View File

@@ -34,4 +34,9 @@
34 34
     <update id="updateExamState">
35 35
         update e_base set examstate=#{examstate} where examid=#{examid}
36 36
     </update>
37
+    <!--考试基本信息-->
38
+    <select id="findById" resultType="java.util.Map">
39
+        select examid,examname,gradeid,examdate,examtype,exammode,monitored,examstate
40
+        from e_base where examid=#{examid}
41
+    </select>
37 42
 </mapper>

+ 7
- 1
sexam/src/main/resources/mapper/exam/EClassStudentMapper.xml View File

@@ -13,6 +13,12 @@
13 13
     <select id="listByExamId" resultType="java.util.Map">
14 14
         select es.ecsid,es.classid,u.username,u.studentno,u.usersex
15 15
         from e_class_student es left join t_user u on es.studentid = u.userid
16
-        where es.examid=#{base.examid}
16
+        where es.examid=#{cs.examid}
17
+        <if test="cs.classid!=null and cs.classid!=0">
18
+            and es.classid=#{cs.classid}
19
+        </if>
20
+        <if test="cs.studentname!=null and cs.studentname!=''">
21
+            and (u.username like '%${cs.studentname}%' or u.studentno like '%${cs.studentname}%')
22
+        </if>
17 23
     </select>
18 24
 </mapper>

+ 8
- 1
sexam/src/main/resources/mapper/exam/ESubjectMapper.xml View File

@@ -4,7 +4,7 @@
4 4
     <!--考试设置-->
5 5
     <update id="setExam">
6 6
         <foreach collection="subjects" item="s" separator=";">
7
-            update e_subject set begintime=#{s.begintime},endtime=#{s.endtime},teacherid=#{s.teacherid}
7
+            update e_subject set sdate=#{s.sdate},begintime=#{s.begintime},endtime=#{s.endtime},teacherid=#{s.teacherid}
8 8
             where examid=#{s.examid} and subjectid=#{s.subjectid}
9 9
         </foreach>
10 10
     </update>
@@ -27,4 +27,11 @@
27 27
     <update id="updateEsubjectStateByEpid">
28 28
         update e_subject es,e_paper ep set es.esstate=#{esstate} where es.esid=ep.esid and ep.epid=#{epid}
29 29
     </update>
30
+    <!--考试科目列表-->
31
+    <select id="listSubject" resultType="java.util.Map">
32
+        select es.subjectid,s.subjectname,es.sdate,es.begintime,es.endtime,es.teacherid,u.username
33
+        from e_subject es left join t_subject s on es.subjectid=s.subjectid
34
+        left join t_user u on es.teacherid=u.userid
35
+        where examid=#{examid}
36
+    </select>
30 37
 </mapper>

+ 1
- 1
suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml View File

@@ -181,7 +181,7 @@
181 181
 
182 182
     <!--获取科目年级下教师-->
183 183
     <select id="listTeahcersBySubjectGrade" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
184
-     select ct.teacherid,u.username as teachername from t_class_teacher ct
184
+     select ct.teacherid,u.username as teachername,u.loginname,u.usersex from t_class_teacher ct
185 185
      left join t_class c on ct.classid=c.classid
186 186
      left join t_user u on ct.teacherid=u.userid
187 187
     LEFT JOIN t_teacher_powersb tp on tp.teacherid=ct.teacherid

Loading…
Cancel
Save