【notice\message】增加message消息未读数量接口

pull/3/head
liuhanqing 2021-01-11 20:53:26 +08:00
parent c869c7fcff
commit cade0ff94e
5 changed files with 69 additions and 0 deletions

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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
*