|
@@ -1,11 +1,20 @@
|
|
|
package com.fjhx.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Assert;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.entity.EmailMailboxLink;
|
|
|
+import com.fjhx.entity.EmailMessage;
|
|
|
import com.fjhx.mapper.EmailMailboxLinkMapper;
|
|
|
import com.fjhx.service.IEmailMailboxLinkService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.vo.GetMailboxMassageListVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 邮箱文件夹 服务实现类
|
|
@@ -17,4 +26,29 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class EmailMailboxLinkServiceImpl extends ServiceImpl<EmailMailboxLinkMapper, EmailMailboxLink> implements IEmailMailboxLinkService {
|
|
|
|
|
|
+ @Override
|
|
|
+ public Page<EmailMessage> getMassageList(GetMailboxMassageListVo vo) {
|
|
|
+ Long mailboxId = vo.getMailboxId();
|
|
|
+ Assert.notNull(mailboxId, "文件夹id不能为空");
|
|
|
+
|
|
|
+ String fromName = vo.getFromName();
|
|
|
+ String fromAddress = vo.getFromAddress();
|
|
|
+ String subject = vo.getSubject();
|
|
|
+ Integer sortType = ObjectUtil.defaultIfNull(vo.getSortType(), 1);
|
|
|
+ String sortName = sortType == 1 ? "em.from_date" : "eml.create_time";
|
|
|
+
|
|
|
+ Date beginTime = vo.getBeginTime();
|
|
|
+ Date endTime = vo.getEndTime();
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<Object> query = Wrappers.query()
|
|
|
+ .eq("eml.mailbox_id", mailboxId)
|
|
|
+ .like(ObjectUtil.isNotEmpty(fromName), "em.from_name", fromName)
|
|
|
+ .like(ObjectUtil.isNotEmpty(fromAddress), "em.from_address", fromAddress)
|
|
|
+ .like(ObjectUtil.isNotEmpty(subject), "em.subject", subject)
|
|
|
+ .between(ObjectUtil.isAllNotEmpty(beginTime, endTime), sortName, beginTime, endTime)
|
|
|
+ .orderByDesc(sortName);
|
|
|
+
|
|
|
+ return baseMapper.getMassageList(vo.getPage(), query);
|
|
|
+ }
|
|
|
}
|