mirror of https://gitee.com/stylefeng/roses
【message】增加批量更新系统消息接口
parent
c48f973e6b
commit
e19a0d582c
|
@ -4,8 +4,10 @@ import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统消息的查询参数
|
* 系统消息的查询参数
|
||||||
|
@ -74,4 +76,17 @@ public class MessageParam extends BaseRequest {
|
||||||
@NotNull(message = "阅读状态不能为空", groups = {updateStatus.class})
|
@NotNull(message = "阅读状态不能为空", groups = {updateStatus.class})
|
||||||
private Integer readFlag;
|
private Integer readFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id集合
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "消息id集合不能为空,请检查messageIdList参数", groups = {updateReadFlag.class})
|
||||||
|
private List<Long> messageIdList;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数校验分组:修改阅读状态
|
||||||
|
*/
|
||||||
|
public @interface updateReadFlag {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package cn.stylefeng.roses.kernel.message.modular.manage.controller;
|
package cn.stylefeng.roses.kernel.message.modular.manage.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.message.api.MessageApi;
|
import cn.stylefeng.roses.kernel.message.api.MessageApi;
|
||||||
|
import cn.stylefeng.roses.kernel.message.api.enums.MessageReadFlagEnum;
|
||||||
import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
|
import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
|
||||||
import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
|
import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
|
||||||
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
|
||||||
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
||||||
import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
|
import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -13,6 +16,9 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统消息控制器
|
* 系统消息控制器
|
||||||
*
|
*
|
||||||
|
@ -41,6 +47,19 @@ public class SysMessageController {
|
||||||
return new SuccessResponseData();
|
return new SuccessResponseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新系统消息状态
|
||||||
|
*
|
||||||
|
* @author liuhanqing
|
||||||
|
* @date 2021/1/8 13:50
|
||||||
|
*/
|
||||||
|
@PostResource(name = "批量更新系统消息状态", path = "/sysMessage/batchUpdateReadFlag")
|
||||||
|
public ResponseData sendMessage(@RequestBody @Validated(MessageParam.updateReadFlag.class) MessageParam messageParam) {
|
||||||
|
List<Long> messageIdList = messageParam.getMessageIdList();
|
||||||
|
messageApi.batchReadFlagByMessageIds(StrUtil.join(",", messageIdList), MessageReadFlagEnum.READ);
|
||||||
|
return new SuccessResponseData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统消息全部修改已读
|
* 系统消息全部修改已读
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue