|
|
|
|
@ -3,18 +3,14 @@ package com.biutag.outeradmin.controller;
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
|
import com.biutag.outeradmin.entity.FormData; |
|
|
|
|
import com.biutag.outeradmin.entity.Mail; |
|
|
|
|
import com.biutag.outeradmin.entity.MailID; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.biutag.outeradmin.entity.*; |
|
|
|
|
import com.biutag.outeradmin.mapper.MailMapper; |
|
|
|
|
import com.biutag.outeradmin.service.MailService; |
|
|
|
|
import com.biutag.util.StringUtils; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@ -30,11 +26,15 @@ public class MailController {
|
|
|
|
|
* @return 信件列表json |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping("/list") |
|
|
|
|
public List<Mail> list() { |
|
|
|
|
List<Mail> mailList = mailService.list(); |
|
|
|
|
return mailList; |
|
|
|
|
// String result = JSON.toJSONString(mailList);
|
|
|
|
|
// return result;
|
|
|
|
|
public MailPageInfo list(@RequestBody String req) { |
|
|
|
|
PageSet pageSet = JSON.parseObject(req, PageSet.class); |
|
|
|
|
Page<Mail> page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); |
|
|
|
|
List<Mail> mailPage = mailMapper.selectPage(page, null).getRecords(); |
|
|
|
|
pageSet.setTotalSize((int) page.getTotal()); |
|
|
|
|
MailPageInfo result = new MailPageInfo(); |
|
|
|
|
result.setMails(mailPage); |
|
|
|
|
result.setPageSet(pageSet); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -44,11 +44,14 @@ public class MailController {
|
|
|
|
|
* @return 指定信件json |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping("/list-submit") |
|
|
|
|
public String siftList(@RequestBody String form) { |
|
|
|
|
public MailPageInfo siftList(@RequestBody String form) { |
|
|
|
|
//todo 这里根据表单数据查询数据库,记得删掉
|
|
|
|
|
System.out.println(form); |
|
|
|
|
FormData formData = JSON.parseObject(form, FormData.class); |
|
|
|
|
FormPage formPage = JSON.parseObject(form, FormPage.class); |
|
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
if(formPage != null && formPage.getFormData()!= null && formPage.getPageData()!= null){ |
|
|
|
|
FormData formData = formPage.getFormData(); |
|
|
|
|
|
|
|
|
|
queryWrapper.lambda().like(StringUtils.isNotEmpty(formData.getContactName()), Mail::getContactName, formData.getContactName()) |
|
|
|
|
.like(StringUtils.isNotEmpty(formData.getContactPhone()), Mail::getContactPhone, formData.getContactPhone()) |
|
|
|
|
.like(StringUtils.isNotEmpty(formData.getContactIdCard()), Mail::getContactIdCard, formData.getContactIdCard()) |
|
|
|
|
@ -57,13 +60,22 @@ public class MailController {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(formData.getDate()) && formData.getDate().size() == 2) { |
|
|
|
|
queryWrapper.lambda().between(Mail::getCreateTime, formData.getDate().get(0), formData.getDate().get(1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
PageSet pageSet = formPage.getPageData(); |
|
|
|
|
|
|
|
|
|
Page<Mail> page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); |
|
|
|
|
List<Mail> mailPage = mailMapper.selectPage(page, queryWrapper).getRecords(); |
|
|
|
|
pageSet.setTotalSize((int) page.getTotal()); |
|
|
|
|
MailPageInfo result = new MailPageInfo(); |
|
|
|
|
result.setMails(mailPage); |
|
|
|
|
result.setPageSet(pageSet); |
|
|
|
|
|
|
|
|
|
return JSON.toJSONString(mailMapper.selectList(queryWrapper)); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询指定信件详情 |
|
|
|
|
* |
|
|
|
|
* @param id 信件ID |
|
|
|
|
* @return 指定信件详情json |
|
|
|
|
*/ |
|
|
|
|
|