Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

# Conflicts:
#	sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java
#	sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java
tags/正式3.13.3
王宁 1 year ago
parent
commit
b5bd20a0d8
29 changed files with 281 additions and 139 deletions
  1. 11
    2
      sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java
  2. 5
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeFileMapper.java
  3. 6
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeUserMapper.java
  4. 1
    1
      sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNoticeFile.java
  5. 9
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNoticeUser.java
  6. 41
    16
      sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java
  7. 9
    0
      sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeUserVo.java
  8. 8
    0
      sapi/src/main/resources/mapper/notice/NoticeFileMapper.xml
  9. 1
    1
      sapi/src/main/resources/mapper/notice/NoticeMapper.xml
  10. 24
    3
      sapi/src/main/resources/mapper/notice/NoticeUserMapper.xml
  11. 8
    4
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java
  12. 7
    4
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java
  13. 8
    4
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectclassController.java
  14. 8
    4
      sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectquestionController.java
  15. 0
    7
      sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeTeacherMapper.java
  16. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeUserMapper.java
  17. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNotice.java
  18. 11
    2
      sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNoticeUser.java
  19. 49
    76
      sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java
  20. 3
    0
      sexam/src/main/java/com/xhkjedu/sexam/vo/exam/ExamVo.java
  21. 1
    1
      sexam/src/main/resources/mapper/exam/EBaseMapper.xml
  22. 0
    12
      sexam/src/main/resources/mapper/notice/NoticeTeacherMapper.xml
  23. 4
    0
      sexam/src/main/resources/mapper/notice/NoticeUserMapper.xml
  24. 1
    1
      sexam/src/main/resources/mapper/paper/EPaperMapper.xml
  25. 1
    0
      sexam/src/main/resources/mapper/system/UserMapper.xml
  26. 8
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GradeController.java
  27. 9
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GradeMapper.java
  28. 12
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GradeService.java
  29. 28
    0
      suser/src/main/resources/mapper/gradeclass/GradeMapper.xml

+ 11
- 2
sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java View File

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
14 14
 
15 15
 import javax.annotation.Resource;
16 16
 import java.util.List;
17
+import java.util.Map;
17 18
 
18 19
 /**
19 20
 * @author ywx
@@ -146,6 +147,14 @@ public class NoticeController {
146 147
         return new ResultVo(0,"获取学生通知列表成功",pageResult);
147 148
     }
148 149
 
150
+    @PostMapping("/list_user")
151
+    public ResultVo listUser(@RequestBody TNotice notice) {
152
+        Integer noticeid = notice.getNoticeid();
153
+        N_Utils.validation(new Object[]{noticeid, "通知id", 1});
154
+        List<Map> list = noticeService.listUser(noticeid);
155
+        return new ResultVo(0, "获取通知对象成功", list);
156
+    }
157
+
149 158
     /*
150 159
      * @Description 处理班级通知到学生个人
151 160
      * @Date 2023/12/18 17:41:09
@@ -154,8 +163,8 @@ public class NoticeController {
154 163
      * @Return com.xhkjedu.vo.ResultVo
155 164
      **/
156 165
     @GetMapping("/chandle_nuser")
157
-    public ResultVo chandleNoticeUser(){
166
+    public ResultVo chandleNoticeUser() {
158 167
         noticeService.chandleNoticeUser();
159
-        return new ResultVo(0,"处理成功");
168
+        return new ResultVo(0, "处理成功");
160 169
     }
161 170
 }

+ 5
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeFileMapper.java View File

@@ -2,6 +2,9 @@ package com.xhkjedu.sapi.mapper.notice;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.sapi.model.notice.TNoticeFile;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
5 8
 
6 9
 /**
7 10
  * @Description
@@ -9,4 +12,6 @@ import com.xhkjedu.sapi.model.notice.TNoticeFile;
9 12
  * Date 2023/12/18 14:08
10 13
  **/
11 14
 public interface NoticeFileMapper extends TkMapper<TNoticeFile> {
15
+    //通知附件列表
16
+    List<TNoticeFile> listByNoticeId(@Param("noticeid") Integer noticeid);
12 17
 }

+ 6
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeUserMapper.java View File

@@ -5,6 +5,9 @@ import com.xhkjedu.sapi.model.notice.TNotice;
5 5
 import com.xhkjedu.sapi.model.notice.TNoticeUser;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8
+import java.util.List;
9
+import java.util.Map;
10
+
8 11
 public interface NoticeUserMapper extends TkMapper<TNoticeUser> {
9 12
     /**
10 13
      * 批量添加
@@ -24,4 +27,7 @@ public interface NoticeUserMapper extends TkMapper<TNoticeUser> {
24 27
      **/
25 28
     Integer reade(@Param("noticeid") Integer noticeid, @Param("userid") Integer userid
26 29
             , @Param("timestamp") int timestamp);
30
+
31
+    //通知对象
32
+    List<Map> listByNoticeId(@Param("noticeid") Integer noticeid);
27 33
 }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNoticeFile.java View File

