|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
@@ -325,4 +326,17 @@ public class NewsController {
|
|
|
public RT<Boolean> sendMessage(@RequestParam Long id) {
|
|
|
return RT.ok(newsService.SendMessage(id));
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/unread-count")
|
|
|
+ @ApiOperation(value = "获取登录人未读消息数量")
|
|
|
+ public RT<Integer> unreadCount() {
|
|
|
+ Integer count = newsService.selectJoinCount(
|
|
|
+ new MPJLambdaWrapper<News>()
|
|
|
+ .eq(NewsRelation::getReadMark, 0)
|
|
|
+ .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
+ .eq(News::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
|
|
|
+ );
|
|
|
+ return RT.ok(count);
|
|
|
+ }
|
|
|
}
|