mirror of https://gitee.com/stylefeng/roses
【notice\message】增加message消息未读数量接口
parent
c869c7fcff
commit
cade0ff94e
|
@ -121,4 +121,25 @@ public interface MessageApi {
|
|||
*/
|
||||
List<MessageResponse> queryListCurrentUser(MessageParam messageParam);
|
||||
|
||||
/**
|
||||
* 查询系统消息数量
|
||||
*
|
||||
* @param messageParam 查询参数
|
||||
* @return 系统消息数量
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/11 21:21
|
||||
*/
|
||||
Integer queryCount(MessageParam messageParam);
|
||||
|
||||
/**
|
||||
* 查询系统消息数量,当前登录用户
|
||||
*
|
||||
* @param messageParam 查询参数
|
||||
* @return 系统消息数量
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/11 21:21
|
||||
*/
|
||||
Integer queryCountCurrentUser(MessageParam messageParam);
|
||||
|
||||
|
||||
}
|
|
@ -15,7 +15,9 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统消息控制器
|
||||
|
@ -117,4 +119,20 @@ public class SysMessageController {
|
|||
return new SuccessResponseData(messageApi.queryListCurrentUser(messageParam));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 系统消息未读数量
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/11 19:50
|
||||
*/
|
||||
@GetResource(name = "系统消息列表", path = "/sysMessage/unReadCount")
|
||||
public ResponseData msgUnRead(MessageParam messageParam) {
|
||||
messageParam.setReadFlag(MessageReadFlagEnum.UNREAD.getCode());
|
||||
Integer messageCount = messageApi.queryCountCurrentUser(messageParam);
|
||||
Map<String, Object> msgMap = new HashMap<>(1);
|
||||
msgMap.put("msgUnReadCount", messageCount);
|
||||
return new SuccessResponseData(messageApi.queryListCurrentUser(messageParam));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -194,4 +194,19 @@ public class MessageDbServiceImpl implements MessageApi {
|
|||
messageParam.setReceiveUserId(loginUser.getUserId());
|
||||
return this.queryList(messageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer queryCount(MessageParam messageParam) {
|
||||
return sysMessageService.count(messageParam);
|
||||
}
|
||||
@Override
|
||||
public Integer queryCountCurrentUser(MessageParam messageParam) {
|
||||
if (ObjectUtil.isEmpty(messageParam)) {
|
||||
messageParam = new MessageParam();
|
||||
}
|
||||
// 获取当前登录人
|
||||
LoginUser loginUser = LoginContext.me().getLoginUser();
|
||||
messageParam.setReceiveUserId(loginUser.getUserId());
|
||||
return this.queryCount(messageParam);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,13 @@ public interface SysMessageService extends IService<SysMessage> {
|
|||
* @date 2021/1/8 15:21
|
||||
*/
|
||||
List<SysMessage> list(MessageParam messageParam);
|
||||
|
||||
/**
|
||||
* 数量查询
|
||||
*
|
||||
* @param messageParam 参数
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/11 19:21
|
||||
*/
|
||||
Integer count(MessageParam messageParam);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,12 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageParam);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
@Override
|
||||
public Integer count(MessageParam messageParam) {
|
||||
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageParam);
|
||||
return this.count(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建wrapper
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue