Browse Source

通知对象分页列表

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

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

4
 import com.github.pagehelper.PageInfo;
4
 import com.github.pagehelper.PageInfo;
5
 import com.xhkjedu.annotation.Action;
5
 import com.xhkjedu.annotation.Action;
6
 import com.xhkjedu.sapi.model.notice.TNotice;
6
 import com.xhkjedu.sapi.model.notice.TNotice;
7
+import com.xhkjedu.sapi.model.notice.TNoticeUser;
7
 import com.xhkjedu.sapi.service.notice.NoticeService;
8
 import com.xhkjedu.sapi.service.notice.NoticeService;
8
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.PageUtil;
10
 import com.xhkjedu.utils.PageUtil;
147
         return new ResultVo(0,"获取学生通知列表成功",pageResult);
148
         return new ResultVo(0,"获取学生通知列表成功",pageResult);
148
     }
149
     }
149
 
150
 
151
+    /**
152
+     * @Description 通知对象列表
153
+     * @Date 2023/12/22 9:39
154
+     * @Author YWX
155
+     * @Param [nu]
156
+     * @Return com.xhkjedu.vo.ResultVo
157
+     **/
150
     @PostMapping("/list_user")
158
     @PostMapping("/list_user")
151
-    public ResultVo listUser(@RequestBody TNotice notice) {
152
-        Integer noticeid = notice.getNoticeid();
159
+    public ResultVo listUser(@RequestBody TNoticeUser nu) {
160
+        Integer noticeid = nu.getNoticeid();
153
         N_Utils.validation(new Object[]{noticeid, "通知id", 1});
161
         N_Utils.validation(new Object[]{noticeid, "通知id", 1});
154
-        List<Map> list = noticeService.listUser(noticeid);
162
+        List<Map> list = noticeService.listUser(nu);
155
         return new ResultVo(0, "获取通知对象成功", list);
163
         return new ResultVo(0, "获取通知对象成功", list);
156
     }
164
     }
157
 
165
 
166
+    /**
167
+     * @Description 通知对象分页列表
168
+     * @Date 2023/12/22 9:39
169
+     * @Author YWX
170
+     * @Param [nu]
171
+     * @Return com.xhkjedu.vo.ResultVo
172
+     **/
173
+    @PostMapping("/list_userp")
174
+    public ResultVo listUserPaging(@RequestBody TNoticeUser nu) {
175
+        Integer noticeid = nu.getNoticeid();
176
+        Integer page = nu.getPage();
177
+        Integer pageSize = nu.getPageSize();
178
+        N_Utils.validation(new Object[]{noticeid, "通知id", 1, page, "显示页码", 1, pageSize, "显示条数"});
179
+        PageHelper.startPage(page, pageSize);
180
+        List<Map> list = noticeService.listUser(nu);
181
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
182
+        return new ResultVo(0, "获取通知对象成功", pageResult);
183
+    }
184
+
158
     /*
185
     /*
159
      * @Description 处理班级通知到学生个人
186
      * @Description 处理班级通知到学生个人
160
      * @Date 2023/12/18 17:41:09
187
      * @Date 2023/12/18 17:41:09

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

29
             , @Param("timestamp") int timestamp);
29
             , @Param("timestamp") int timestamp);
30
 
30
 
31
     //通知对象
31
     //通知对象
32
-    List<Map> listByNoticeId(@Param("noticeid") Integer noticeid);
32
+    List<Map> listByNoticeId(@Param("nu") TNoticeUser nu);
33
 
33
 
34
     //删除通知对象
34
     //删除通知对象
35
     void deleteByNoticeId(@Param("noticeid") Integer noticeid);
35
     void deleteByNoticeId(@Param("noticeid") Integer noticeid);

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

3
 import com.xhkjedu.model.BaseBean;
3
 import com.xhkjedu.model.BaseBean;
4
 import lombok.Data;
4
 import lombok.Data;
5
 
5
 
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
6
+import javax.persistence.*;
8
 
7
 
9
 @Table(name = "t_notice_user")
8
 @Table(name = "t_notice_user")
10
 @Data
9
 @Data
36
 
35
 
37
     //创建时间
36
     //创建时间
38
     private Integer createtime;
37
     private Integer createtime;
38
+
39
+    @Transient
40
+    //用户姓名
41
+    private String username;
42
+
43
+    @Transient
44
+    //通知对象1班级2老师3单个学生
45
+    private Integer noticetype;
39
 }
46
 }

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

209
      * @Description 通知对象
209
      * @Description 通知对象
210
      * @Date 2023/12/18 16:26
210
      * @Date 2023/12/18 16:26
211
      * @Author YWX
211
      * @Author YWX
212
-     * @Param [noticeid]
212
+     * @Param [nu]
213
      * @Return java.util.List<java.util.Map>
213
      * @Return java.util.List<java.util.Map>
214
      **/
