diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailEtlController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailEtlController.java index 95c91b0..0a9fcb1 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailEtlController.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailEtlController.java @@ -1,9 +1,9 @@ package com.biutag.outeradmin.controller; - import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.core.AjaxResult; import com.biutag.outeradmin.domain.Mail_etl; import com.biutag.outeradmin.domain.Mail_evaluate_etl; import com.biutag.outeradmin.domain.dto.MailEtlFormData; @@ -12,11 +12,8 @@ import com.biutag.outeradmin.domain.dto.Mail_etlPageInfo; import com.biutag.outeradmin.domain.dto.PageSet; import com.biutag.outeradmin.mapper.Mail_EtlMapper; import com.biutag.outeradmin.mapper.Mail_Eva_EtlMapper; -import com.biutag.outeradmin.service.MailEtlService; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -25,55 +22,59 @@ import java.util.List; @RestController public class MailEtlController { - private final MailEtlService mailEtlService; private final Mail_EtlMapper mail_EtlMapper; private final Mail_Eva_EtlMapper mail_eva_etlMapper; @RequestMapping("/list-submit") public Mail_etlPageInfo siftList(@RequestBody String form) { MailEtlFormPage mailetlFormPage = JSON.parseObject(form, MailEtlFormPage.class); MailEtlFormData mailetlFormData = mailetlFormPage.getFormData(); - if (mailetlFormPage.getSelectData().equals("mail_etl")){ - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (mailetlFormData.getMailId()!=null){ - queryWrapper.lambda().like(Mail_etl::getMailId, mailetlFormData.getMailId()); - } - if (mailetlFormData.getSuccess()!=null){ - queryWrapper.lambda().eq(Mail_etl::getSuccess, mailetlFormData.getSuccess()); - } - if (mailetlFormData.getId()!=null){ - queryWrapper.lambda().eq(Mail_etl::getId, mailetlFormData.getId()); - } - - PageSet pageSet = mailetlFormPage.getPageData(); - Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); - List mailetlPage = mail_EtlMapper.selectPage(page, queryWrapper).getRecords(); - pageSet.setTotalSize((int) page.getTotal()); - Mail_etlPageInfo result = new Mail_etlPageInfo(); - result.setMails(mailetlPage); - result.setPageSet(pageSet); - return result; - }else{ - QueryWrapper queryWrapper = new QueryWrapper<>(); - if (mailetlFormData.getMailId()!=null){ - queryWrapper.lambda().like(Mail_evaluate_etl::getMailId, mailetlFormData.getMailId()); - } - if (mailetlFormData.getSuccess()!=null){ - queryWrapper.lambda().eq(Mail_evaluate_etl::getSuccess, mailetlFormData.getSuccess()); - } - if (mailetlFormData.getId()!=null){ - queryWrapper.lambda().eq(Mail_evaluate_etl::getId, mailetlFormData.getId()); - } - - PageSet pageSet = mailetlFormPage.getPageData(); - Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); - List mailetlPage = mail_eva_etlMapper.selectPage(page, queryWrapper).getRecords(); - pageSet.setTotalSize((int) page.getTotal()); - Mail_etlPageInfo result = new Mail_etlPageInfo(); - result.setEvaMails(mailetlPage); - result.setPageSet(pageSet); - return result; + if (mailetlFormPage.getSelectData().equals("mail_etl")) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (mailetlFormData.getMailId() != null) { + queryWrapper.lambda().like(Mail_etl::getMailId, mailetlFormData.getMailId()); } + if (mailetlFormData.getSuccess() != null) { + queryWrapper.lambda().eq(Mail_etl::getSuccess, mailetlFormData.getSuccess()); + } + if (mailetlFormData.getId() != null) { + queryWrapper.lambda().eq(Mail_etl::getId, mailetlFormData.getId()); + } + queryWrapper.orderByDesc("create_time"); + PageSet pageSet = mailetlFormPage.getPageData(); + Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); + List mailetlPage = mail_EtlMapper.selectPage(page, queryWrapper).getRecords(); + pageSet.setTotalSize((int) page.getTotal()); + Mail_etlPageInfo result = new Mail_etlPageInfo(); + result.setMails(mailetlPage); + result.setPageSet(pageSet); + return result; + } else { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (mailetlFormData.getMailId() != null) { + queryWrapper.lambda().like(Mail_evaluate_etl::getMailId, mailetlFormData.getMailId()); + } + if (mailetlFormData.getSuccess() != null) { + queryWrapper.lambda().eq(Mail_evaluate_etl::getSuccess, mailetlFormData.getSuccess()); + } + if (mailetlFormData.getId() != null) { + queryWrapper.lambda().eq(Mail_evaluate_etl::getId, mailetlFormData.getId()); + } + queryWrapper.orderByDesc("create_time"); + PageSet pageSet = mailetlFormPage.getPageData(); + Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); + List mailetlPage = mail_eva_etlMapper.selectPage(page, queryWrapper).getRecords(); + pageSet.setTotalSize((int) page.getTotal()); + Mail_etlPageInfo result = new Mail_etlPageInfo(); + result.setEvaMails(mailetlPage); + result.setPageSet(pageSet); + return result; + } + } - + @DeleteMapping("{id}") + public AjaxResult updateState(@PathVariable String id) { + mail_EtlMapper.deleteById(id); + return AjaxResult.success(); } + } diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/AdminService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/AdminService.java index 2ab48c7..ec6c2da 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/AdminService.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/AdminService.java @@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; @Service public class AdminService extends ServiceImpl { - public Admin getByUsername(String username) { return getOne(new LambdaQueryWrapper().eq(Admin::getUsername, username)); }