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