Browse Source

通知管理

tags/正式3.13.3
雍文秀 1 year ago
parent
commit
240e0172bd

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

73
         Integer pageSize = tNotice.getPageSize();
73
         Integer pageSize = tNotice.getPageSize();
74
         Integer createid = tNotice.getCreateid();
74
         Integer createid = tNotice.getCreateid();
75
         Integer schoolid = tNotice.getSchoolid();
75
         Integer schoolid = tNotice.getSchoolid();
76
-        N_Utils.validation(new Object[]{pageSize,"显示条数",1,createid,"教师id",1,schoolid,"学校id",1});
76
+        N_Utils.validation(new Object[]{pageSize,"显示条数",1,createid,"用户id",1,schoolid,"学校id",1});
77
         List<NoticeVo> list = noticeService.listMy(tNotice);
77
         List<NoticeVo> list = noticeService.listMy(tNotice);
78
-        return new ResultVo(0,"获取教师通知列表成功",list);
78
+        return new ResultVo(0,"获取用户通知列表成功",list);
79
     }
79
     }
80
 
80
 
81
     @PostMapping("/list_my_all")
81
     @PostMapping("/list_my_all")
84
         Integer pageSize = tNotice.getPageSize();
84
         Integer pageSize = tNotice.getPageSize();
85
         Integer createid = tNotice.getCreateid();
85
         Integer createid = tNotice.getCreateid();
86
         Integer schoolid = tNotice.getSchoolid();
86
         Integer schoolid = tNotice.getSchoolid();
87
-        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"教师id",1,schoolid,"学校id",1});
87
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,createid,"用户id",1,schoolid,"学校id",1});
88
         PageHelper.startPage(page, pageSize);
88
         PageHelper.startPage(page, pageSize);
89
         List<NoticeVo> list = noticeService.listMy(tNotice);
89
         List<NoticeVo> list = noticeService.listMy(tNotice);
90
         PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
90
         PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
110
         Integer createid = tNotice.getCreateid();
110
         Integer createid = tNotice.getCreateid();
111
         N_Utils.validation(new Object[]{noticeid,"通知id",1,createid,"用户id",1});
111
         N_Utils.validation(new Object[]{noticeid,"通知id",1,createid,"用户id",1});
112
         TNotice notice = noticeService.reade(noticeid, createid);
112
         TNotice notice = noticeService.reade(noticeid, createid);
113
-        return new ResultVo(0,"教师查看成功", notice);
113
+        return new ResultVo(0,"用户查看成功", notice);
114
     }
114
     }
115
 
115
 
116
     @PostMapping("/student_readed")
116
     @PostMapping("/student_readed")
124
     @PostMapping("/no_read_num")
124
     @PostMapping("/no_read_num")
125
     public ResultVo noReadNum(@RequestBody TNotice tNotice) {
125
     public ResultVo noReadNum(@RequestBody TNotice tNotice) {
126
         Integer createid = tNotice.getCreateid();
126
         Integer createid = tNotice.getCreateid();
127
-        N_Utils.validation(new Object[]{createid,"教师id",1});
127
+        N_Utils.validation(new Object[]{createid,"用户id",1});
128
         Integer num = noticeService.noReadNum(createid);
128
         Integer num = noticeService.noReadNum(createid);
129
-        return new ResultVo(0,"获取教师未看通知数量成功",num);
129
+        return new ResultVo(0,"获取用户未看通知数量成功",num);
130
     }
130
     }
131
 
131
 
132
     /**
132
     /**

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

1
+package com.xhkjedu.sapi.mapper.notice;
2
+
3
+import com.xhkjedu.base.TkMapper;
4
+import com.xhkjedu.sapi.model.notice.TNoticeFile;
5
+
6
+/**
7
+ * @Description
8
+ * @Author ywx
9
+ * Date 2023/12/18 14:08
10
+ **/
11
+public interface NoticeFileMapper extends TkMapper<TNoticeFile> {
12
+}

+ 8
- 8
sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeMapper.java View File

4
 import com.xhkjedu.sapi.model.system.TSchool;
4
 import com.xhkjedu.sapi.model.system.TSchool;
5
 import com.xhkjedu.sapi.model.notice.TNotice;
