提交 047c7faf authored 作者: mry's avatar mry

feat(web): 完善crud,按行为id查询,按项目id查询

上级 8834ac31
...@@ -119,7 +119,7 @@ public class ActionController { ...@@ -119,7 +119,7 @@ public class ActionController {
* @return 符合项目id的动作 * @return 符合项目id的动作
*/ */
@ApiOperation(value = "根据项目id查询所有") @ApiOperation(value = "根据项目id查询所有")
@GetMapping("/{projectId}") @GetMapping("/project/{projectId}")
public CommonResult<List<Action>> findByProjectIdAction(@PathVariable Integer projectId) { public CommonResult<List<Action>> findByProjectIdAction(@PathVariable Integer projectId) {
List<Action> results = actionService.findByProjectIdAction(projectId); List<Action> results = actionService.findByProjectIdAction(projectId);
if (results != null && results.size() != 0) { if (results != null && results.size() != 0) {
...@@ -127,9 +127,24 @@ public class ActionController { ...@@ -127,9 +127,24 @@ public class ActionController {
} else { } else {
return CommonResult.failed("查询失败或无数据"); return CommonResult.failed("查询失败或无数据");
} }
//todo 未完成
} }
/**
* 根据行为id查询动作
*
* @param moveId 行为id
* @return 符合行为id的动作
*/
@ApiOperation(value = "根据行为id查询所有")
@GetMapping("/move/{moveId}")
public CommonResult<List<Action>> findByMoveIdAction(@PathVariable Integer moveId) {
List<Action> results = actionService.findByMoveIdAction(moveId);
if (results != null && results.size() != 0) {
return CommonResult.success(results);
} else {
return CommonResult.failed("查询失败或无数据");
}
}
} }
...@@ -112,4 +112,21 @@ public class DynamicVariableController { ...@@ -112,4 +112,21 @@ public class DynamicVariableController {
} }
} }
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation(value = "根据项目id查询所有")
@GetMapping("/project/{projectId}")
public CommonResult<List<DynamicVariable>> findByProjectIdDynamicVariable(@PathVariable Integer projectId) {
List<DynamicVariable> results = dynamicVariableService.findByProjectIdDynamicVariable(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results);
} else {
return CommonResult.failed("查询失败或无数据");
}
}
} }
\ No newline at end of file
...@@ -112,5 +112,22 @@ public class EnvironmentController { ...@@ -112,5 +112,22 @@ public class EnvironmentController {
} }
} }
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation(value = "根据项目id查询所有")
@GetMapping("/project/{projectId}")
public CommonResult<List<Environment>> findByProjectIdEnvironment(@PathVariable Integer projectId) {
List<Environment> results = environmentService.findByProjectIdEnvironment(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results);
} else {
return CommonResult.failed("查询失败或无数据");
}
}
} }
...@@ -112,5 +112,22 @@ public class MoveController { ...@@ -112,5 +112,22 @@ public class MoveController {
} }
} }
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation(value = "根据项目id查询所有")
@GetMapping("/project/{projectId}")
public CommonResult<List<Move>> findByProjectIdMove(@PathVariable Integer projectId) {
List<Move> results = moveService.findByProjectIdMove(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results);
} else {
return CommonResult.failed("查询失败或无数据");
}
}
} }
...@@ -37,9 +37,9 @@ public class TestCaseController { ...@@ -37,9 +37,9 @@ public class TestCaseController {
@GetMapping @GetMapping
public CommonResult<List<TestCase>> findAllTestCase() { public CommonResult<List<TestCase>> findAllTestCase() {
List<TestCase> results = testCaseService.findAllTestCase(); List<TestCase> results = testCaseService.findAllTestCase();
if(results != null && results.size() != 0){ if (results != null && results.size() != 0) {
return CommonResult.success(results); return CommonResult.success(results);
}else { } else {
return CommonResult.failed("查询失败或无数据"); return CommonResult.failed("查询失败或无数据");
} }
} }
...@@ -54,9 +54,9 @@ public class TestCaseController { ...@@ -54,9 +54,9 @@ public class TestCaseController {
@GetMapping("/{id}") @GetMapping("/{id}")
public CommonResult<TestCase> findByIdTestCase(@PathVariable Integer id) { public CommonResult<TestCase> findByIdTestCase(@PathVariable Integer id) {
TestCase result = testCaseService.findByIdTestCase(id); TestCase result = testCaseService.findByIdTestCase(id);
if (result != null){ if (result != null) {
return CommonResult.success(result); return CommonResult.success(result);
}else { } else {
return CommonResult.failed("查询失败或无数据"); return CommonResult.failed("查询失败或无数据");
} }
} }
...@@ -71,9 +71,9 @@ public class TestCaseController { ...@@ -71,9 +71,9 @@ public class TestCaseController {
@PostMapping @PostMapping
public CommonResult<TestCase> insertTestCase(@RequestBody TestCase testCase) { public CommonResult<TestCase> insertTestCase(@RequestBody TestCase testCase) {
int i = testCaseService.insertTestCase(testCase); int i = testCaseService.insertTestCase(testCase);
if (i != 0){ if (i != 0) {
return CommonResult.success(testCase); return CommonResult.success(testCase);
}else { } else {
return CommonResult.failed("添加失败"); return CommonResult.failed("添加失败");
} }
} }
...@@ -88,9 +88,9 @@ public class TestCaseController { ...@@ -88,9 +88,9 @@ public class TestCaseController {
@PutMapping("/{id}") @PutMapping("/{id}")
public CommonResult<TestCase> updateTestCase(@RequestBody TestCase testCase) { public CommonResult<TestCase> updateTestCase(@RequestBody TestCase testCase) {
int i = testCaseService.updateTestCase(testCase); int i = testCaseService.updateTestCase(testCase);
if (i != 0){ if (i != 0) {
return CommonResult.success(testCase); return CommonResult.success(testCase);
}else { } else {
return CommonResult.failed("修改失败"); return CommonResult.failed("修改失败");
} }
} }
...@@ -105,12 +105,29 @@ public class TestCaseController { ...@@ -105,12 +105,29 @@ public class TestCaseController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public CommonResult<TestCase> deleteTestCase(@PathVariable Integer id) { public CommonResult<TestCase> deleteTestCase(@PathVariable Integer id) {
int i = testCaseService.deleteTestCase(id); int i = testCaseService.deleteTestCase(id);
if (i != 0){ if (i != 0) {
return CommonResult.success("删除成功"); return CommonResult.success("删除成功");
}else { } else {
return CommonResult.failed("删除失败,或不存在需要删除的数据"); return CommonResult.failed("删除失败,或不存在需要删除的数据");
} }
} }
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
@ApiOperation(value = "根据项目id查询所有")
@GetMapping("/project/{projectId}")
public CommonResult<List<TestCase>> findByProjectIdTestCase(@PathVariable Integer projectId) {
List<TestCase> results = testCaseService.findByProjectIdTestCase(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results);
} else {
return CommonResult.failed("查询失败或无数据");
}
}
} }
...@@ -2,6 +2,7 @@ package org.matrix.autotest.service; ...@@ -2,6 +2,7 @@ package org.matrix.autotest.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.matrix.autotest.entity.Action; import org.matrix.autotest.entity.Action;
import org.matrix.autotest.entity.Move;
import java.util.List; import java.util.List;
...@@ -62,4 +63,12 @@ public interface ActionService extends IService<Action> { ...@@ -62,4 +63,12 @@ public interface ActionService extends IService<Action> {
*/ */
List<Action> findByProjectIdAction(Integer projectId); List<Action> findByProjectIdAction(Integer projectId);
/**
* 根据行为id查询动作
*
* @param moveId 行为id
* @return 符合行为id的动作
*/
List<Action> findByMoveIdAction(Integer moveId);
} }
...@@ -53,4 +53,12 @@ public interface DynamicVariableService extends IService<DynamicVariable> { ...@@ -53,4 +53,12 @@ public interface DynamicVariableService extends IService<DynamicVariable> {
*/ */
int deleteDynamicVariable(Integer id); int deleteDynamicVariable(Integer id);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List<DynamicVariable> findByProjectIdDynamicVariable(Integer projectId);
} }
...@@ -53,4 +53,12 @@ public interface EnvironmentService extends IService<Environment> { ...@@ -53,4 +53,12 @@ public interface EnvironmentService extends IService<Environment> {
*/ */
int deleteEnvironment(Integer id); int deleteEnvironment(Integer id);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List<Environment> findByProjectIdEnvironment(Integer projectId);
} }
...@@ -58,4 +58,11 @@ public class ActionServiceImpl extends ServiceImpl<ActionMapper, Action> impleme ...@@ -58,4 +58,11 @@ public class ActionServiceImpl extends ServiceImpl<ActionMapper, Action> impleme
return actionMapper.selectList(queryWrapper); return actionMapper.selectList(queryWrapper);
} }
@Override
public List<Action> findByMoveIdAction(Integer moveId) {
QueryWrapper<Action> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("move_id", moveId);
return actionMapper.selectList(queryWrapper);
}
} }
package org.matrix.autotest.service.Impl; package org.matrix.autotest.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.matrix.autotest.dao.DynamicVariableMapper; import org.matrix.autotest.dao.DynamicVariableMapper;
import org.matrix.autotest.entity.DynamicVariable; import org.matrix.autotest.entity.DynamicVariable;
...@@ -51,4 +52,11 @@ public class DynamicVariableServiceImpl extends ServiceImpl<DynamicVariableMappe ...@@ -51,4 +52,11 @@ public class DynamicVariableServiceImpl extends ServiceImpl<DynamicVariableMappe
return dynamicVariableMapper.deleteById(id); return dynamicVariableMapper.deleteById(id);
} }
@Override
public List<DynamicVariable> findByProjectIdDynamicVariable(Integer projectId) {
QueryWrapper<DynamicVariable> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("project_id", projectId);
return dynamicVariableMapper.selectList(queryWrapper);
}
} }
package org.matrix.autotest.service.Impl; package org.matrix.autotest.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.matrix.autotest.dao.EnvironmentMapper; import org.matrix.autotest.dao.EnvironmentMapper;
import org.matrix.autotest.entity.Environment; import org.matrix.autotest.entity.Environment;
...@@ -50,4 +51,11 @@ public class EnvironmentServiceImpl extends ServiceImpl<EnvironmentMapper, Envir ...@@ -50,4 +51,11 @@ public class EnvironmentServiceImpl extends ServiceImpl<EnvironmentMapper, Envir
return environmentMapper.deleteById(id); return environmentMapper.deleteById(id);
} }
@Override
public List<Environment> findByProjectIdEnvironment(Integer projectId) {
QueryWrapper<Environment> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("project_id", projectId);
return environmentMapper.selectList(queryWrapper);
}
} }
package org.matrix.autotest.service.Impl; package org.matrix.autotest.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.matrix.autotest.dao.MoveMapper; import org.matrix.autotest.dao.MoveMapper;
import org.matrix.autotest.entity.Move; import org.matrix.autotest.entity.Move;
...@@ -50,4 +51,11 @@ public class MoveServiceImpl extends ServiceImpl<MoveMapper, Move> implements Mo ...@@ -50,4 +51,11 @@ public class MoveServiceImpl extends ServiceImpl<MoveMapper, Move> implements Mo
return moveMapper.deleteById(id); return moveMapper.deleteById(id);
} }
@Override
public List<Move> findByProjectIdMove(Integer projectId) {
QueryWrapper<Move> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("project_id", projectId);
return moveMapper.selectList(queryWrapper);
}
} }
package org.matrix.autotest.service.Impl; package org.matrix.autotest.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.matrix.autotest.dao.TestCaseMapper; import org.matrix.autotest.dao.TestCaseMapper;
import org.matrix.autotest.entity.TestCase; import org.matrix.autotest.entity.TestCase;
...@@ -50,4 +51,11 @@ public class TestCaseServiceImpl extends ServiceImpl<TestCaseMapper, TestCase> i ...@@ -50,4 +51,11 @@ public class TestCaseServiceImpl extends ServiceImpl<TestCaseMapper, TestCase> i
return testCaseMapper.deleteById(id); return testCaseMapper.deleteById(id);
} }
@Override
public List<TestCase> findByProjectIdTestCase(Integer projectId) {
QueryWrapper<TestCase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("project_id", projectId);
return testCaseMapper.selectList(queryWrapper);
}
} }
...@@ -53,4 +53,12 @@ public interface MoveService extends IService<Move> { ...@@ -53,4 +53,12 @@ public interface MoveService extends IService<Move> {
*/ */
int deleteMove(Integer id); int deleteMove(Integer id);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List<Move> findByProjectIdMove(Integer projectId);
} }
...@@ -53,4 +53,12 @@ public interface TestCaseService extends IService<TestCase> { ...@@ -53,4 +53,12 @@ public interface TestCaseService extends IService<TestCase> {
*/ */
int deleteTestCase(Integer id); int deleteTestCase(Integer id);
/**
* 根据项目id查询动作
*
* @param projectId 项目id
* @return 符合项目id的动作
*/
List<TestCase> findByProjectIdTestCase(Integer projectId);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论