214
      **/
215
-    public List<Map> listUser(Integer noticeid) {
216
-        return noticeUserMapper.listByNoticeId(noticeid);
215
+    public List<Map> listUser(TNoticeUser nu) {
216
+        return noticeUserMapper.listByNoticeId(nu);
217
     }
217
     }
218
 
218
 
219
     /*
219
     /*

+ 10
- 2
sapi/src/main/resources/mapper/notice/NoticeUserMapper.xml View File

28
         <collection property="users" ofType="java.util.Map" javaType="java.util.List">
28
         <collection property="users" ofType="java.util.Map" javaType="java.util.List">
29
             <result property="userid" column="userid"/>
29
             <result property="userid" column="userid"/>
30
             <result property="readed" column="readed"/>
30
             <result property="readed" column="readed"/>
31
+            <result property="readtime" column="readtime"/>
31
             <result property="username" column="username"/>
32
             <result property="username" column="username"/>
32
             <result property="headpic" column="headpic"/>
33
             <result property="headpic" column="headpic"/>
33
         </collection>
34
         </collection>
34
     </resultMap>
35
     </resultMap>
35
     <select id="listByNoticeId" resultMap="userResult">
36
     <select id="listByNoticeId" resultMap="userResult">
36
-        select nu.userid,nu.readed,u.username,u.headpic,nu.gradeid,nu.classid,nu.subjectid
37
+        select nu.userid,nu.readed,nu.readtime,u.username,u.headpic,nu.gradeid,nu.classid,nu.subjectid
37
         ,if(nu.classid is not null,(select c.classname from t_class c where c.classid=nu.classid)
38
         ,if(nu.classid is not null,(select c.classname from t_class c where c.classid=nu.classid)
38
             ,(select s.subjectname from t_subject s where s.subjectid=nu.subjectid))name
39
             ,(select s.subjectname from t_subject s where s.subjectid=nu.subjectid))name
39
         from t_notice_user nu left join t_user u on nu.userid = u.userid
40
         from t_notice_user nu left join t_user u on nu.userid = u.userid
40
-        where nu.noticeid=#{noticeid}
41
+        where nu.noticeid=#{nu.noticeid}
42
+        <if test="nu.noticetype!=null and nu.noticetype==2">and nu.classid is null</if>
43
+        <if test="nu.noticetype!=null and nu.noticetype==3">and nu.subjectid is null</if>
44
+        <if test="nu.gradeid!=null and nu.gradeid!=0">and nu.gradeid=#{nu.gradeid}</if>
45
+        <if test="nu.subjectid!=null and nu.subjectid!=''">and nu.subjectid=#{nu.subjectid}</if>
46
+        <if test="nu.classid!=null and nu.classid!=0">and nu.classid=#{nu.classid}</if>
47
+        <if test="nu.readed!=null and nu.readed!=-1">and nu.readed=#{nu.readed}</if>
48
+        <if test="nu.username!=null and nu.username!=''">and u.username like '%${nu.username}%'</if>
41
     </select>
49
     </select>
42
 </mapper>
50
 </mapper>

Loading…
Cancel
Save