5
 import com.xhkjedu.sapi.model.notice.TNotice;
6
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
6
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
7
-import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
7
+import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
8
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
8
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
9
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
10
 
10
 
18
     TNotice findById(@Param("noticeid") Integer noticeid);
18
     TNotice findById(@Param("noticeid") Integer noticeid);
19
 
19
 
20
     /**
20
     /**
21
-     * 教师通知列表
21
+     * 用户通知列表
22
      * @Param [notice]
22
      * @Param [notice]
23
      * @Author ywx
23
      * @Author ywx
24
      * @Date 2020/6/13 9:57
24
      * @Date 2020/6/13 9:57
36
     List<NoticeVo> listStudent(@Param("notice") TNotice notice);
36
     List<NoticeVo> listStudent(@Param("notice") TNotice notice);
37
 
37
 
38
     /**
38
     /**
39
-     * 教师、学生查看详情
39
+     * 用户查看详情
40
      * @Param [noticeid]
40
      * @Param [noticeid]
41
      * @Author ywx
41
      * @Author ywx
42
      * @Date 2020/6/13 11:50
42
      * @Date 2020/6/13 11:50
45
     TNotice findById2(@Param("noticeid") Integer noticeid);
45
     TNotice findById2(@Param("noticeid") Integer noticeid);
46
 
46
 
47
     /**
47
     /**
48
-     * 教师未看通知数量
49
-     * @Param [teacherid]
48
+     * 用户未看通知数量
49
+     * @Param [userid]
50
      * @Author ywx
50
      * @Author ywx
51
      * @Date 2020/7/24 10:39
51
      * @Date 2020/7/24 10:39
52
      * @return java.lang.Integer
52
      * @return java.lang.Integer
53
      **/
53
      **/
54
-    Integer noReadNum(@Param("teacherid") Integer teacherid);
54
+    Integer noReadNum(@Param("userid") Integer userid);
55
 
55
 
56
 
56
 
57
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
57
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
70
     //通知班级列表
70
     //通知班级列表
71
     List<ClassVo> listClass(Integer noticeid);
71
     List<ClassVo> listClass(Integer noticeid);
72
 
72
 
73
-    //通知教师列表
74
-    List<NoticeTeacherVo> listTeacher(Integer noticeid);
73
+    //通知用户列表
74
+    List<NoticeUserVo> listUser(Integer noticeid);
75
 
75
 
76
     //通知学校列表
76
     //通知学校列表
77
     List<TSchool> listSchool(Integer noticeid);
77
     List<TSchool> listSchool(Integer noticeid);

sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeTeacherMapper.java → sapi/src/main/java/com/xhkjedu/sapi/mapper/notice/NoticeUserMapper.java View File

2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.sapi.model.notice.TNotice;
4
 import com.xhkjedu.sapi.model.notice.TNotice;
5
-import com.xhkjedu.sapi.model.notice.TNoticeTeacher;
5
+import com.xhkjedu.sapi.model.notice.TNoticeUser;
6
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 
7
 
8
-public interface NoticeTeacherMapper extends TkMapper<TNoticeTeacher> {
8
+public interface NoticeUserMapper extends TkMapper<TNoticeUser> {
9
     /**
9
     /**
10
      * 批量添加
10
      * 批量添加
11
      * @Param [notice]
11
      * @Param [notice]
15
      **/
15
      **/
16
     Integer batchSave(@Param("notice") TNotice notice);
16
     Integer batchSave(@Param("notice") TNotice notice);
17
 
17
 
18
-    /**
19
-     * 删除通知对象
20
-     * @Param [noticeid]
21
-     * @Author ywx
22
-     * @Date 2020/6/13 10:00
23
-     * @return java.lang.Integer
24
-     **/
25
-    Integer deleteByNoticeId(@Param("noticeid") Integer noticeid);
26
-
27
     /**
18
     /**
28
      * 查看
19
      * 查看
29
-     * @Param [noticeid, teacherid]
20
+     * @Param [noticeid, userid]
30
      * @Author ywx
21
      * @Author ywx
31
      * @Date 2020/6/13 11:17
22
      * @Date 2020/6/13 11:17
32
      * @return java.lang.Integer
23
      * @return java.lang.Integer
33
      **/
24
      **/
34
-    Integer reade(@Param("noticeid") Integer noticeid, @Param("teacherid") Integer teacherid
25
+    Integer reade(@Param("noticeid") Integer noticeid, @Param("userid") Integer userid
35
             , @Param("timestamp") int timestamp);
26
             , @Param("timestamp") int timestamp);
36
 }
27
 }

