Merge remote-tracking branch 'origin/master'

This commit is contained in:
LiuY 2022-05-11 09:41:11 +08:00
commit 40864093a3
3 changed files with 15 additions and 8 deletions

View File

@ -53,12 +53,10 @@ public class MailAppController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-app-user-unread-mail") @GetMapping("get-app-user-unread-mail")
public SuccessResult getAppUserUnreadMail(@RequestHeader("token") String token){ public SuccessResultData getAppUserUnreadMail(@RequestHeader("token") String token){
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
Integer unreadCounts = mailService.getAppUserUnreadMail(token, params); Integer unreadCounts = mailService.getAppUserUnreadMail(token, params);
params.clear(); return new SuccessResultData<>(unreadCounts);
params.put("unreadCounts", unreadCounts);
return new SuccessResultData<>(params);
} }
@ApiOperation(value = "批量发送内部邮件接口", notes = "批量发送内部邮件接口") @ApiOperation(value = "批量发送内部邮件接口", notes = "批量发送内部邮件接口")

View File

@ -63,7 +63,15 @@ public class MailServiceImpl extends DefaultBaseService implements IMailService
params.clear(); params.clear();
params.put("userId", appTokenUser.getId()); params.put("userId", appTokenUser.getId());
List<MailInboxDTO> list = mailDao.listInboxMail(params); List<MailInboxDTO> list = mailDao.listInboxMail(params);
return list == null ? 0 : list.size(); int unreadCount = 0;
for(MailInboxDTO item : list){
params.put("id", item.getId());
Map<String, Object> userMailReadTag = mailDao.getUserMailReadTag(params);
if(userMailReadTag == null){
unreadCount++;
}
}
return unreadCount;
} }
@Override @Override

View File

@ -80,6 +80,7 @@
WHERE WHERE
id = #{id} id = #{id}
AND user_id = #{userId} AND user_id = #{userId}
ORDER BY read_time DESC
LIMIT 1 LIMIT 1
</select> </select>