提交 b1c96b9c authored 作者: Matrix's avatar Matrix

feat(CRUD): 优化了查询不到数据的错误处理

上级 5320067f
package org.matrix.database.vo; package org.matrix.database.vo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -9,6 +10,7 @@ import java.util.function.Predicate; ...@@ -9,6 +10,7 @@ import java.util.function.Predicate;
/** /**
* @author mry * @author mry
*/ */
@Slf4j
public class CommonResult { public class CommonResult {
/** /**
...@@ -84,6 +86,7 @@ public class CommonResult { ...@@ -84,6 +86,7 @@ public class CommonResult {
*/ */
@SuppressWarnings(value = "all") @SuppressWarnings(value = "all")
public static <T> ResponseEntity<CommonResultObj<T>> failed(T data, HttpHeaders headers) { public static <T> ResponseEntity<CommonResultObj<T>> failed(T data, HttpHeaders headers) {
log.warn("[接口错误] 错误数据 {} 错误头信息 {}", data, headers);
return new ResponseEntity(new CommonResultObj(data), headers, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity(new CommonResultObj(data), headers, HttpStatus.INTERNAL_SERVER_ERROR);
} }
...@@ -95,6 +98,7 @@ public class CommonResult { ...@@ -95,6 +98,7 @@ public class CommonResult {
*/ */
@SuppressWarnings(value = "all") @SuppressWarnings(value = "all")
public static <T> ResponseEntity<CommonResultObj<T>> failed(T data, String message) { public static <T> ResponseEntity<CommonResultObj<T>> failed(T data, String message) {
log.warn("[接口错误] 错误数据 {} 错误信息 {}", data, message);
return ResponseEntity.status(500).body(new CommonResultObj<>(data, message)); return ResponseEntity.status(500).body(new CommonResultObj<>(data, message));
} }
...@@ -105,6 +109,7 @@ public class CommonResult { ...@@ -105,6 +109,7 @@ public class CommonResult {
*/ */
@SuppressWarnings(value = "all") @SuppressWarnings(value = "all")
public static <T> ResponseEntity<CommonResultObj<T>> failed(String message) { public static <T> ResponseEntity<CommonResultObj<T>> failed(String message) {
log.warn("[接口错误] 错误信息 {}", message);
return ResponseEntity.status(500).body(new CommonResultObj<>(null, message)); return ResponseEntity.status(500).body(new CommonResultObj<>(null, message));
} }
...@@ -115,6 +120,7 @@ public class CommonResult { ...@@ -115,6 +120,7 @@ public class CommonResult {
*/ */
@SuppressWarnings(value = "all") @SuppressWarnings(value = "all")
public static <T> ResponseEntity<CommonResultObj<T>> failed(T data) { public static <T> ResponseEntity<CommonResultObj<T>> failed(T data) {
log.warn("[接口错误] 错误数据 {}", data);
return ResponseEntity.status(500).body(new CommonResultObj<>(data)); return ResponseEntity.status(500).body(new CommonResultObj<>(data));
} }
......
...@@ -54,9 +54,7 @@ public class ConnectController { ...@@ -54,9 +54,7 @@ public class ConnectController {
.like(StringUtils.hasLength(name) .like(StringUtils.hasLength(name)
, Connect::getName, name))).orElse(new Page<>()); , Connect::getName, name))).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
...@@ -55,9 +55,7 @@ public class DynamicVariableController { ...@@ -55,9 +55,7 @@ public class DynamicVariableController {
.like(StringUtils.hasLength(name) .like(StringUtils.hasLength(name)
, DynamicVariable::getName, name))).orElse(new Page<>()); , DynamicVariable::getName, name))).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
...@@ -55,9 +55,7 @@ public class EnvironmentController { ...@@ -55,9 +55,7 @@ public class EnvironmentController {
.like(StringUtils.hasLength(name) .like(StringUtils.hasLength(name)
, Environment::getName, name))).orElse(new Page<>()); , Environment::getName, name))).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
...@@ -3,10 +3,12 @@ package org.matrix.autotest.controller; ...@@ -3,10 +3,12 @@ package org.matrix.autotest.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.*; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.matrix.autotest.utils.PageTools; import org.matrix.autotest.utils.PageTools;
import org.matrix.database.entity.ExecutionHistory; import org.matrix.database.entity.ExecutionHistory;
import org.matrix.database.entity.ExecutionRecord;
import org.matrix.database.entity.TestData; import org.matrix.database.entity.TestData;
import org.matrix.database.service.IExecutionHistoryService; import org.matrix.database.service.IExecutionHistoryService;
import org.matrix.database.service.ITestDataService; import org.matrix.database.service.ITestDataService;
...@@ -19,7 +21,6 @@ import org.springframework.http.ResponseEntity; ...@@ -19,7 +21,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -42,14 +43,14 @@ public class ExecutionHistoryController { ...@@ -42,14 +43,14 @@ public class ExecutionHistoryController {
this.executionHistoryService = executionHistoryService; this.executionHistoryService = executionHistoryService;
} }
@ApiOperation(value = "分页查询执行历史详情",notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId") @ApiOperation(value = "分页查询执行历史详情", notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId")
@GetMapping("/executionHistoryDetail") @GetMapping("/executionHistoryDetail")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="pageSize",value="页码",required=true,paramType="query"), @ApiImplicitParam(name = "pageSize", value = "页码", required = true, paramType = "query"),
@ApiImplicitParam(name="pageNum",value="当前页显示调试",required=true,paramType="query"), @ApiImplicitParam(name = "pageNum", value = "当前页显示调试", required = true, paramType = "query"),
@ApiImplicitParam(name="uniqueKey",value="执行历史批次号",paramType="query"), @ApiImplicitParam(name = "uniqueKey", value = "执行历史批次号", paramType = "query"),
@ApiImplicitParam(name="jobId",value="测试任务ID",paramType="query"), @ApiImplicitParam(name = "jobId", value = "测试任务ID", paramType = "query"),
@ApiImplicitParam(name="caseId",value="测试用例ID",paramType="query") @ApiImplicitParam(name = "caseId", value = "测试用例ID", paramType = "query")
}) })
public ResponseEntity<CommonResultObj<IPage<ExecutionHistoryVo>>> executionHistoryDetail( public ResponseEntity<CommonResultObj<IPage<ExecutionHistoryVo>>> executionHistoryDetail(
@RequestParam(defaultValue = "10") int pageSize, @RequestParam(defaultValue = "10") int pageSize,
...@@ -57,11 +58,11 @@ public class ExecutionHistoryController { ...@@ -57,11 +58,11 @@ public class ExecutionHistoryController {
@RequestParam(defaultValue = "-1") Long jobId, @RequestParam(defaultValue = "-1") Long jobId,
Long caseId, Long caseId,
String uniqueKey String uniqueKey
){ ) {
Page<ExecutionHistory> results = Optional.of(executionHistoryService.page(Page.of(pageNum, pageSize) Page<ExecutionHistory> results = Optional.of(executionHistoryService.page(Page.of(pageNum, pageSize)
, Wrappers.lambdaQuery(ExecutionHistory.class) , Wrappers.lambdaQuery(ExecutionHistory.class)
.eq(jobId!=null, ExecutionHistory::getJobId, jobId) .eq(jobId != null, ExecutionHistory::getJobId, jobId)
.eq(caseId!=null, ExecutionHistory::getCaseId, caseId ) .eq(caseId != null, ExecutionHistory::getCaseId, caseId)
.eq(StringUtils.hasLength(uniqueKey), ExecutionHistory::getUniqueKey, uniqueKey) .eq(StringUtils.hasLength(uniqueKey), ExecutionHistory::getUniqueKey, uniqueKey)
)).orElse(new Page<>()); )).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
...@@ -76,19 +77,17 @@ public class ExecutionHistoryController { ...@@ -76,19 +77,17 @@ public class ExecutionHistoryController {
Page<ExecutionHistoryVo> resultPage = new Page<>(); Page<ExecutionHistoryVo> resultPage = new Page<>();
BeanUtils.copyProperties(results, resultPage); BeanUtils.copyProperties(results, resultPage);
resultPage.setRecords(collect); resultPage.setRecords(collect);
return resultPage.getRecords().size() != 0 return CommonResult.success(resultPage, "查询成功");
? CommonResult.success(resultPage, "查询成功")
: CommonResult.failed(resultPage, "查询失败或无数据");
} }
@ApiOperation(value = "分页查询执行历史缩略",notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId") @ApiOperation(value = "分页查询执行历史缩略", notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId")
@GetMapping("/executionHistory") @GetMapping("/executionHistory")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="pageSize",value="页码",required=true,paramType="query"), @ApiImplicitParam(name = "pageSize", value = "页码", required = true, paramType = "query"),
@ApiImplicitParam(name="pageNum",value="当前页显示调试",required=true,paramType="query"), @ApiImplicitParam(name = "pageNum", value = "当前页显示调试", required = true, paramType = "query"),
@ApiImplicitParam(name="jobId",value="测试任务ID",paramType="query"), @ApiImplicitParam(name = "jobId", value = "测试任务ID", paramType = "query"),
@ApiImplicitParam(name="caseId",value="测试用例ID",paramType="query"), @ApiImplicitParam(name = "caseId", value = "测试用例ID", paramType = "query"),
@ApiImplicitParam(name="uniqueKey",value="执行历史批次号",paramType="query"), @ApiImplicitParam(name = "uniqueKey", value = "执行历史批次号", paramType = "query"),
}) })
public ResponseEntity<CommonResultObj<IPage<ExecutionHistoryVo>>> findExecutionHistory( public ResponseEntity<CommonResultObj<IPage<ExecutionHistoryVo>>> findExecutionHistory(
@RequestParam(defaultValue = "10") int pageSize, @RequestParam(defaultValue = "10") int pageSize,
...@@ -96,27 +95,23 @@ public class ExecutionHistoryController { ...@@ -96,27 +95,23 @@ public class ExecutionHistoryController {
@RequestParam(defaultValue = "-1") Long jobId, @RequestParam(defaultValue = "-1") Long jobId,
Long caseId, Long caseId,
String uniqueKey String uniqueKey
){ ) {
IPage<ExecutionHistoryVo> page = executionHistoryService.pageExecutionHistoryVoByCaseIdAndJobId(caseId, jobId,uniqueKey, pageNum, pageSize); IPage<ExecutionHistoryVo> page = executionHistoryService.pageExecutionHistoryVoByCaseIdAndJobId(caseId, jobId, uniqueKey, pageNum, pageSize);
return page.getRecords().size() != 0 return CommonResult.success(page, "查询成功");
? CommonResult.success(page, "查询成功")
: CommonResult.failed(page, "查询失败或无数据");
} }
@ApiOperation(value = "根据JobId或者caseId 取最近一次执行历史",notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId") @ApiOperation(value = "根据JobId或者caseId 取最近一次执行历史", notes = "假如查询测试用例的执行历史,请入参caseId,假如查询测试任务的执行历史,请入参jobId")
@GetMapping("/lastExecution") @GetMapping("/lastExecution")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="jobId",value="测试任务ID",paramType="query"), @ApiImplicitParam(name = "jobId", value = "测试任务ID", paramType = "query"),
@ApiImplicitParam(name="caseId",value="测试用例ID",paramType="query") @ApiImplicitParam(name = "caseId", value = "测试用例ID", paramType = "query")
}) })
public ResponseEntity<CommonResultObj<ExecutionHistoryVo>> lastExecution( public ResponseEntity<CommonResultObj<ExecutionHistoryVo>> lastExecution(
@RequestParam(defaultValue = "-1") Long jobId, @RequestParam(defaultValue = "-1") Long jobId,
Long caseId Long caseId
){ ) {
ExecutionHistoryVo result = executionHistoryService.getLastExecutionHistory(caseId, jobId); ExecutionHistoryVo result = executionHistoryService.getLastExecutionHistory(caseId, jobId);
return result!=null return CommonResult.success(result, "查询成功");
? CommonResult.success(result, "查询成功")
: CommonResult.failed(null, "查询失败或无数据");
} }
} }
package org.matrix.autotest.controller; package org.matrix.autotest.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.matrix.autotest.utils.PageTools; import org.matrix.autotest.utils.PageTools;
import org.matrix.database.entity.ExecutionRecord; import org.matrix.database.entity.ExecutionRecord;
import org.matrix.database.entity.TestJob;
import org.matrix.database.service.IExecutionRecordService; import org.matrix.database.service.IExecutionRecordService;
import org.matrix.database.service.ITestCaseService; import org.matrix.database.service.ITestCaseService;
import org.matrix.database.service.ITestDataService; import org.matrix.database.service.ITestDataService;
...@@ -21,16 +17,13 @@ import org.matrix.enums.ExecutionRecType; ...@@ -21,16 +17,13 @@ import org.matrix.enums.ExecutionRecType;
import org.matrix.exception.GlobalException; import org.matrix.exception.GlobalException;
import org.matrix.socket.enums.TestExecuteType; import org.matrix.socket.enums.TestExecuteType;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.*; import static java.util.stream.Collectors.groupingBy;
/** /**
* @author mry * @author mry
...@@ -41,16 +34,13 @@ import static java.util.stream.Collectors.*; ...@@ -41,16 +34,13 @@ import static java.util.stream.Collectors.*;
@Api(tags = "对执行记录execution_record的基本操作") @Api(tags = "对执行记录execution_record的基本操作")
public class ExecutionRecordController { public class ExecutionRecordController {
private final IExecutionRecordService executionRecordService;
final final
ITestJobService testJobService; ITestJobService testJobService;
final final
ITestCaseService testCaseService; ITestCaseService testCaseService;
final final
ITestDataService testDataService; ITestDataService testDataService;
private final IExecutionRecordService executionRecordService;
public ExecutionRecordController(IExecutionRecordService executionRecordService, ITestJobService testJobService, ITestCaseService testCaseService, ITestDataService testDataService) { public ExecutionRecordController(IExecutionRecordService executionRecordService, ITestJobService testJobService, ITestCaseService testCaseService, ITestDataService testDataService) {
this.executionRecordService = executionRecordService; this.executionRecordService = executionRecordService;
...@@ -92,9 +82,7 @@ public class ExecutionRecordController { ...@@ -92,9 +82,7 @@ public class ExecutionRecordController {
.eq(type != null, ExecutionRecord::getType, type) .eq(type != null, ExecutionRecord::getType, type)
)).orElse(new Page<>()); )).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
...@@ -117,9 +105,8 @@ public class ExecutionRecordController { ...@@ -117,9 +105,8 @@ public class ExecutionRecordController {
TestExecuteType type) { TestExecuteType type) {
List<ExecutionRecord> results = getExecutionRecords(userId, testDataId, testCaseId, uniqueKey, type); List<ExecutionRecord> results = getExecutionRecords(userId, testDataId, testCaseId, uniqueKey, type);
Map<Long, Map<Long, Map<Long, List<String>>>> resultMap = new HashMap<>(); Map<Long, Map<Long, Map<Long, List<String>>>> resultMap = new HashMap<>();
return results.size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
...@@ -144,10 +131,10 @@ public class ExecutionRecordController { ...@@ -144,10 +131,10 @@ public class ExecutionRecordController {
List<ExecutionRecordVo> list = new ArrayList<>(); List<ExecutionRecordVo> list = new ArrayList<>();
for (ExecutionRecord result : results) { for (ExecutionRecord result : results) {
ExecutionRecordVo recordVo = new ExecutionRecordVo(); ExecutionRecordVo recordVo = new ExecutionRecordVo();
BeanUtils.copyProperties(result,recordVo); BeanUtils.copyProperties(result, recordVo);
recordVo.setJobName(testJobService.getById(result.getTestJobId()).getName()); recordVo.setJobName(testJobService.getById(result.getTestJobId()).getName());
recordVo.setCaseName(testCaseService.getById(result.getTestCaseId()).getName()); recordVo.setCaseName(testCaseService.getById(result.getTestCaseId()).getName());
if (recordVo.getTestDataId()!=-1L){ if (recordVo.getTestDataId() != -1L) {
recordVo.setDataName(testDataService.getById(result.getTestDataId()).getName()); recordVo.setDataName(testDataService.getById(result.getTestDataId()).getName());
} }
list.add(recordVo); list.add(recordVo);
......
...@@ -67,9 +67,7 @@ public class MoveController { ...@@ -67,9 +67,7 @@ public class MoveController {
.like(StringUtils.hasLength(name) .like(StringUtils.hasLength(name)
, Move::getName, name))).orElse(new Page<>()); , Move::getName, name))).orElse(new Page<>());
PageTools.pageTool(pageSize, pageNum, results); PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
...@@ -42,9 +42,7 @@ public class ProjectController { ...@@ -42,9 +42,7 @@ public class ProjectController {
@GetMapping @GetMapping
public ResponseEntity<CommonResultObj<List<Project>>> findAllProjects() { public ResponseEntity<CommonResultObj<List<Project>>> findAllProjects() {
List<Project> results = Optional.ofNullable(projectService.list()).orElse(new ArrayList<>()); List<Project> results = Optional.ofNullable(projectService.list()).orElse(new ArrayList<>());
return results.size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
...@@ -77,9 +77,7 @@ public class TestCaseController { ...@@ -77,9 +77,7 @@ public class TestCaseController {
, TestCase::getName, name))).orElse(new Page<>()); , TestCase::getName, name))).orElse(new Page<>());
// TODO 暂时注解掉,关于页码超出的范围要额外处理 // TODO 暂时注解掉,关于页码超出的范围要额外处理
// PageTools.pageTool(pageSize, pageNum, results); // PageTools.pageTool(pageSize, pageNum, results);
return results.getRecords().size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
......
package org.matrix.autotest.controller; package org.matrix.autotest.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.matrix.autotest.utils.PageTools;
import org.matrix.database.entity.TestJob; import org.matrix.database.entity.TestJob;
import org.matrix.database.service.ITestJobService; import org.matrix.database.service.ITestJobService;
import org.matrix.database.vo.CommonResult; import org.matrix.database.vo.CommonResult;
import org.matrix.database.vo.CommonResultObj; import org.matrix.database.vo.CommonResultObj;
import org.matrix.database.vo.TestJobVo; import org.matrix.database.vo.TestJobVo;
import org.matrix.exception.GlobalException;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -44,9 +39,7 @@ public class TestJobController { ...@@ -44,9 +39,7 @@ public class TestJobController {
@GetMapping @GetMapping
public ResponseEntity<CommonResultObj<List<TestJob>>> findConnects() { public ResponseEntity<CommonResultObj<List<TestJob>>> findConnects() {
List<TestJob> results = Optional.ofNullable(testJobService.list()).orElse(new ArrayList<>()); List<TestJob> results = Optional.ofNullable(testJobService.list()).orElse(new ArrayList<>());
return results.size() != 0 return CommonResult.success(results, "查询成功");
? CommonResult.success(results, "查询成功")
: CommonResult.failed(results, "查询失败或无数据");
} }
/** /**
...@@ -64,9 +57,7 @@ public class TestJobController { ...@@ -64,9 +57,7 @@ public class TestJobController {
@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "1") int pageNum,
String name) { String name) {
IPage<TestJobVo> result = testJobService.pageTestJob(name, pageSize, pageNum); IPage<TestJobVo> result = testJobService.pageTestJob(name, pageSize, pageNum);
return result.getRecords().size() != 0 return CommonResult.success(result, "查询成功");
? CommonResult.success(result, "查询成功")
: CommonResult.failed(result, "查询失败或无数据");
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论