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

fix(base): 修改了entity

上级 d3e6a4b5
......@@ -24,6 +24,9 @@ import lombok.NoArgsConstructor;
@ApiModel(value = "TestData对象", description = "测试用例用到的数据组")
public class TestData extends BaseEntity {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("是否进行异常检验,0为否,1为是")
private Integer abnormalCheckpoint = 0;
......
......@@ -48,9 +48,9 @@ public class MoveController {
/**
* 分页查询所有行为
*
* @param pageSize 每页多少条数据
* @param pageNum 当前第几页
* @param name 行为名称
* @param pageSize 每页多少条数据
* @param pageNum 当前第几页
* @param name 行为名称
* @param projectId 项目id
* @return 分页查询的结果, 行为
*/
......@@ -137,7 +137,7 @@ public class MoveController {
);
Boolean saveOrUpdate = Optional.of(actionService.saveOrUpdateBatch(moveAction.getAction()))
.orElseThrow(() -> new GlobalException("修改失败"));
return update && saveOrUpdate && delete
return update && saveOrUpdate
? CommonResult.success(moveAction, "修改成功")
: CommonResult.failed(moveAction, "修改失败");
}
......@@ -154,7 +154,7 @@ public class MoveController {
Boolean moveBoolean = Optional.of(moveService.removeById(moveId))
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的行为,你提供的行为id是%d", moveId)));
Boolean actionBoolean = Optional.of(actionService.remove(Wrappers.lambdaQuery(Action.class)
.eq(Action::getMoveId, moveId)))
.eq(moveId != 0, Action::getMoveId, moveId)))
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的行为,你提供的行为id是%d", moveId)));
return moveBoolean && actionBoolean
? CommonResult.success("删除成功")
......
......@@ -57,7 +57,7 @@ public class TestCaseController {
*/
@ApiOperation(value = "分页查询用例")
@GetMapping("/{projectId}")
public ResponseEntity<CommonResultObj<Page<TestCase>>> findPageConnects(
public ResponseEntity<CommonResultObj<Page<TestCase>>> findPageTestCase(
int pageSize,
int pageNum,
String name, @PathVariable Long projectId) {
......@@ -78,7 +78,7 @@ public class TestCaseController {
*/
@ApiOperation(value = "根据用例id查,用例以及,用例下的数据组")
@GetMapping("/testCase/{testCaseId}")
public ResponseEntity<CommonResultObj<TestCaseData>> findByIdMoveAction(@PathVariable Long testCaseId) {
public ResponseEntity<CommonResultObj<TestCaseData>> findByIdTestCaseData(@PathVariable Long testCaseId) {
TestCase byId = testCaseService.getById(testCaseId);
if (byId == null) {
throw new GlobalException("不存在用例");
......@@ -100,7 +100,7 @@ public class TestCaseController {
*/
@ApiOperation(value = "添加用例和数据组")
@PostMapping
public ResponseEntity<CommonResultObj<TestCaseData>> insertMoveAction(@RequestBody TestCaseData testCaseData) {
public ResponseEntity<CommonResultObj<TestCaseData>> insertTestCaseData(@RequestBody TestCaseData testCaseData) {
Boolean testCaseBoolean = Optional.of(testCaseService.saveOrUpdate(testCaseData.getTestCase()))
.orElseThrow(GlobalException::new);
Long id = testCaseData.getTestCase().getId();
......@@ -127,19 +127,19 @@ public class TestCaseController {
*/
@ApiOperation(value = "修改用例以及数据组")
@PutMapping
public ResponseEntity<CommonResultObj<TestCaseData>> updateMoveAction(@RequestBody TestCaseData testCaseData) {
public ResponseEntity<CommonResultObj<TestCaseData>> updateTestCaseData(@RequestBody TestCaseData testCaseData) {
Boolean update = Optional.of(testCaseService.updateById(testCaseData.getTestCase()))
.orElseThrow(GlobalException::new);
Boolean delete = Optional.of(testDataService.remove(Wrappers.lambdaQuery(TestData.class)
.eq(TestData::getTestCaseId, testCaseData.getTestCase().getId())))
.orElseThrow(() -> new GlobalException("删除失败"));
Long id = testCaseData.getTestCase().getId();
testCaseData.getTestData().forEach(
action -> action.setTestCaseId(id)
);
Boolean delete = Optional.of(testDataService.remove(Wrappers.lambdaQuery(TestData.class)
.eq(TestData::getTestCaseId, testCaseData.getTestCase().getId())))
.orElseThrow(GlobalException::new);
Boolean saveOrUpdate = Optional.of(testDataService.saveOrUpdateBatch(testCaseData.getTestData()))
.orElseThrow(() -> new GlobalException("修改失败"));
return update && saveOrUpdate && delete
.orElseThrow(() -> new GlobalException("失败"));
return update && saveOrUpdate
? CommonResult.success(testCaseData, "修改成功")
: CommonResult.failed(testCaseData, "修改失败");
}
......@@ -152,12 +152,12 @@ public class TestCaseController {
*/
@ApiOperation(value = "删除行用例和数据组")
@DeleteMapping("/{testCaseId}")
public ResponseEntity<CommonResultObj<MoveAction>> deleteMoveAction(@PathVariable Long testCaseId) {
public ResponseEntity<CommonResultObj<MoveAction>> deleteTestCaseData(@PathVariable Long testCaseId) {
Boolean testCaseBoolean = Optional.of(testCaseService.removeById(testCaseId))
.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是%d", testCaseId)));
.orElseThrow(() -> new GlobalException(String.format("没有查到指定的数据组,你提供的数据组id是%d", testCaseId)));
return testCaseBoolean && testDataBoolean
? CommonResult.success("删除成功")
: CommonResult.failed("删除失败或不存在");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论