+ 6
- 2
sapi/src/main/java/com/xhkjedu/sapi/model/notice/TNotice.java View File

3
 import com.xhkjedu.model.BaseBean;
3
 import com.xhkjedu.model.BaseBean;
4
 import com.xhkjedu.sapi.model.system.TSchool;
4
 import com.xhkjedu.sapi.model.system.TSchool;
5
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
5
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
6
-import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
6
+import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
7
 import lombok.Data;
7
 import lombok.Data;
8
 
8
 
9
 import javax.persistence.Id;
9
 import javax.persistence.Id;
45
 
45
 
46
     @Transient
46
     @Transient
47
     //教师id集合
47
     //教师id集合
48
-    private List<NoticeTeacherVo> teachers;
48
+    private List<NoticeUserVo> users;
49
 
49
 
50
     @Transient
50
     @Transient
51
     //开始时间
51
     //开始时间
61
     @Transient
61
     @Transient
62
     //学校id集合
62
     //学校id集合
63
     private List<TSchool> schools;
63
     private List<TSchool> schools;
64
+
65
+    @Transient
66
+    //通知附件
67
+    private List<TNoticeFile> files;
64
 }
68
 }

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

1
+package com.xhkjedu.sapi.model.notice;
2
+
3
+import com.xhkjedu.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_notice_file")
10
+@Data
11
+public class TNoticeFile extends BaseBean {
12
+    @Id
13
+    //通知附件表
14
+    private Integer nfid;
15
+
16
+    //通知id
17
+    private String noticeid;
18
+
19
+    //资源名称
20
+    private String resourcename;
21
+
22
+    //资源分类1word,2ppt,3pdf,4图片,5视频,6音频,7压缩包,10其他
23
+    private Integer resourceclass;
24
+
25
+    //资源地址
26
+    private String resourceurl;
27
+
28
+    //封面图地址
29
+    private String resourcecover;
30
+
31
+    //是否转换0未转换1已转换2转换失败3加密
32
+    private Integer converted;
33
+
34
+    //转换失败原因
35
+    private String convertmsg;
36
+
37
+    //转换后的pdf文件地址
38
+    private String pdfurl;
39
+
40
+    //文件后缀
41
+    private String suffix;
42
+
43
+    //文件大小
44
+    private Integer resourcesize;
45
+
46
+    //视频时长(秒)
47
+    private Integer duration;
48
+
49
+    //创建时间
50
+    private Integer createtime;
51
+}

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

6
 import javax.persistence.Id;
6
 import javax.persistence.Id;
7
 import javax.persistence.Table;
7
 import javax.persistence.Table;
8
 
8
 
9
-@Table(name = "t_notice_teacher")
9
+@Table(name = "t_notice_user")
10
 @Data
10
 @Data
