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

fix(base): 修改了entity

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