@@ -14,7 +14,7 @@ public class TNoticeFile extends BaseBean {
14 14
     private Integer nfid;
15 15
 
16 16
     //通知id
17
-    private String noticeid;
17
+    private Integer noticeid;
18 18
 
19 19
     //资源名称
20 20
     private String resourcename;

+ 9
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNoticeUser.java View File

@@ -25,6 +25,15 @@ public class TNoticeUser extends BaseBean {
25 25
     //查看时间
26 26
     private Integer readtime;
27 27
 
28
+    //年级id
29
+    private Integer gradeid;
30
+
31
+    //班级id
32
+    private Integer classid;
33
+
34
+    //科目id
35
+    private String subjectid;
36
+
28 37
     //创建时间
29 38
     private Integer createtime;
30 39
 

+ 41
- 16
sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java View File

@@ -2,21 +2,18 @@ package com.xhkjedu.sapi.service.notice;
2 2
 
3 3
 import com.xhkjedu.sapi.mapper.notice.NoticeClassMapper;
4 4
 import com.xhkjedu.sapi.mapper.notice.NoticeMapper;
5
-import com.xhkjedu.sapi.mapper.notice.NoticeSchoolMapper;
6 5
 import com.xhkjedu.sapi.mapper.notice.NoticeUserMapper;
7 6
 import com.xhkjedu.sapi.model.notice.TNoticeClass;
8 7
 import com.xhkjedu.sapi.model.notice.TNoticeUser;
9
-import com.xhkjedu.sapi.model.system.TSchool;
8
+import com.xhkjedu.sapi.mapper.notice.*;
9
+import com.xhkjedu.sapi.model.notice.TNoticeFile;
10 10
 import com.xhkjedu.sapi.model.notice.TNotice;
11 11
 import com.xhkjedu.utils.N_Utils;
12
-import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
13
-import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
14 12
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
15 13
 import org.springframework.stereotype.Service;
16 14
 
17 15
 import javax.annotation.Resource;
18
-import java.util.ArrayList;
19
-import java.util.List;
16
+import java.util.*;
20 17
 
21 18
 /**
22 19
  * @author ywx
@@ -33,7 +30,7 @@ public class NoticeService {
33 30
     @Resource
34 31
     private NoticeUserMapper noticeUserMapper;
35 32
     @Resource
36
-    private NoticeSchoolMapper noticeSchoolMapper;
33
+    private NoticeFileMapper noticeFileMapper;
37 34
 
38 35
     //添加
39 36
     public Integer save(TNotice model) {
@@ -45,6 +42,15 @@ public class NoticeService {
45 42
         //添加通知对象
46 43
         saveNoticeObj(model);
47 44
 
45
+        //通知附件
46
+        List<TNoticeFile> files = model.getFiles();
47
+        if (N_Utils.isListNotEmpty(files)) {
48
+            Integer noticeid = model.getNoticeid();
49
+            for (TNoticeFile file : files) {
50
+                file.setNoticeid(noticeid);
51
+            }
52
+            noticeFileMapper.insertList(files);
53
+        }
48 54
         return model.getId();
49 55
     }
50 56
 
@@ -68,20 +74,21 @@ public class NoticeService {
68 74
             noticeUserMapper.batchSave(model);
69 75
         }
70 76
 
71
-        if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
77
+        /*if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
72 78
             List<TSchool> schools = new ArrayList<>();
73 79
             TSchool s = new TSchool();
74 80
             s.setSchoolid(model.getSchoolid());
75 81
             schools.add(s);
76 82
             model.setSchools(schools);
77 83
         }
78
-        noticeSchoolMapper.batchSave(model);//通知学校关联信息
84
+        noticeSchoolMapper.batchSave(model);//通知学校关联信息*/
79 85
     }
80 86
 
81 87
     //获取详情
82 88
     public TNotice findById(Integer noticeid) {
83 89
         TNotice notice = noticeMapper.findById(noticeid);
84
-        Integer noticetype = notice.getNoticetype();
90
+        notice.setFiles(noticeFileMapper.listByNoticeId(noticeid));
91
+        /*Integer noticetype = notice.getNoticetype();
85 92
         if (noticetype == 1) {
86 93
             List<ClassVo> classes = noticeMapper.listClass(noticeid);
87 94
             notice.setClasses(classes);
@@ -91,7 +98,7 @@ public class NoticeService {
91 98
         } else {
92 99
             List<TSchool> schools = noticeMapper.listSchool(noticeid);
93 100
             notice.setSchools(schools);
94
-        }
101
+        }*/
95 102
         return notice;
96 103
     }
97 104
 
@@ -131,6 +138,7 @@ public class NoticeService {
131 138
      **/
132 139
     public TNotice reade(Integer noticeid, Integer createid) {
133 140
         TNotice notice = noticeMapper.findById2(noticeid);
141
+        notice.setFiles(noticeFileMapper.listByNoticeId(noticeid));
134 142
         noticeUserMapper.reade(noticeid, createid, N_Utils.getSecondTimestamp());
135 143
         return notice;
136 144
     }
@@ -162,13 +170,31 @@ public class NoticeService {
162 170
         return noticeMapper.listNoticeForStuWeb(notice);
163 171
     }
164 172
 
165
-    public void chandleNoticeUser(){
173
+    /**
174
+     * @Description 通知对象
175
+     * @Date 2023/12/18 16:26
176
+     * @Author YWX
177
+     * @Param [noticeid]
178
+     * @Return java.util.List<java.util.Map>
179
+     **/
180
+    public List<Map> listUser(Integer noticeid) {
181
+        return noticeUserMapper.listByNoticeId(noticeid);
182
+    }
183
+
184
+    /*
185
+     * @Description 处理班级学生通知
186
+     * @Date 2023/12/18 16:10:36
187
+     * @Author WN
188
+     * @Param []
189
+     * @Return void
190
+     **/
191
+    public void chandleNoticeUser() {
166 192
         //获取需要处理的通知
167 193
         List<TNoticeClass> noticeClasses = noticeClassMapper.listAll();
168
-        for(TNoticeClass noticeClass : noticeClasses){
194
+        for (TNoticeClass noticeClass : noticeClasses) {
169 195
             List<TNoticeUser> noticeUsers = noticeClassMapper.listClassStudent(noticeClass.getClassid());
170
-            if(N_Utils.isListNotEmpty(noticeUsers)){
171
-                for(TNoticeUser user : noticeUsers){
196
+            if (N_Utils.isListNotEmpty(noticeUsers)) {
197
+                for (TNoticeUser user : noticeUsers) {
172 198
                     user.setNoticeid(noticeClass.getNoticeid());
173 199
                     user.setReaded(1);
174 200
                     user.setCreatetime(noticeClass.getCreatetime());
@@ -176,6 +202,5 @@ public class NoticeService {
176 202
                 noticeUserMapper.insertList(noticeUsers);
177 203
             }
178 204
         }
179
-
180 205
     }
181 206
 }

+ 9
- 0
sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeUserVo.java View File

@@ -12,4 +12,13 @@ public class NoticeUserVo {
12 12
 
13 13
     //是否查看0未查看1已查看
14 14
     private Integer readed;
15
+
16
+    //年级id
17
+    private Integer gradeid;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //科目id
23
+    private String subjectid;
15 24
 }

+ 8
- 0
sapi/src/main/resources/mapper/notice/NoticeFileMapper.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sapi.mapper.notice.NoticeFileMapper">
4
+    <!--通知附件列表-->
5
+    <select id="listByNoticeId" resultType="com.xhkjedu.sapi.model.notice.TNoticeFile">
6
+        select * from t_notice_file where noticeid=#{noticeid}
7
+    </select>
8
+</mapper>

+ 1
- 1
sapi/src/main/resources/mapper/notice/NoticeMapper.xml View File

@@ -41,7 +41,7 @@
41 41
     </select>
42 42
     <!--通知用户列表-->
43 43
     <select id="listUser" resultType="com.xhkjedu.sapi.vo.notice.NoticeUserVo">
44
-        select t.userid,tu.username teachername,t.readed
44
+        select t.userid,tu.username,t.readed
45 45
         from t_notice_user t left join t_user tu on t.userid = tu.userid
46 46
         where t.noticeid=#{noticeid}
47 47
     </select>

+ 24
- 3
sapi/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

@@ -3,10 +3,11 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.notice.NoticeUserMapper">
4 4
     <!--批量添加-->
5 5
     <insert id="batchSave" parameterType="com.xhkjedu.sapi.model.notice.TNotice">
6
-        INSERT INTO t_notice_user (noticeid,userid,createtime,schoolid)
6
+        INSERT INTO t_notice_user (noticeid,userid,createtime,schoolid,gradeid,classid,subjectid)
7 7
         VALUES
8
-        <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
9
-            (#{notice.noticeid},#{t.userid},#{notice.createtime},#{notice.schoolid})
8
+        <foreach collection ="notice.users" item="t" index= "index" separator =",">
9
+            (#{notice.noticeid},#{t.userid},#{notice.createtime},#{notice.schoolid}
10
+            ,#{t.gradeid},#{t.classid},#{t.subjectid})
10 11
         </foreach>
11 12
     </insert>
12 13
     <!--查看-->
@@ -14,4 +15,24 @@
14 15
         update t_notice_user nt set nt.readed=1,nt.readtime=#{timestamp}
15 16
         where nt.noticeid=#{noticeid} and nt.userid=#{userid}
16 17
     </update>
18
+    <!--通知对象-->
19
+    <resultMap id="userResult" type="java.util.Map">
20
+        <result property="gradeid" column="gradeid"/>
21
+        <result property="classid" column="classid"/>
22
+        <result property="subjectid" column="subjectid"/>
23
+        <result property="name" column="name"/>
24
+        <collection property="users" ofType="java.util.Map" javaType="java.util.List">
25
+            <result property="userid" column="userid"/>
26
+            <result property="readed" column="readed"/>
27
+            <result property="username" column="username"/>
28
+        </collection>
29
+    </resultMap>
30
+    <select id="listByNoticeId" resultMap="userResult">
31
+        select nu.userid,nu.readed,u.username,nu.gradeid,nu.classid,nu.subjectid
32
+        ,if(nu.classid is not null,(select c.classname from t_class c where c.classid=nu.classid)
33
+            ,(select s.subjectname from t_subject s where s.subjectid=nu.subjectid))name
34
+        from t_notice_user nu left join t_user u on nu.userid = u.userid
35
+        where nu.noticeid=#{noticeid}
36
+        order by convert(u.username using gbk)
37
+    </select>
17 38
 </mapper>

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

@@ -9,7 +9,7 @@ import com.xhkjedu.sexam.model.exam.EClassStudent;
9 9
 import com.xhkjedu.sexam.model.exam.ESubject;
10 10
 import com.xhkjedu.sexam.model.notice.TMsg;
11 11
 import com.xhkjedu.sexam.model.notice.TNotice;
12
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
12
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
13 13
 import com.xhkjedu.sexam.service.exam.EBaseService;
14 14
 import com.xhkjedu.sexam.service.notice.NoticeService;
15 15
 import com.xhkjedu.sexam.service.report.EReportGenerateService;
@@ -102,6 +102,7 @@ public class EBaseController {
102 102
         List<TMsg> msgList = new ArrayList<>();
103 103
         String examname = eBaseService.getNameByExamId(examid);
104 104
         String noticetitle = examname + "-考试设置";
105
+        Integer gradeid = vo.getGradeid();
105 106
         for (ESubject s : subjects) {
106 107
             try {
107 108
                 N_Utils.validation(new Object[]{s.getSubjectid(), "科目id", 2});
@@ -116,9 +117,11 @@ public class EBaseController {
116 117
                     TNotice n = new TNotice();
117 118
                     n.setNoticetitle(noticetitle);
118 119
                     n.setNoticecontent(noticecontent);
119
-                    TNoticeTeacher nt = new TNoticeTeacher();
120
-                    nt.setTeacherid(teacherid);
121
-                    n.setTeachers(Arrays.asList(nt));
120
+                    TNoticeUser nt = new TNoticeUser();
121
+                    nt.setUserid(teacherid);
122
+                    nt.setGradeid(gradeid);
123
+                    nt.setSubjectid(s.getSubjectid());
124
+                    n.setUsers(Arrays.asList(nt));
122 125
                     noticeList.add(n);
123 126
                 }
124 127
                 if (msg == 1) {
@@ -224,6 +227,7 @@ public class EBaseController {
224 227
         vo.setSchoolid(schoolid);
225 228
         vo.setHandleid(createid);
226 229
         vo.setExamname(examname);
230
+        vo.setGradeid(exam.getGradeid());
227 231
         noticeService.batchSave2(vo, students);
228 232
         return new ResultVo(0, "发布成功");
229 233
     }

+ 7
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectInvigilateController.java View File

@@ -7,7 +7,7 @@ import com.xhkjedu.sexam.model.exam.ESubject;
7 7
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8 8
 import com.xhkjedu.sexam.model.notice.TMsg;
9 9
 import com.xhkjedu.sexam.model.notice.TNotice;
10
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
10
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
11 11
 import com.xhkjedu.sexam.service.exam.ESubjectInvigilateService;
12 12
 import com.xhkjedu.sexam.service.notice.NoticeService;
13 13
 import com.xhkjedu.sexam.vo.exam.EInVigilateVo;
@@ -70,6 +70,7 @@ public class ESubjectInvigilateController {
70 70
         Map s = eSubjectInvigilateService.getESubjectByEsId(esid);
71 71
         Integer schoolid = (Integer) s.get("schoolid");
72 72
         String noticetitle = s.get("examname") + "-监考设置";
73
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
73 74
         for (ESubjectInvigilate ei : teachers) {
74 75
             Integer teacherid = ei.getTeacherid();
75 76
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -81,9 +82,11 @@ public class ESubjectInvigilateController {
81 82
                 TNotice n = new TNotice();
82 83
                 n.setNoticetitle(noticetitle);
83 84
                 n.setNoticecontent(noticecontent);
84
-                TNoticeTeacher nt = new TNoticeTeacher();
85
-                nt.setTeacherid(teacherid);
86
-                n.setTeachers(Arrays.asList(nt));
85
+                TNoticeUser nt = new TNoticeUser();
86
+                nt.setUserid(teacherid);
87
+                nt.setGradeid(gradeid);
88
+                nt.setSubjectid(subjectid);
89
+                n.setUsers(Arrays.asList(nt));
87 90
                 noticeList.add(n);
88 91
             }
89 92
             if (msg == 1) {

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectclassController.java View File

@@ -3,7 +3,7 @@ package com.xhkjedu.sexam.controller.paper;
3 3
 import com.xhkjedu.annotation.Action;
4 4
 import com.xhkjedu.sexam.model.notice.TMsg;
5 5
 import com.xhkjedu.sexam.model.notice.TNotice;
6
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
6
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
7 7
 import com.xhkjedu.sexam.model.paper.EPaperCorrectclass;
8 8
 import com.xhkjedu.sexam.service.notice.NoticeService;
9 9
 import com.xhkjedu.sexam.service.paper.EPaperCorrectclassService;
@@ -62,6 +62,8 @@ public class EPaperCorrectclassController {
62 62
         Map s = ePaperCorrectclassService.getESubjectByEpId(epid);
63 63
         Integer schoolid = (Integer) s.get("schoolid");
64 64
         String noticetitle = s.get("examname") + "-阅卷按班设置";
65
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
66
+        String subjectid = s.get("subjectid").toString();
65 67
         for (EPaperCorrectclass c : teachers) {
66 68
             Integer teacherid = c.getTeacherid();
67 69
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -73,9 +75,11 @@ public class EPaperCorrectclassController {
73 75
                 TNotice n = new TNotice();
74 76
                 n.setNoticetitle(noticetitle);
75 77
                 n.setNoticecontent(noticecontent);
76
-                TNoticeTeacher nt = new TNoticeTeacher();
77
-                nt.setTeacherid(teacherid);
78
-                n.setTeachers(Arrays.asList(nt));
78
+                TNoticeUser nt = new TNoticeUser();
79
+                nt.setUserid(teacherid);
80
+                nt.setGradeid(gradeid);
81
+                nt.setSubjectid(subjectid);
82
+                n.setUsers(Arrays.asList(nt));
79 83
                 noticeList.add(n);
80 84
             }
81 85
             if (msg == 1) {

+ 8
- 4
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperCorrectquestionController.java View File

@@ -3,7 +3,7 @@ package com.xhkjedu.sexam.controller.paper;
3 3
 import com.xhkjedu.annotation.Action;
4 4
 import com.xhkjedu.sexam.model.notice.TMsg;
5 5
 import com.xhkjedu.sexam.model.notice.TNotice;
6
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
6
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
7 7
 import com.xhkjedu.sexam.model.paper.EPaper;
8 8
 import com.xhkjedu.sexam.model.paper.EPaperCorrectquestion;
9 9
 import com.xhkjedu.sexam.service.notice.NoticeService;
@@ -57,6 +57,8 @@ public class EPaperCorrectquestionController {
57 57
         Map s = ePaperCorrectquestionService.getESubjectByEpId(epid);
58 58
         Integer schoolid = (Integer) s.get("schoolid");
59 59
         String noticetitle = s.get("examname") + "-阅卷按题设置";
60
+        Integer gradeid = N_Utils.str2Int(s.get("gradeid").toString());
61
+        String subjectid = s.get("subjectid").toString();
60 62
         for (EPaperCorrectquestion q : teachers) {
61 63
             Integer teacherid = q.getTeacherid();
62 64
             if (N_Utils.isEmptyInteger(teacherid)) continue;
@@ -68,9 +70,11 @@ public class EPaperCorrectquestionController {
68 70
                 TNotice n = new TNotice();
69 71
                 n.setNoticetitle(noticetitle);
70 72
                 n.setNoticecontent(noticecontent);
71
-                TNoticeTeacher nt = new TNoticeTeacher();
72
-                nt.setTeacherid(teacherid);
73
-                n.setTeachers(Arrays.asList(nt));
73
+                TNoticeUser nt = new TNoticeUser();
74
+                nt.setUserid(teacherid);
75
+                nt.setGradeid(gradeid);
76
+                nt.setSubjectid(subjectid);
77
+                n.setUsers(Arrays.asList(nt));
74 78
                 noticeList.add(n);
75 79
             }
76 80
             if (msg == 1) {

+ 0
- 7
sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeTeacherMapper.java View File

@@ -1,7 +0,0 @@
1
-package com.xhkjedu.sexam.mapper.notice;
2
-
3
-import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.sexam.model.notice.TNoticeTeacher;
5
-
6
-public interface NoticeTeacherMapper extends TkMapper<TNoticeTeacher> {
7
-}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/notice/NoticeUserMapper.java View File

@@ -0,0 +1,7 @@
1
+package com.xhkjedu.sexam.mapper.notice;
2
+
3
+import com.xhkjedu.base.TkMapper;
4
+import com.xhkjedu.sexam.model.notice.TNoticeUser;
5
+
6
+public interface NoticeUserMapper extends TkMapper<TNoticeUser> {
7
+}

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNotice.java View File

@@ -44,7 +44,7 @@ public class TNotice extends BaseBean {
44 44
 
45 45
     @Transient
46 46
     //教师id集合
47
-    private List<TNoticeTeacher> teachers = new ArrayList<>();
47
+    private List<TNoticeUser> users = new ArrayList<>();
48 48
 
49 49
     @Transient
50 50
     //开始时间

sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNoticeTeacher.java → sexam/src/main/java/com/xhkjedu/sexam/model/notice/TNoticeUser.java View File

@@ -8,7 +8,7 @@ import javax.persistence.Table;
8 8
 
9 9
 @Table(name = "t_notice_user")
10 10
 @Data
11
-public class TNoticeTeacher extends BaseBean {
11
+public class TNoticeUser extends BaseBean {
12 12
     @Id
13 13
     //通知用户表
14 14
     private Integer nuid;
@@ -17,7 +17,7 @@ public class TNoticeTeacher extends BaseBean {
17 17
     private Integer noticeid;
18 18
 
19 19
     //用户id
20
-    private Integer teacherid;
20
+    private Integer userid;
21 21
 
22 22
     //是否查看0未查看1已查看
23 23
     private Integer readed;
@@ -25,6 +25,15 @@ public class TNoticeTeacher extends BaseBean {
25 25
     //查看时间
26 26
     private Integer readtime;
27 27
 
28
+    //年级id
29
+    private Integer gradeid;
30
+
31
+    //班级id
32
+    private Integer classid;
33
+
34
+    //科目id
35
+    private String subjectid;
36
+
28 37
     //创建时间
29 38
     private Integer createtime;
30 39
 

+ 49
- 76
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java View File

@@ -33,11 +33,7 @@ public class NoticeService {
33 33
     @Resource
34 34
     private NoticeMapper noticeMapper;
35 35
     @Resource
36
-    private NoticeTeacherMapper noticeTeacherMapper;
37
-    @Resource
38
-    private NoticeClassMapper noticeClassMapper;
39
-    @Resource
40
-    private NoticeSchoolMapper noticeSchoolMapper;
36
+    private NoticeUserMapper noticeUserMapper;
41 37
     @Resource
42 38
     private MsgMapper msgMapper;
43 39
     @Resource
@@ -61,12 +57,10 @@ public class NoticeService {
61 57
                 });
62 58
                 noticeMapper.insertList(noticeList);
63 59
 
64
-                List<TNoticeTeacher> teacherList = new ArrayList<>();
65
-                List<TNoticeClass> classList = new ArrayList<>();
66
-                List<TNoticeSchool> schoolList = new ArrayList<>();
60
+                List<TNoticeUser> teacherList = new ArrayList<>();
67 61
                 noticeList.forEach(n -> {
68 62
                     Integer noticeid = n.getId();
69
-                    List<TNoticeTeacher> teachers = n.getTeachers().stream().distinct().collect(Collectors.toList());
63
+                    List<TNoticeUser> teachers = n.getUsers().stream().distinct().collect(Collectors.toList());
70 64
                     teachers.forEach(t -> {
71 65
                         t.setNoticeid(noticeid);
72 66
                         t.setReaded(0);
@@ -74,26 +68,9 @@ public class NoticeService {
74 68
                         t.setSchoolid(schoolid);
75 69
                     });
76 70
                     teacherList.addAll(teachers);
77
-
78
-                    List<TNoticeClass> classes = n.getClasses();
79
-                    classes.forEach(c -> {
80
-                        c.setNoticeid(noticeid);
81
-                        c.setCreateid(createid);
82
-                        c.setCreatetime(createtime);
83
-                    });
84
-                    classList.addAll(classes);
85
-
86
-                    TNoticeSchool ns = new TNoticeSchool();
87
-                    ns.setNoticeid(noticeid);
88
-                    ns.setSchoolid(schoolid);
89
-                    ns.setCreateid(createid);
90
-                    ns.setCreatetime(createtime);
91
-                    schoolList.add(ns);
92 71
                 });
93 72
 
94
-                if (N_Utils.isListNotEmpty(teacherList)) noticeTeacherMapper.insertList(teacherList);//通知教师关联信息
95
-                if (N_Utils.isListNotEmpty(classList)) noticeClassMapper.insertList(classList);//通知班级关联信息
96
-                if (N_Utils.isListNotEmpty(schoolList)) noticeSchoolMapper.insertList(schoolList);//通知学校关联信息
73
+                if (N_Utils.isListNotEmpty(teacherList)) noticeUserMapper.insertList(teacherList);//通知教师关联信息
97 74
             }
98 75
 
99 76
             if (N_Utils.isListNotEmpty(msgList)) {//短信
@@ -105,11 +82,10 @@ public class NoticeService {
105 82
                         msgs.add(msg);
106 83
                     }
107 84
                 } else {//通知对象2老师
108
-                    List<Integer> userids = msgList.stream().map(m -> m.getUserid()).distinct().collect(Collectors.toList());
85
+                    List<Integer> userids = msgList.stream().map(TMsg::getUserid).distinct().collect(Collectors.toList());
109 86
                     List<UserVo> users = userMapper.listPhoneByUserIds(userids);//根据用户ids查找手机号
110
-                    Map<Integer, TMsg> msgMap = msgList.stream().collect(Collectors.toMap(m -> m.getUserid(), m -> m));
111
-                    for (int i = 0; i < users.size(); i++) {
112
-                        UserVo u = users.get(i);
87
+                    Map<Integer, TMsg> msgMap = msgList.stream().collect(Collectors.toMap(TMsg::getUserid, m -> m));
88
+                    for (UserVo u : users) {
113 89
                         String userphone = u.getUserphone();
114 90
                         if (N_Utils.isEmpty(userphone)) continue;
115 91
                         TMsg m = msgMap.get(u.getUserid());
@@ -122,8 +98,8 @@ public class NoticeService {
122 98
                     msgMapper.insertList(msgs);//短信保存到数据库
123 99
 
124 100
                     //发短信
125
-                    Integer pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
126
-                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(s -> s.getMsgtxt()
101
+                    int pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
102
+                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(TMsg::getMsgtxt
127 103
                             , LinkedHashMap::new, Collectors.toList()));
128 104
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
129 105
                         List<TMsg> list = entry.getValue();
@@ -131,7 +107,7 @@ public class NoticeService {
131 107
                         for (int i = 0; i < list.size(); i += pageSize) {
132 108
                             ZtMsgVo vo = new ZtMsgVo();
133 109
                             String userphone = list.stream().skip(i).limit(pageSize)
134
-                                    .map(s -> s.getUserphone()).collect(Collectors.joining(","));
110
+                                                   .map(TMsg::getUserphone).collect(Collectors.joining(","));
135 111
                             vo.setMobile(userphone);
136 112
                             vo.setContent(msgtxt);
137 113
                             SMSSender.sendSms(vo);
@@ -140,7 +116,7 @@ public class NoticeService {
140 116
                 }
141 117
             }
142 118
         } catch (Exception e) {
143
-            log.error("批量添加通知和短信失败", e.getMessage());
119
+            log.error("批量添加通知和短信失败:{}", e.getMessage());
144 120
         }
145 121
     }
146 122
 
@@ -154,52 +130,68 @@ public class NoticeService {
154 130
         Integer examid = examVo.getExamid();
155 131
         String examname = examVo.getExamname();
156 132
         Integer schoolid = examVo.getSchoolid();
133
+        Integer gradeid = examVo.getGradeid();
157 134
         try {
158 135
             List<TNotice> noticeList = new ArrayList<>();
159
-            List<TNoticeClass> classList = new ArrayList<>();
160
-            List<TNoticeTeacher> teacherList = new ArrayList<>();
136
+            List<TNoticeUser> stuList = new ArrayList<>();
137
+            List<TNoticeUser> teacherList = new ArrayList<>();
161 138
             List<TMsg> msgList = new ArrayList<>();
162 139
             String noticetitle = examname + "-考试公告";
163 140
             List<Map> classes = eClassMapper.listByExamId(examid);
164 141
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
165 142
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
166 143
             if (notice == 1) {
167
-                for (Map s : classes) {
168
-                    TNoticeClass nt = new TNoticeClass();
169
-                    nt.setClassid((Integer) s.get("classid"));
170
-                    classList.add(nt);
144
+                for (UserVo student : students) {
145
+                    TNoticeUser nu = new TNoticeUser();
146
+                    nu.setUserid(student.getUserid());
147
+                    nu.setGradeid(gradeid);
148
+                    nu.setClassid(student.getClassid());
149
+                    stuList.add(nu);
171 150
                 }
172 151
                 TNotice n = new TNotice();
173 152
                 n.setNoticetitle(noticetitle);
174 153
                 n.setNoticecontent(examcomm);
175
-                n.setNoticetype(1);
176
-                n.setClasses(classList);
154
+                n.setNoticetype(3);
155
+                n.setUsers(stuList);
177 156
                 noticeList.add(n);
178 157
 
179 158
                 for (UserVo t : teachers) {
180
-                    TNoticeTeacher nt = new TNoticeTeacher();
181
-                    nt.setTeacherid(t.getUserid());
159
+                    TNoticeUser nt = new TNoticeUser();
160
+                    nt.setUserid(t.getUserid());
161
+                    nt.setGradeid(gradeid);
162
+                    nt.setSubjectid(t.getSubjectid());
182 163
                     teacherList.add(nt);
183 164
                 }
184 165
                 TNotice n2 = new TNotice();
185 166
                 n2.setNoticetitle(noticetitle);
186 167
                 n2.setNoticecontent(examcomm);
187 168
                 n2.setNoticetype(2);
188
-                n2.setTeachers(teacherList);
169
+                n2.setUsers(teacherList);
189 170
                 noticeList.add(n2);
190 171
             }
191 172
             if (msg == 1) {
192 173
                 String msgtxt = noticetitle + "\n" + ExamUtil.htmlRemoveTag(examcomm);
193
-                List<String> userphones = students.stream().filter(s -> N_Utils.isNotEmpty(s.getUserphone()))
194
-                        .map(s -> s.getUserphone()).collect(Collectors.toList());
174
+                List<String> userphones = new ArrayList<>();
175
+                for (UserVo student : students) {
176
+                    if (N_Utils.isNotEmpty(student.getUserphone())) {
177
+                        String sUserphone = student.getUserphone();
178
+                        userphones.add(sUserphone);
179
+                    }
180
+                }
195 181
                 for (String userphone : userphones) {
196 182
                     TMsg m = new TMsg();
197 183
                     m.setMsgtxt(msgtxt);
198 184
                     m.setUserphone(userphone);
199 185
                     msgList.add(m);
200 186
                 }
201
-                userphones = teachers.stream().filter(s -> N_Utils.isNotEmpty(s.getUserphone()))
202
-                        .map(s -> s.getUserphone()).collect(Collectors.toList());
187
+                List<String> list = new ArrayList<>();
188
+                for (UserVo s : teachers) {
189
+                    String sUserphone = s.getUserphone();
190
+                    if (N_Utils.isNotEmpty(sUserphone)) {
191
+                        list.add(sUserphone);
192
+                    }
193
+                }
194
+                userphones = list;
203 195
                 for (String userphone : userphones) {
204 196
                     TMsg m = new TMsg();
205 197
                     m.setMsgtxt(msgtxt);
@@ -217,12 +209,10 @@ public class NoticeService {
217 209
                 });
218 210
                 noticeMapper.insertList(noticeList);
219 211
 
220
-                List<TNoticeTeacher> nteacherList = new ArrayList<>();
221
-                List<TNoticeClass> nclassList = new ArrayList<>();
222
-                List<TNoticeSchool> schoolList = new ArrayList<>();
212
+                List<TNoticeUser> nteacherList = new ArrayList<>();
223 213
                 noticeList.forEach(n -> {
224 214
                     Integer noticeid = n.getId();
225
-                    List<TNoticeTeacher> cteachers = n.getTeachers().stream().distinct().collect(Collectors.toList());
215
+                    List<TNoticeUser> cteachers = n.getUsers().stream().distinct().collect(Collectors.toList());
226 216
                     cteachers.forEach(t -> {
227 217
                         t.setNoticeid(noticeid);
228 218
                         t.setReaded(0);
@@ -230,26 +220,9 @@ public class NoticeService {
230 220
                         t.setSchoolid(schoolid);
231 221
                     });
232 222
                     nteacherList.addAll(cteachers);
233
-
234
-                    List<TNoticeClass> nclasses = n.getClasses();
235
-                    nclasses.forEach(c -> {
236
-                        c.setNoticeid(noticeid);
237
-                        c.setCreateid(createid);
238
-                        c.setCreatetime(createtime);
239
-                    });
240
-                    nclassList.addAll(nclasses);
241
-
242
-                    TNoticeSchool ns = new TNoticeSchool();
243
-                    ns.setNoticeid(noticeid);
244
-                    ns.setSchoolid(schoolid);
245
-                    ns.setCreateid(createid);
246
-                    ns.setCreatetime(createtime);
247
-                    schoolList.add(ns);
248 223
                 });
249 224
 
250
-                if (N_Utils.isListNotEmpty(nteacherList)) noticeTeacherMapper.insertList(teacherList);//通知教师关联信息
251
-                if (N_Utils.isListNotEmpty(nclassList)) noticeClassMapper.insertList(classList);//通知班级关联信息
252
-                if (N_Utils.isListNotEmpty(schoolList)) noticeSchoolMapper.insertList(schoolList);//通知学校关联信息
225
+                if (N_Utils.isListNotEmpty(nteacherList)) noticeUserMapper.insertList(teacherList);//通知教师关联信息
253 226
             }
254 227
 
255 228
             if (N_Utils.isListNotEmpty(msgList)) {//短信
@@ -262,8 +235,8 @@ public class NoticeService {
262 235
                     msgMapper.insertList(msgs);//短信保存到数据库
263 236
 
264 237
                     //发短信
265
-                    Integer pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
266
-                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(s -> s.getMsgtxt()
238
+                    int pageSize = 2000;//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888(最多2000个,必填)
239
+                    Map<String, List<TMsg>> mcollect = msgs.stream().collect(Collectors.groupingBy(TMsg::getMsgtxt
267 240
                             , LinkedHashMap::new, Collectors.toList()));
268 241
                     for (Map.Entry<String, List<TMsg>> entry : mcollect.entrySet()) {
269 242
                         List<TMsg> list = entry.getValue();
@@ -271,7 +244,7 @@ public class NoticeService {
271 244
                         for (int i = 0; i < list.size(); i += pageSize) {
272 245
                             ZtMsgVo vo = new ZtMsgVo();
273 246
                             String userphone = list.stream().skip(i).limit(pageSize)
274
-                                    .map(s -> s.getUserphone()).collect(Collectors.joining(","));
247
+                                                   .map(TMsg::getUserphone).collect(Collectors.joining(","));
275 248
                             vo.setMobile(userphone);
276 249
                             vo.setContent(msgtxt);
277 250
                             SMSSender.sendSms(vo);
@@ -280,7 +253,7 @@ public class NoticeService {
280 253
                 }
281 254
             }
282 255
         } catch (Exception e) {
283
-            log.error("批量添加通知和短信(发布考试用)失败", e.getMessage());
256
+            log.error("批量添加通知和短信(发布考试用)失败:{}", e.getMessage());
284 257
         }
285 258
     }
286 259
 }

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

@@ -21,6 +21,9 @@ public class ExamVo {
21 21
 
22 22
     //学校id
23 23
     private Integer schoolid;
24
+    
25
+    //年级id
26
+    private Integer gradeid;
24 27
 
25 28
     //考试名称
26 29
     private String examname;

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

@@ -120,7 +120,7 @@
120 120
     </select>
121 121
     <!--根据考试id获取状态和模式-->
122 122
     <select id="getExamStateAndMode" resultType="com.xhkjedu.sexam.vo.exam.EBaseVo">
123
-        select eb.examstate,eb.exammode
123
+        select eb.examstate,eb.exammode,eb.gradeid
124 124
         from e_base eb where eb.examid=#{examid}
125 125
     </select>
126 126
     <!--根据考试id获取显示排名-->

+ 0
- 12
sexam/src/main/resources/mapper/notice/NoticeTeacherMapper.xml View File

@@ -1,12 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" ?>
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.notice.NoticeTeacherMapper">
4
-    <!--批量添加-->
5
-    <insert id="batchSave" parameterType="com.xhkjedu.sexam.model.notice.TNotice">
6
-        INSERT INTO t_notice_user (noticeid,teacherid,createtime,schoolid)
7
-        VALUES
8
-        <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
9
-            (#{notice.noticeid},#{t.teacherid},#{notice.createtime},#{notice.schoolid})
10
-        </foreach>
11
-    </insert>
12
-</mapper>

+ 4
- 0
sexam/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
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.notice.NoticeUserMapper">
4
+</mapper>

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

@@ -73,7 +73,7 @@
73 73
     </select>
74 74
     <!--根据试卷id获取考试科目基本信息-->
75 75
     <select id="getESubjectByEpId" resultType="java.util.Map">
76
-        select es.sdate,es.begintime,es.endtime,eb.examname,eb.schoolid
76
+        select es.sdate,es.begintime,es.endtime,eb.examname,eb.schoolid,eb.gradeid,es.subjectid
77 77
         from e_paper ep left join e_subject es on ep.esid = es.esid
78 78
         left join e_base eb on es.examid = eb.examid
79 79
         where ep.epid=#{epid}

+ 1
- 0
sexam/src/main/resources/mapper/system/UserMapper.xml View File

@@ -18,6 +18,7 @@
18 18
     <!--获取考试班级任教老师-->
19 19
     <select id="listTeacherByClassIds" resultType="com.xhkjedu.vo.system.UserVo">
20 20
         select u.userid,u.userphone
21
+        ,(select tp.subjectid from t_teacher_powersb tp where tp.teacherid=ct.teacherid limit 1)subjectid
21 22
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
22 23
         where ct.classid in(${classids}) and u.userstate=1
23 24
         group by u.userid

+ 8
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GradeController.java View File

@@ -73,6 +73,14 @@ public class GradeController {
73 73
         return new ResultVo(0,"获取班级列表成功",list);
74 74
     }
75 75
 
76
+    @PostMapping("/list_class_stu")
77
+    public ResultVo listClassStu(@RequestBody TGrade tGrade) {
78
+        Integer schoolid = tGrade.getSchoolid();
79
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1});
80
+        List<Map> list = gradeService.listClassStu(schoolid, tGrade.getClasstype());
81
+        return new ResultVo(0, "获取班级学生列表成功", list);
82
+    }
83
+
76 84
     //教师设置班级权限
77 85
     @PostMapping("/lct")
78 86
     public ResultVo listClassForTeacher(@RequestBody TGrade tGrade) {

+ 9
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GradeMapper.java View File

@@ -24,6 +24,15 @@ public interface GradeMapper extends TkMapper<TGrade> {
24 24
      **/
25 25
     List<GradeVo> listClass(@Param("schoolid") Integer schoolid, @Param("year") Integer year,@Param("classtype") Integer classtype);
26 26
 
27
+    /**
28
+     * @Description 获取班级学生列表
29
+     * @Date 2023/12/18 14:51
30
+     * @Author YWX
31
+     * @Param [schoolid, year, classtype]
32
+     * @Return java.util.List<java.util.Map>
33
+     **/
34
+    List<Map> listClassStu(@Param("schoolid") Integer schoolid, @Param("year") Integer year,@Param("classtype") Integer classtype);
35
+
27 36
     /**
28 37
      * 获取通知教师列表
29 38
      * @Param [schoolid, year]

+ 12
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GradeService.java View File

@@ -67,6 +67,18 @@ public class GradeService {
67 67
         return gradeMapper.listClass(schoolid, year, classtype);
68 68
     }
69 69
 
70
+    /**
71
+     * @Description 获取班级学生列表
72
+     * @Date 2023/12/18 14:50
73
+     * @Author YWX
74
+     * @Param [schoolid, classtype]
75
+     * @Return java.util.List<java.util.Map>
76
+     **/
77
+    public List<Map> listClassStu(Integer schoolid, Integer classtype) {
78
+        Integer year = schoolMapper.getYearById(schoolid);
79
+        return gradeMapper.listClassStu(schoolid, year, classtype);
80
+    }
81
+
70 82
     /**
71 83
      * 获取通知教师列表
72 84
      *

+ 28
- 0
suser/src/main/resources/mapper/gradeclass/GradeMapper.xml View File

@@ -51,6 +51,34 @@
51 51
         </if>
52 52
          order by c.gradeid,c.classtype,c.classorder,c.classid desc
53 53
     </select>
54
+    <!--获取班级学生列表-->
55
+    <resultMap id="gradeClassResult" type="java.util.Map">
56
+        <result property="gradeid" column="gradeid"/>
57
+        <collection property="classes" ofType="java.util.Map" javaType="java.util.List">
58
+            <result property="classid" column="classid"/>
59
+            <result property="classname" column="classname"/>
60
+            <result property="classnum" column="classnum"/>
61
+            <result property="classtype" column="classtype"/>
62
+            <collection property="students" ofType="java.util.Map" javaType="java.util.List">
63
+                <result property="studentid" column="studentid"/>
64
+                <result property="username" column="username"/>
65
+            </collection>
66
+        </collection>
67
+    </resultMap>
68
+    <select id="listClassStu" resultMap="gradeClassResult">
69
+        select c.gradeid,c.classid,c.classname,c.classnum,c.classtype,c.classorder,c.year,c.schoolyear
70
+        ,cs.studentid,u.username
71
+        from t_class c left join t_class_student cs on c.classid=cs.classid
72
+        left join t_user u on cs.studentid = u.userid
73
+        where c.schoolid=#{schoolid} and c.year=#{year} and c.classstate=1 and c.classnum>0
74
+        <if test="classtype!=null and classtype!=0">
75
+            and c.classtype=#{classtype}
76
+        </if>
77
+        <if test="classtype==null or classtype==0">
78
+            and c.classtype <![CDATA[ < ]]>5
79
+        </if>
80
+        order by c.gradeid,c.classtype,c.classorder,c.classid desc
81
+    </select>
54 82
 
55 83
     <!--教师设置权限班级-->
56 84
     <select id="listClassForTeacher" resultMap="gradeResult">

Loading…
Cancel
Save