From 0038450b579b7a5576e57fea24b77cbf8d75c78d Mon Sep 17 00:00:00 2001 From: wans <747101512@qq.com> Date: Wed, 11 May 2022 09:40:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/api/mail/MailAppController.java | 6 ++---- .../systemoa/service/mail/impl/MailServiceImpl.java | 10 +++++++++- src/main/resources/mybatis/mapper/mail/mail-mapper.xml | 7 ++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/cn/com/tenlion/systemoa/controller/app/api/mail/MailAppController.java b/src/main/java/cn/com/tenlion/systemoa/controller/app/api/mail/MailAppController.java index b8c223d..2c347e1 100644 --- a/src/main/java/cn/com/tenlion/systemoa/controller/app/api/mail/MailAppController.java +++ b/src/main/java/cn/com/tenlion/systemoa/controller/app/api/mail/MailAppController.java @@ -53,12 +53,10 @@ public class MailAppController extends DefaultBaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-app-user-unread-mail") - public SuccessResult getAppUserUnreadMail(@RequestHeader("token") String token){ + public SuccessResultData getAppUserUnreadMail(@RequestHeader("token") String token){ Map params = requestParams(); Integer unreadCounts = mailService.getAppUserUnreadMail(token, params); - params.clear(); - params.put("unreadCounts", unreadCounts); - return new SuccessResultData<>(params); + return new SuccessResultData<>(unreadCounts); } @ApiOperation(value = "批量发送内部邮件接口", notes = "批量发送内部邮件接口") diff --git a/src/main/java/cn/com/tenlion/systemoa/service/mail/impl/MailServiceImpl.java b/src/main/java/cn/com/tenlion/systemoa/service/mail/impl/MailServiceImpl.java index a020a90..058da88 100644 --- a/src/main/java/cn/com/tenlion/systemoa/service/mail/impl/MailServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemoa/service/mail/impl/MailServiceImpl.java @@ -63,7 +63,15 @@ public class MailServiceImpl extends DefaultBaseService implements IMailService params.clear(); params.put("userId", appTokenUser.getId()); List list = mailDao.listInboxMail(params); - return list == null ? 0 : list.size(); + int unreadCount = 0; + for(MailInboxDTO item : list){ + params.put("id", item.getId()); + Map userMailReadTag = mailDao.getUserMailReadTag(params); + if(userMailReadTag == null){ + unreadCount++; + } + } + return unreadCount; } @Override diff --git a/src/main/resources/mybatis/mapper/mail/mail-mapper.xml b/src/main/resources/mybatis/mapper/mail/mail-mapper.xml index 950b271..a311d32 100644 --- a/src/main/resources/mybatis/mapper/mail/mail-mapper.xml +++ b/src/main/resources/mybatis/mapper/mail/mail-mapper.xml @@ -80,6 +80,7 @@ WHERE id = #{id} AND user_id = #{userId} + ORDER BY read_time DESC LIMIT 1 @@ -138,10 +139,10 @@