11
-public class TNoticeTeacher extends BaseBean {
11
+public class TNoticeUser extends BaseBean {
12
     @Id
12
     @Id
13
     //通知用户表
13
     //通知用户表
14
     private Integer nuid;
14
     private Integer nuid;
17
     private Integer noticeid;
17
     private Integer noticeid;
18
 
18
 
19
     //用户id
19
     //用户id
20
-    private Integer teacherid;
20
+    private Integer userid;
21
 
21
 
22
     //是否查看0未查看1已查看
22
     //是否查看0未查看1已查看
23
     private Integer readed;
23
     private Integer readed;

+ 15
- 19
sapi/src/main/java/com/xhkjedu/sapi/service/notice/NoticeService.java View File

3
 import com.xhkjedu.sapi.mapper.notice.NoticeClassMapper;
3
 import com.xhkjedu.sapi.mapper.notice.NoticeClassMapper;
4
 import com.xhkjedu.sapi.mapper.notice.NoticeMapper;
4
 import com.xhkjedu.sapi.mapper.notice.NoticeMapper;
5
 import com.xhkjedu.sapi.mapper.notice.NoticeSchoolMapper;
5
 import com.xhkjedu.sapi.mapper.notice.NoticeSchoolMapper;
6
-import com.xhkjedu.sapi.mapper.notice.NoticeTeacherMapper;
6
+import com.xhkjedu.sapi.mapper.notice.NoticeUserMapper;
7
 import com.xhkjedu.sapi.model.system.TSchool;
7
 import com.xhkjedu.sapi.model.system.TSchool;
8
 import com.xhkjedu.sapi.model.notice.TNotice;
8
 import com.xhkjedu.sapi.model.notice.TNotice;
9
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.N_Utils;
10
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
10
 import com.xhkjedu.sapi.vo.gradeclass.ClassVo;
11
-import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
11
+import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
12
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
12
 import com.xhkjedu.sapi.vo.notice.NoticeVo;
13
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
14
 
14
 
29
     @Resource
29
     @Resource
30
     private NoticeClassMapper noticeClassMapper;
30
     private NoticeClassMapper noticeClassMapper;
31
     @Resource
31
     @Resource
32
-    private NoticeTeacherMapper noticeTeacherMapper;
32
+    private NoticeUserMapper noticeUserMapper;
33
     @Resource
33
     @Resource
34
     private NoticeSchoolMapper noticeSchoolMapper;
34
     private NoticeSchoolMapper noticeSchoolMapper;
35
 
35
 
58
 
58
 
59
     //添加通知对象
59
     //添加通知对象
60
     private void saveNoticeObj(TNotice model) {
60
     private void saveNoticeObj(TNotice model) {
61
-        if (model.getNoticetype() == 1) {//通知对象1班级
61
+        Integer noticetype = model.getNoticetype();
62
+        if (noticetype == 1) {//通知对象1班级
62
             noticeClassMapper.batchSave(model);
63
             noticeClassMapper.batchSave(model);
63
-        } else if (model.getNoticetype() == 2) {//通知对象2老师
64
-            model.setTeachers(N_Utils.listDistinct(model.getTeachers()));//通知对象去重
65
-            noticeTeacherMapper.batchSave(model);
64
+        } else if (noticetype == 2 || noticetype == 3) {//通知对象2老师3单个学生
65
+            model.setUsers(N_Utils.listDistinct(model.getUsers()));//通知对象去重
66
+            noticeUserMapper.batchSave(model);
66
         }
67
         }
67
 
68
 
68
         if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
69
         if (N_Utils.isListEmpty(model.getSchools())) {//兼容以前添加单个学校模式
82
         if (noticetype == 1) {
83
         if (noticetype == 1) {
83
             List<ClassVo> classes = noticeMapper.listClass(noticeid);
84
             List<ClassVo> classes = noticeMapper.listClass(noticeid);
84
             notice.setClasses(classes);
85
             notice.setClasses(classes);
85
-        } else if (noticetype == 2) {
86
-            List<NoticeTeacherVo> teachers = noticeMapper.listTeacher(noticeid);
87
-            notice.setTeachers(teachers);
86
+        } else if (noticetype == 2 || noticetype == 3) {
87
+            List<NoticeUserVo> users = noticeMapper.listUser(noticeid);
88
+            notice.setUsers(users);
88
         } else {
89
         } else {
89
             List<TSchool> schools = noticeMapper.listSchool(noticeid);
90
             List<TSchool> schools = noticeMapper.listSchool(noticeid);
90
             notice.setSchools(schools);
91
             notice.setSchools(schools);
98
     }
99
     }
99
 
100
 
100
     /**
101
     /**
101
-     * 教师通知列表
102
+     * 用户通知列表
102
      * @Param [notice]
103
      * @Param [notice]
103
      * @Author ywx
104
      * @Author ywx
104
      * @Date 2020/6/13 9:55
105
      * @Date 2020/6/13 9:55
120
     }
121
     }
121
 
122
 
122
     /**
123
     /**
123
-     * 教师查看
124
+     * 用户查看
124
      * @Param [noticeid, createid]
125
      * @Param [noticeid, createid]
125
      * @Author ywx
126
      * @Author ywx
126
      * @Date 2020/6/13 11:21
127
      * @Date 2020/6/13 11:21
128
      **/
129
      **/
129
     public TNotice reade(Integer noticeid, Integer createid) {
130
     public TNotice reade(Integer noticeid, Integer createid) {
130
         TNotice notice = noticeMapper.findById2(noticeid);
131
         TNotice notice = noticeMapper.findById2(noticeid);
131
-        noticeTeacherMapper.reade(noticeid, createid, N_Utils.getSecondTimestamp());
132
+        noticeUserMapper.reade(noticeid, createid, N_Utils.getSecondTimestamp());
132
         return notice;
133
         return notice;
133
     }
134
     }
134
 
135
 
144
     }
145
     }
145
 
146
 
146
     /**
147
     /**
147
-     * 教师未看通知数量
148
+     * 用户未看通知数量
148
      * @Param [teacherid]
149
      * @Param [teacherid]
149
      * @Author ywx
150
      * @Author ywx
150
      * @Date 2020/7/24 10:37
151
      * @Date 2020/7/24 10:37
154
         return noticeMapper.noReadNum(teacherid);
155
         return noticeMapper.noReadNum(teacherid);
155
     }
156
     }
156
 
157
 
157
-    //根据班级删除通知
158
-    public void deleteByClassId(Integer classid) {
159
-        noticeMapper.deleteByClassId(classid);
160
-    }
161
-
162
     //通知学生--网页--列表
158
     //通知学生--网页--列表
163
     public List<NoticeVo> listNoticeStuWeb(TNotice notice) {
159
     public List<NoticeVo> listNoticeStuWeb(TNotice notice) {
164
         return noticeMapper.listNoticeForStuWeb(notice);
160
         return noticeMapper.listNoticeForStuWeb(notice);

+ 3
- 3
sapi/src/main/java/com/xhkjedu/sapi/service/research/ResearchService.java View File

9
 import com.xhkjedu.sapi.model.research.TResearchUser;
9
 import com.xhkjedu.sapi.model.research.TResearchUser;
10
 import com.xhkjedu.sapi.service.notice.NoticeService;
10
 import com.xhkjedu.sapi.service.notice.NoticeService;
11
 import com.xhkjedu.utils.N_Utils;
11
 import com.xhkjedu.utils.N_Utils;
12
-import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
12
+import com.xhkjedu.sapi.vo.notice.NoticeUserVo;
13
 import lombok.extern.slf4j.Slf4j;
13
 import lombok.extern.slf4j.Slf4j;
14
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
15
 import org.springframework.transaction.annotation.Transactional;
15
 import org.springframework.transaction.annotation.Transactional;
88
 
88
 
89
 
89
 
90
         if( research.getNotice() == 1){//发送通知
90
         if( research.getNotice() == 1){//发送通知
91
-            List<NoticeTeacherVo> teachers = new ArrayList<>();
91
+            List<NoticeUserVo> teachers = new ArrayList<>();
92
             TNotice notice = new TNotice();
92
             TNotice notice = new TNotice();
93
             notice.setNoticetitle(research.getResearchname());
93
             notice.setNoticetitle(research.getResearchname());
94
             notice.setNoticecontent(research.getResearchcontent());
94
             notice.setNoticecontent(research.getResearchcontent());
97
             notice.setCreateid(research.getCreateid());
97
             notice.setCreateid(research.getCreateid());
98
             notice.setSchoolid(research.getSchoolid());
98
             notice.setSchoolid(research.getSchoolid());
99
             userids.forEach(uid->{
99
             userids.forEach(uid->{
100
-                NoticeTeacherVo nt = new NoticeTeacherVo();
100
+                NoticeUserVo nt = new NoticeUserVo();
101
                 nt.setTeacherid(uid);
101
                 nt.setTeacherid(uid);
102
                 teachers.add(nt);
102
                 teachers.add(nt);
103
             });
103
             });

sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeTeacherVo.java → sapi/src/main/java/com/xhkjedu/sapi/vo/notice/NoticeUserVo.java View File

3
 import lombok.Data;
3
 import lombok.Data;
4
 
4
 
5
 @Data
5
 @Data
6
-public class NoticeTeacherVo {
7
-    //教师id
8
-    private Integer teacherid;
6
+public class NoticeUserVo {
7
+    //用户id
8
+    private Integer userid;
9
 
9
 
10
-    //教师名称
11
-    private String teachername;
10
+    //用户名称
11
+    private String username;
12
 
12
 
13
     //是否查看0未查看1已查看
13
     //是否查看0未查看1已查看
14
     private Integer readed;
14
     private Integer readed;

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

39
         where nc.noticeid=#{noticeid}
39
         where nc.noticeid=#{noticeid}
40
         order by c.gradeid,c.classtype,c.classorder
40
         order by c.gradeid,c.classtype,c.classorder
41
     </select>
41
     </select>
42
-    <!--通知教师列表-->
43
-    <select id="listTeacher" resultType="com.xhkjedu.sapi.vo.notice.NoticeTeacherVo">
44
-        select t.teacherid,tu.username teachername,t.readed
45
-        from t_notice_teacher t left join t_user tu on t.teacherid = tu.userid
42
+    <!--通知用户列表-->
43
+    <select id="listUser" resultType="com.xhkjedu.sapi.vo.notice.NoticeUserVo">
44
+        select t.userid,tu.username teachername,t.readed
45
+        from t_notice_user t left join t_user tu on t.userid = tu.userid
46
         where t.noticeid=#{noticeid}
46
         where t.noticeid=#{noticeid}
47
     </select>
47
     </select>
48
     <!--通知学校列表-->
48
     <!--通知学校列表-->
56
         from t_notice n left join t_user u on n.createid=u.userid
56
         from t_notice n left join t_user u on n.createid=u.userid
57
         where n.noticeid=#{noticeid} limit 1
57
         where n.noticeid=#{noticeid} limit 1
58
     </select>
58
     </select>
59
-    <!--教师、学生查看详情-->
59
+    <!--用户查看详情-->
60
     <select id="findById2" resultType="com.xhkjedu.sapi.model.notice.TNotice">
60
     <select id="findById2" resultType="com.xhkjedu.sapi.model.notice.TNotice">
61
         select n.*,u.username createname
61
         select n.*,u.username createname
62
         from t_notice n left join t_user u on n.createid=u.userid
62
         from t_notice n left join t_user u on n.createid=u.userid
63
         where n.noticeid=#{noticeid} limit 1
63
         where n.noticeid=#{noticeid} limit 1
64
     </select>
64
     </select>
65
-    <!-- 教师通知列表 -->
65
+    <!-- 用户通知列表 -->
66
     <select id="listMy" resultType="com.xhkjedu.sapi.vo.notice.NoticeVo">
66
     <select id="listMy" resultType="com.xhkjedu.sapi.vo.notice.NoticeVo">
67
-        select n.noticeid,n.noticetitle,n.createtime,u.username createname,IFNULL(nt.readed,0)readed
67
+        select n.noticeid,n.noticetitle,n.createtime,u.username createname,IFNULL(nt.readed,0) as readed
68
         from t_notice n left join t_user u on n.createid=u.userid
68
         from t_notice n left join t_user u on n.createid=u.userid
69
-        left join t_notice_teacher nt on n.noticeid = nt.noticeid
70
-        where nt.teacherid=#{notice.createid}
69
+        left join t_notice_user nt on n.noticeid = nt.noticeid
70
+        where nt.userid=#{notice.createid}
71
         <if test="notice.readed!=null"> and nt.readed=#{notice.readed}</if>
71
         <if test="notice.readed!=null"> and nt.readed=#{notice.readed}</if>
72
         <if test="notice.noticetitle!=null and notice.noticetitle!=''">
72
         <if test="notice.noticetitle!=null and notice.noticetitle!=''">
73
             and (n.noticetitle like concat('%', #{notice.noticetitle}, '%')
73
             and (n.noticetitle like concat('%', #{notice.noticetitle}, '%')
80
             and n.createtime &lt;=#{notice.stoptime}
80
             and n.createtime &lt;=#{notice.stoptime}
81
         </if>
81
         </if>
82
 
82
 
83
-        group by n.noticeid order by nt.readed asc,n.createtime desc
83
+        group by n.noticeid order by nt.readed,n.createtime desc
84
         <if test="notice.page==null">
84
         <if test="notice.page==null">
85
             limit #{notice.pageSize}
85
             limit #{notice.pageSize}
86
         </if>
86
         </if>
87
     </select>
87
     </select>
88
-    <!--教师未看通知数量-->
88
+    <!--用户未看通知数量-->
89
     <select id="noReadNum" resultType="java.lang.Integer">
89
     <select id="noReadNum" resultType="java.lang.Integer">
90
-        select count(*) from t_notice_teacher t where t.teacherid=#{teacherid} and t.readed=0
90
+        select count(*) from t_notice_user t where t.userid=#{userid} and t.readed=0
91
     </select>
91
     </select>
92
     <!--学生通知列表-->
92
     <!--学生通知列表-->
93
     <select id="listStudent" resultType="com.xhkjedu.sapi.vo.notice.NoticeVo">
93
     <select id="listStudent" resultType="com.xhkjedu.sapi.vo.notice.NoticeVo">

+ 0
- 21
sapi/src/main/resources/mapper/notice/NoticeTeacherMapper.xml View File

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.NoticeTeacherMapper">
4
-    <!--批量添加-->
5
-    <insert id="batchSave" parameterType="com.xhkjedu.sapi.model.notice.TNotice">
6
-        INSERT INTO t_notice_teacher (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
-    <!--删除通知对象-->
13
-    <delete id="deleteByNoticeId">
14
-        delete from t_notice_teacher where noticeid=#{noticeid}
15
-    </delete>
16
-    <!--查看-->
17
-    <update id="reade">
18
-        update t_notice_teacher nt set nt.readed=1,nt.readtime=#{timestamp}
19
-        where nt.noticeid=#{noticeid} and nt.teacherid=#{teacherid}
20
-    </update>
21
-</mapper>

+ 17
- 0
sapi/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

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.NoticeUserMapper">
4
+    <!--批量添加-->
5
+    <insert id="batchSave" parameterType="com.xhkjedu.sapi.model.notice.TNotice">
6
+        INSERT INTO t_notice_user (noticeid,userid,createtime,schoolid)
7
+        VALUES
8
+        <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
9
+            (#{notice.noticeid},#{t.userid},#{notice.createtime},#{notice.schoolid})
10
+        </foreach>
11
+    </insert>
12
+    <!--查看-->
13
+    <update id="reade">
14
+        update t_notice_user nt set nt.readed=1,nt.readtime=#{timestamp}
15
+        where nt.noticeid=#{noticeid} and nt.userid=#{userid}
16
+    </update>
17
+</mapper>

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

6
 import javax.persistence.Id;
6
 import javax.persistence.Id;
7
 import javax.persistence.Table;
7
 import javax.persistence.Table;
8
 
8
 
9
-@Table(name = "t_notice_teacher")
9
+@Table(name = "t_notice_user")
10
 @Data
10
 @Data
11
 public class TNoticeTeacher extends BaseBean {
11
 public class TNoticeTeacher extends BaseBean {
12
     @Id
12
     @Id

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

3
 <mapper namespace="com.xhkjedu.sexam.mapper.notice.NoticeTeacherMapper">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.notice.NoticeTeacherMapper">
4
     <!--批量添加-->
4
     <!--批量添加-->
5
     <insert id="batchSave" parameterType="com.xhkjedu.sexam.model.notice.TNotice">
5
     <insert id="batchSave" parameterType="com.xhkjedu.sexam.model.notice.TNotice">
6
-        INSERT INTO t_notice_teacher (noticeid,teacherid,createtime,schoolid)
6
+        INSERT INTO t_notice_user (noticeid,teacherid,createtime,schoolid)
7
         VALUES
7
         VALUES
8
         <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
8
         <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
9
             (#{notice.noticeid},#{t.teacherid},#{notice.createtime},#{notice.schoolid})
9
             (#{notice.noticeid},#{t.teacherid},#{notice.createtime},#{notice.schoolid})

Loading…
Cancel
Save