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
 import com.xhkjedu.sexam.model.exam.EClassStudent;
6
 import com.xhkjedu.sexam.model.exam.EClassStudent;
7
 import com.xhkjedu.sexam.model.exam.ESubject;
7
 import com.xhkjedu.sexam.model.exam.ESubject;
8
 import com.xhkjedu.sexam.service.exam.EBaseService;
8
 import com.xhkjedu.sexam.service.exam.EBaseService;
9
+import com.xhkjedu.sexam.vo.exam.ExamVo;
9
 import com.xhkjedu.utils.N_Utils;
10
 import com.xhkjedu.utils.N_Utils;
10
 import com.xhkjedu.utils.PageUtil;
11
 import com.xhkjedu.utils.PageUtil;
11
 import com.xhkjedu.vo.PageResult;
12
 import com.xhkjedu.vo.PageResult;
55
      * @Date 2022/7/18 10:52
56
      * @Date 2022/7/18 10:52
56
      **/
57
      **/
57
     @PostMapping("/set_exam")
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
         for (ESubject s : subjects) {
63
         for (ESubject s : subjects) {
60
             try {
64
             try {
61
                 N_Utils.validation(new Object[]{s.getExamid(), "考试id", 1, s.getSubjectid(), "科目id", 2});
65
                 N_Utils.validation(new Object[]{s.getExamid(), "考试id", 1, s.getSubjectid(), "科目id", 2});
158
         return new ResultVo(0, "获取考试班级成功", map);
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
      * @Date 2022/7/18 16:57
187
      * @Date 2022/7/18 16:57
168
      **/
188
      **/
169
     @PostMapping("/list_stu")
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
     @PostMapping("/del_stu")
201
     @PostMapping("/del_stu")
181
         eBaseService.delStu(ecsid);
205
         eBaseService.delStu(ecsid);
182
         return new ResultVo(0, "移除考试学生成功");
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
 
19
 
20
     //修改考试状态
20
     //修改考试状态
21
     void updateExamState(@Param("examid") Integer examid, @Param("examstate") int examstate);
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
 package com.xhkjedu.sexam.mapper.exam;
1
 package com.xhkjedu.sexam.mapper.exam;
2
 
2
 
3
 import com.xhkjedu.sexam.base.TkMapper;
3
 import com.xhkjedu.sexam.base.TkMapper;
4
-import com.xhkjedu.sexam.model.exam.EBase;
5
 import com.xhkjedu.sexam.model.exam.EClassStudent;
4
 import com.xhkjedu.sexam.model.exam.EClassStudent;
6
 import org.apache.ibatis.annotations.Param;
5
 import org.apache.ibatis.annotations.Param;
7
 
6
 
13
     List<EClassStudent> listByClassIds(@Param("classids") List<Integer> classids);
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
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 
7
 
8
 import java.util.List;
8
 import java.util.List;
9
+import java.util.Map;
9
 
10
 
10
 public interface ESubjectMapper extends TkMapper<ESubject> {
11
 public interface ESubjectMapper extends TkMapper<ESubject> {
11
     //考试设置
12
     //考试设置
18
     void updateExamSubjectState(@Param("esubject") ESubject esubject);
19
     void updateExamSubjectState(@Param("esubject") ESubject esubject);
19
 
20
 
20
     //根据试卷id更新考试科目状态
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
 
5
 
6
 import javax.persistence.Id;
6
 import javax.persistence.Id;
7
 import javax.persistence.Table;
7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
8
 
9
 
9
 @Table(name = "e_class_student")
10
 @Table(name = "e_class_student")
10
 @Data
11
 @Data
21
 
22
 
22
     //学生id
23
     //学生id
23
     private Integer studentid;
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
         return map;
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
         eClassStudentMapper.deleteByPrimaryKey(ecsid);
190
         eClassStudentMapper.deleteByPrimaryKey(ecsid);
178
         eClassMapper.updateClassNumByCsId(ecsid);
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

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
     <update id="updateExamState">
34
     <update id="updateExamState">
35
         update e_base set examstate=#{examstate} where examid=#{examid}
35
         update e_base set examstate=#{examstate} where examid=#{examid}
36
     </update>
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
 </mapper>
42
 </mapper>

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

13
     <select id="listByExamId" resultType="java.util.Map">
13
     <select id="listByExamId" resultType="java.util.Map">
14
         select es.ecsid,es.classid,u.username,u.studentno,u.usersex
14
         select es.ecsid,es.classid,u.username,u.studentno,u.usersex
15
         from e_class_student es left join t_user u on es.studentid = u.userid
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
     </select>
23
     </select>
18
 </mapper>
24
 </mapper>

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

4
     <!--考试设置-->
4
     <!--考试设置-->
5
     <update id="setExam">
5
     <update id="setExam">
6
         <foreach collection="subjects" item="s" separator=";">
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
             where examid=#{s.examid} and subjectid=#{s.subjectid}
8
             where examid=#{s.examid} and subjectid=#{s.subjectid}
9
         </foreach>
9
         </foreach>
10
     </update>
10
     </update>
27
     <update id="updateEsubjectStateByEpid">
27
     <update id="updateEsubjectStateByEpid">
28
         update e_subject es,e_paper ep set es.esstate=#{esstate} where es.esid=ep.esid and ep.epid=#{epid}
28
         update e_subject es,e_paper ep set es.esstate=#{esstate} where es.esid=ep.esid and ep.epid=#{epid}
29
     </update>
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
 </mapper>
37
 </mapper>

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

181
 
181
 
182
     <!--获取科目年级下教师-->
182
     <!--获取科目年级下教师-->
183
     <select id="listTeahcersBySubjectGrade" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
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
      left join t_class c on ct.classid=c.classid
185
      left join t_class c on ct.classid=c.classid
186
      left join t_user u on ct.teacherid=u.userid
186
      left join t_user u on ct.teacherid=u.userid
187
     LEFT JOIN t_teacher_powersb tp on tp.teacherid=ct.teacherid
187
     LEFT JOIN t_teacher_powersb tp on tp.teacherid=ct.teacherid

Loading…
Cancel
Save