API:modify param for notification list
This commit is contained in:
parent
2f3bdd12da
commit
f29368dd58
|
@ -39,7 +39,7 @@ public interface SysNotificationMapper extends BaseMapper<SysNotification> {
|
||||||
|
|
||||||
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
|
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
|
||||||
@Param("type") int type,
|
@Param("type") int type,
|
||||||
@Param("source") String source,
|
@Param("sources") String sources,
|
||||||
@Param("platform") String platform,
|
@Param("platform") String platform,
|
||||||
@Param("receiver") Integer receiver,
|
@Param("receiver") Integer receiver,
|
||||||
@Param("status") Integer status);
|
@Param("status") Integer status);
|
||||||
|
|
|
@ -40,13 +40,13 @@ public interface SysNotificationService extends IService<SysNotification> {
|
||||||
* @param receiver 消息接收者
|
* @param receiver 消息接收者
|
||||||
* @param status 状态 -1 全部、1 未读 2 已读
|
* @param status 状态 -1 全部、1 未读 2 已读
|
||||||
* @param type 类型 -1 全部 1 系统消息、2 @我
|
* @param type 类型 -1 全部 1 系统消息、2 @我
|
||||||
* @param source
|
* @param sources
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param size 页大小
|
* @param size 页大小
|
||||||
* @return
|
* @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: 批量删除系统消息
|
* @Description: 批量删除系统消息
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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);
|
String cacheKey = cacheKeyForPage(platform, receiver, type, status, page, size);
|
||||||
Object foundResult = this.redisUtil.get(cacheKey);
|
Object foundResult = this.redisUtil.get(cacheKey);
|
||||||
if (foundResult != null) {
|
if (foundResult != null) {
|
||||||
|
@ -82,7 +82,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
||||||
|
|
||||||
Page<SysNotification> pageItem = new Page<SysNotification>(page, size);
|
Page<SysNotification> pageItem = new Page<SysNotification>(page, size);
|
||||||
List<SysNotification> sysNotificationList = baseMapper.getSysNotificationPageList(
|
List<SysNotification> sysNotificationList = baseMapper.getSysNotificationPageList(
|
||||||
pageItem, "", type, source, platform, receiver, status
|
pageItem, "", type, sources, platform, receiver, status
|
||||||
);
|
);
|
||||||
pageItem.setRecords(sysNotificationList);
|
pageItem.setRecords(sysNotificationList);
|
||||||
this.redisUtil.set(cacheKey, pageItem);
|
this.redisUtil.set(cacheKey, pageItem);
|
||||||
|
|
|
@ -202,8 +202,11 @@
|
||||||
<if test="status != -1">
|
<if test="status != -1">
|
||||||
and status = #{status}
|
and status = #{status}
|
||||||
</if>
|
</if>
|
||||||
<if test="source != null and source != ''">
|
<if test="sources != null and sources != ''">
|
||||||
and source = #{source}
|
and source in
|
||||||
|
<foreach collection="sources.split(',')" item="sources" open="(" separator="," close=")">
|
||||||
|
#{sources}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class NotificationController {
|
||||||
@RequestParam(name = "type", required = false, defaultValue = "-1") Integer type,
|
@RequestParam(name = "type", required = false, defaultValue = "-1") Integer type,
|
||||||
|
|
||||||
@ApiParam(value = "消息来源")
|
@ApiParam(value = "消息来源")
|
||||||
@RequestParam(name = "source", required = false) String source,
|
@RequestParam(name = "sources", required = false) String sources,
|
||||||
|
|
||||||
@ApiParam(value = "页码:值为-1时(默认值),不开启分页;", required = false, defaultValue = "-1")
|
@ApiParam(value = "页码:值为-1时(默认值),不开启分页;", required = false, defaultValue = "-1")
|
||||||
@RequestParam(name = "page", required = false, defaultValue = "-1") Integer page,
|
@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) {
|
if (foundPage != null) {
|
||||||
notificationListVo.setPageNum(foundPage.getCurrent());
|
notificationListVo.setPageNum(foundPage.getCurrent());
|
||||||
notificationListVo.setPageSize(foundPage.getSize());
|
notificationListVo.setPageSize(foundPage.getSize());
|
||||||
|
|
Loading…
Reference in New Issue