| | |
| | | package com.ycl.service.message.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.mail.internet.MimeMessage; |
| | | import javax.xml.ws.Response; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Page<Message> queryMyMessage(Page<Message> page, Long userId) { |
| | | List<Message> list = list(); |
| | | ArrayList<Long> ids = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | | String targetTo = item.getTargetTo(); |
| | | if (StringUtils.isNotBlank(targetTo)) { |
| | | String[] split = targetTo.split(","); |
| | | for (String s : split) { |
| | | if (userId.equals(Long.getLong(s))) { |
| | | ids.add(item.getId()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return new Page<>(); |
| | | } |
| | | return baseMapper.selectPage(page, new QueryWrapper<Message>().lambda().in(Message::getId, ids)); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean deleteMessages(List<Long> ids) { |
| | | LambdaQueryWrapper<Message> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(Message::getId, ids).or().in(Message::getParentId, ids); |