API:modify param for notification list

This commit is contained in:
wanjia 2022-10-25 10:01:54 +08:00
parent 2f3bdd12da
commit f29368dd58
5 changed files with 12 additions and 9 deletions

View File

@ -39,7 +39,7 @@ public interface SysNotificationMapper extends BaseMapper<SysNotification> {
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
@Param("type") int type,
@Param("source") String source,
@Param("sources") String sources,
@Param("platform") String platform,
@Param("receiver") Integer receiver,
@Param("status") Integer status);

View File

@ -40,13 +40,13 @@ public interface SysNotificationService extends IService<SysNotification> {
* @param receiver 消息接收者
* @param status 状态 -1 全部1 未读 2 已读
* @param type 类型 -1 全部 1 系统消息2 @我
* @param source
* @param sources
* @param page 页码
* @param size 页大小
* @return
*/
Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String source, Integer page, Integer size) throws Exception;
Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String sources, Integer page, Integer size) throws Exception;
/**
* @Description: 批量删除系统消息

View File

@ -73,7 +73,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
@Override
public Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String source, Integer page, Integer size) {
public Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String sources, Integer page, Integer size) {
String cacheKey = cacheKeyForPage(platform, receiver, type, status, page, size);
Object foundResult = this.redisUtil.get(cacheKey);
if (foundResult != null) {
@ -82,7 +82,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
Page<SysNotification> pageItem = new Page<SysNotification>(page, size);
List<SysNotification> sysNotificationList = baseMapper.getSysNotificationPageList(
pageItem, "", type, source, platform, receiver, status
pageItem, "", type, sources, platform, receiver, status
);
pageItem.setRecords(sysNotificationList);
this.redisUtil.set(cacheKey, pageItem);

View File

@ -202,8 +202,11 @@
<if test="status != -1">
and status = #{status}
</if>
<if test="source != null and source != ''">
and source = #{source}
<if test="sources != null and sources != ''">
and source in
<foreach collection="sources.split(',')" item="sources" open="(" separator="," close=")">
#{sources}
</foreach>
</if>
ORDER BY id DESC
</select>

View File

@ -53,7 +53,7 @@ public class NotificationController {
@RequestParam(name = "type", required = false, defaultValue = "-1") Integer type,
@ApiParam(value = "消息来源")
@RequestParam(name = "source", required = false) String source,
@RequestParam(name = "sources", required = false) String sources,
@ApiParam(value = "页码:值为-1时默认值不开启分页", required = false, defaultValue = "-1")
@RequestParam(name = "page", required = false, defaultValue = "-1") Integer page,
@ -91,7 +91,7 @@ public class NotificationController {
}
//分页的数据
Page foundPage = notificationService.getNotification(platform, receiver, status, type, source, page, size);
Page foundPage = notificationService.getNotification(platform, receiver, status, type, sources, page, size);
if (foundPage != null) {
notificationListVo.setPageNum(foundPage.getCurrent());
notificationListVo.setPageSize(foundPage.getSize());