Browse Source

查询和详情页信息已完成

dev_ycq
21819 2 years ago
parent
commit
c28a598834
  1. 30
      mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java
  2. 4
      mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java

30
mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java

@ -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);

4
mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java

@ -2,9 +2,11 @@ package com.biutag.outeradmin.entity;
import lombok.Data;
import java.util.List;
@Data
public class FormData {
private String[] date;
private List<String> date;
private String contactName;
private String contactPhone;
private String contactIdCard;

Loading…
Cancel
Save