提交 faf7b99d authored 作者: mry's avatar mry

fix(web): 修改了entity,以及TestCaseController

上级 356e4b2d
package org.matrix.database.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* <p>
*
*
* </p>
*
* @author matrix
......@@ -28,8 +30,4 @@ public class Project extends BaseEntity {
@ApiModelProperty("项目/v2/api-docs地址")
private String projectUrl;
@JsonIgnore
@ApiModelProperty("所属的用户id")
private Integer userId;
}
......@@ -3,11 +3,14 @@ package org.matrix.database.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* <p>
*
*
* </p>
*
* @author matrix
......@@ -30,14 +33,17 @@ public class TestCase extends BaseEntity {
@ApiModelProperty("用例类型 1为http")
private Integer type;
@ApiModelProperty("详细参数")
private String detail;
@ApiModelProperty("前置行动ID组,例如:1,2,3")
private String moveBefore;
@ApiModelProperty("后置行动ID组,例如:1,2,3")
private String moveAferCase;
private String moveAfterCase;
@ApiModelProperty("测试执行后行动ID组,例如:1,2,3")
private String moveAferTest;
private String moveAfterTest;
@ApiModelProperty("用例描述")
private String des;
......
......@@ -88,8 +88,8 @@ public class TestCaseController {
List<TestData> testDataList = ofNullable(testDataService.list(Wrappers.lambdaQuery(TestData.class)
.eq(TestData::getTestCaseId, testCaseId)))
.orElse(new ArrayList<>());
TestCaseData ma = new TestCaseData(testCase, testDataList);
return CommonResult.success(ma, "查询成功");
TestCaseData testCaseData = new TestCaseData(testCase, testDataList);
return CommonResult.success(testCaseData, "查询成功");
}
/**
......@@ -101,15 +101,16 @@ public class TestCaseController {
@ApiOperation(value = "添加用例和数据组")
@PostMapping
public ResponseEntity<CommonResultObj<TestCaseData>> insertMoveAction(@RequestBody TestCaseData testCaseData) {
Boolean testCaseBoolean = Optional.of(testCaseService.save(testCaseData.getTestCase()))
Boolean testCaseBoolean = Optional.of(testCaseService.saveOrUpdate(testCaseData.getTestCase()))
.orElseThrow(GlobalException::new);
Long id = testCaseData.getTestCase().getId();
boolean testDataBoolean = false;
if (testCaseData.getTestData().size() != 0) {
for (TestData testData : testCaseData.getTestData()) {
testData.setTestCaseId(id);
}
testDataBoolean = testDataService.saveBatch(testCaseData.getTestData());
}
boolean testDataBoolean = testDataService.saveBatch(testCaseData.getTestData());
if (testCaseData.getTestData().size() == 0) {
testDataBoolean = true;
}
......@@ -156,7 +157,7 @@ public class TestCaseController {
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的用例,你提供的用例id是%d", testCaseId)));
Boolean testDataBoolean = Optional.of(testDataService.remove(Wrappers.lambdaQuery(TestData.class)
.eq(TestData::getTestCaseId, testCaseId)))
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的用例,你提供的用例id是%id", testCaseId)));
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的用例,你提供的用例id是%d", testCaseId)));
return testCaseBoolean && testDataBoolean
? CommonResult.success("删除成功")
: CommonResult.failed("删除失败或不存在");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论