|
|
|
|
@ -2,14 +2,19 @@ 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.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 |
|
|
|
|
@ -39,22 +44,29 @@ public class MailController {
|
|
|
|
|
* @return 指定信件json |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping("/list-submit") |
|
|
|
|
@ResponseBody |
|
|
|
|
public String siftList(@RequestBody String form) { |
|
|
|
|
//todo 这里根据表单数据查询数据库,记得删掉
|
|
|
|
|
System.out.println(form); |
|
|
|
|
FormData formData = JSON.parseObject(form, FormData.class); |
|
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.like(formData.getContactName() != null, "contact_name", formData.getContactName()) |
|
|
|
|
.like(formData.getContactPhone() != null, "contact_phone", formData.getContactPhone()) |
|
|
|
|
.like(formData.getContactIdCard() != null, "contact_id_card", formData.getContactIdCard()) |
|
|
|
|
.like(formData.getId() != null, "id", formData.getId()) |
|
|
|
|
.like(formData.getContent() != null, "contact_email", formData.getContent()) |
|
|
|
|
// .like(formData.getEvaluate() != null, "evaluate", formData.getEvaluate())
|
|
|
|
|
.inSql("create_time", "select * from mail where between " |
|
|
|
|
+ formData.getDate()[0] + " and " + formData.getDate()[1]); |
|
|
|
|
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()) |
|
|
|
|
.like(StringUtils.isNotEmpty(formData.getId()), Mail::getId, formData.getId()) |
|
|
|
|
.like(StringUtils.isNotEmpty(formData.getContent()), Mail::getContent, formData.getContent()); |
|
|
|
|
if (CollectionUtils.isNotEmpty(formData.getDate()) && formData.getDate().size() == 2) { |
|
|
|
|
queryWrapper.lambda().between(Mail::getCreateTime, formData.getDate().get(0), formData.getDate().get(1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JSON.toJSONString(mailMapper.selectList(queryWrapper)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询指定信件详情 |
|
|
|
|
* @param id 信件ID |
|
|
|
|
* @return 指定信件详情json |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping("/detail") |
|
|
|
|
public String detail(@RequestBody String id) { |
|
|
|
|
MailID mailID = JSON.parseObject(id, MailID.class); |
|
|
|
|
|