提交 9b546abc authored 作者: mry's avatar mry

fix(web): controller层Put请求修改

上级 d45fccad
......@@ -41,7 +41,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<List<Action>>> findAllAction() {
List<Action> results = actionService.findAllAction();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<Action>> findByIdAction(@PathVariable Integer id) {
Action result = actionService.findByIdAction(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<Action>> insertAction(@RequestBody Action action) {
int i = actionService.insertAction(action);
if (i != 0) {
return CommonResult.success(action,"添加成功");
return CommonResult.success(action, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class ActionController {
* @param action 动作
* @return 修改后的动作
*/
@ApiOperation(value = "根据id修改动作")
@PutMapping("/{id}")
@ApiOperation(value = "修改动作")
@PutMapping
public ResponseEntity<CommonResultObj<Action>> updateAction(@RequestBody Action action) {
int i = actionService.updateAction(action);
if (i != 0) {
return CommonResult.success(action,"修改成功");
return CommonResult.success(action, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<String>> deleteAction(@PathVariable Integer id) {
int i = actionService.deleteAction(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......@@ -126,7 +126,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<List<Action>>> findByProjectIdAction(@PathVariable Integer projectId) {
List<Action> results = actionService.findByProjectIdAction(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -143,7 +143,7 @@ public class ActionController {
public ResponseEntity<CommonResultObj<List<Action>>> findByMoveIdAction(@PathVariable Integer moveId) {
List<Action> results = actionService.findByMoveIdAction(moveId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......
......@@ -41,7 +41,7 @@ public class ConnectController {
public ResponseEntity<CommonResultObj<List<Connect>>> findAllConnect() {
List<Connect> results = connectService.findAllConnect();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class ConnectController {
public ResponseEntity<CommonResultObj<Connect>> findByIdConnect(@PathVariable Integer id) {
Connect result = connectService.findByIdConnect(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class ConnectController {
public ResponseEntity<CommonResultObj<Connect>> insertConnect(@RequestBody Connect connect) {
int i = connectService.insertConnect(connect);
if (i != 0) {
return CommonResult.success(connect,"添加成功");
return CommonResult.success(connect, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class ConnectController {
* @param connect 连接池
* @return 修改后的连接池
*/
@ApiOperation(value = "根据id修改连接池")
@PutMapping("/{id}")
@ApiOperation(value = "修改连接池")
@PutMapping
public ResponseEntity<CommonResultObj<Connect>> updateConnect(@RequestBody Connect connect) {
int i = connectService.updateConnect(connect);
if (i != 0) {
return CommonResult.success(connect,"修改成功");
return CommonResult.success(connect, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class ConnectController {
public ResponseEntity<CommonResultObj<String>> deleteConnect(@PathVariable Integer id) {
int i = connectService.deleteConnect(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......
......@@ -22,7 +22,7 @@ import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/dynamicVariables")
@Api(tags = "对动态变量表dynamic_variable的基本操作")
@Api(tags = "对动dynamic_variable的基本操作")
public class DynamicVariableController {
private final DynamicVariableService dynamicVariableService;
......@@ -41,7 +41,7 @@ public class DynamicVariableController {
public ResponseEntity<CommonResultObj<List<DynamicVariable>>> findAllDynamicVariable() {
List<DynamicVariable> results = dynamicVariableService.findAllDynamicVariable();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class DynamicVariableController {
public ResponseEntity<CommonResultObj<DynamicVariable>> findByIdDynamicVariable(@PathVariable Integer id) {
DynamicVariable result = dynamicVariableService.findByIdDynamicVariable(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class DynamicVariableController {
public ResponseEntity<CommonResultObj<DynamicVariable>> insertDynamicVariable(@RequestBody DynamicVariable dynamicVariable) {
int i = dynamicVariableService.insertDynamicVariable(dynamicVariable);
if (i != 0) {
return CommonResult.success(dynamicVariable,"添加成功");
return CommonResult.success(dynamicVariable, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class DynamicVariableController {
* @param dynamicVariable 动态变量
* @return 修改后的动态变量
*/
@ApiOperation(value = "根据id修改动态变量")
@PutMapping("/{id}")
@ApiOperation(value = "修改动态变量")
@PutMapping
public ResponseEntity<CommonResultObj<DynamicVariable>> updateDynamicVariable(@RequestBody DynamicVariable dynamicVariable) {
int i = dynamicVariableService.updateDynamicVariable(dynamicVariable);
if (i != 0) {
return CommonResult.success(dynamicVariable,"修改成功");
return CommonResult.success(dynamicVariable, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class DynamicVariableController {
public ResponseEntity<CommonResultObj<String>> deleteDynamicVariable(@PathVariable Integer id) {
int i = dynamicVariableService.deleteDynamicVariable(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......@@ -126,7 +126,7 @@ public class DynamicVariableController {
public ResponseEntity<CommonResultObj<List<DynamicVariable>>> findByProjectIdDynamicVariable(@PathVariable Integer projectId) {
List<DynamicVariable> results = dynamicVariableService.findByProjectIdDynamicVariable(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......
......@@ -22,7 +22,7 @@ import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/environments")
@Api(tags = "对实例表environment的基本操作")
@Api(tags = "对环境表environment的基本操作")
public class EnvironmentController {
private final EnvironmentService environmentService;
......@@ -41,7 +41,7 @@ public class EnvironmentController {
public ResponseEntity<CommonResultObj<List<Environment>>> findAllEnvironment() {
List<Environment> results = environmentService.findAllEnvironment();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class EnvironmentController {
public ResponseEntity<CommonResultObj<Environment>> findByIdEnvironment(@PathVariable Integer id) {
Environment result = environmentService.findByIdEnvironment(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class EnvironmentController {
public ResponseEntity<CommonResultObj<Environment>> insertEnvironment(@RequestBody Environment environment) {
int i = environmentService.insertEnvironment(environment);
if (i != 0) {
return CommonResult.success(environment,"添加成功");
return CommonResult.success(environment, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class EnvironmentController {
* @param environment 实例
* @return 修改后的实例
*/
@ApiOperation(value = "根据id修改实例")
@PutMapping("/{id}")
@ApiOperation(value = "修改实例")
@PutMapping
public ResponseEntity<CommonResultObj<Environment>> updateEnvironment(@RequestBody Environment environment) {
int i = environmentService.updateEnvironment(environment);
if (i != 0) {
return CommonResult.success(environment,"修改成功");
return CommonResult.success(environment, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class EnvironmentController {
public ResponseEntity<CommonResultObj<String>> deleteEnvironment(@PathVariable Integer id) {
int i = environmentService.deleteEnvironment(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......@@ -126,7 +126,7 @@ public class EnvironmentController {
public ResponseEntity<CommonResultObj<List<Environment>>> findByProjectIdEnvironment(@PathVariable Integer projectId) {
List<Environment> results = environmentService.findByProjectIdEnvironment(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......
......@@ -41,7 +41,7 @@ public class MoveController {
public ResponseEntity<CommonResultObj<List<Move>>> findAllMove() {
List<Move> results = moveService.findAllMove();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class MoveController {
public ResponseEntity<CommonResultObj<Move>> findByIdMove(@PathVariable Integer id) {
Move result = moveService.findByIdMove(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class MoveController {
public ResponseEntity<CommonResultObj<Move>> insertMove(@RequestBody Move move) {
int i = moveService.insertMove(move);
if (i != 0) {
return CommonResult.success(move,"添加成功");
return CommonResult.success(move, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class MoveController {
* @param move 行为
* @return 修改后的行为
*/
@ApiOperation(value = "根据id修改行为")
@PutMapping("/{id}")
@ApiOperation(value = "修改行为")
@PutMapping
public ResponseEntity<CommonResultObj<Move>> updateMove(@RequestBody Move move) {
int i = moveService.updateMove(move);
if (i != 0) {
return CommonResult.success(move,"修改成功");
return CommonResult.success(move, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class MoveController {
public ResponseEntity<CommonResultObj<String>> deleteMove(@PathVariable Integer id) {
int i = moveService.deleteMove(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......@@ -126,7 +126,7 @@ public class MoveController {
public ResponseEntity<CommonResultObj<List<Move>>> findByProjectIdMove(@PathVariable Integer projectId) {
List<Move> results = moveService.findByProjectIdMove(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......
......@@ -40,9 +40,9 @@ public class ProjectController {
@GetMapping
public ResponseEntity<CommonResultObj<List<Project>>> findAllProject() {
List<Project> results = projectService.findAllProject();
if (results != null && results.size() != 0){
return CommonResult.success(results,"查询成功");
}else {
if (results != null && results.size() != 0) {
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
}
......@@ -57,9 +57,9 @@ public class ProjectController {
@GetMapping("/{id}")
public ResponseEntity<CommonResultObj<Project>> findByIdProject(@PathVariable Integer id) {
Project result = projectService.findByIdProject(id);
if (result != null){
return CommonResult.success(result,"查询成功");
}else {
if (result != null) {
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
}
......@@ -74,9 +74,9 @@ public class ProjectController {
@PostMapping
public ResponseEntity<CommonResultObj<Project>> insertProject(@RequestBody Project project) {
int i = projectService.insertProject(project);
if (i != 0){
return CommonResult.success(project,"添加成功");
}else {
if (i != 0) {
return CommonResult.success(project, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
}
......@@ -87,13 +87,13 @@ public class ProjectController {
* @param project 项目
* @return 修改后的项目
*/
@ApiOperation(value = "根据id修改项目")
@PutMapping("/{id}")
@ApiOperation(value = "修改项目")
@PutMapping
public ResponseEntity<CommonResultObj<Project>> updateProject(@RequestBody Project project) {
int i = projectService.updateProject(project);
if (i != 0){
return CommonResult.success(project,"修改成功");
}else {
if (i != 0) {
return CommonResult.success(project, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
}
......@@ -108,9 +108,9 @@ public class ProjectController {
@DeleteMapping("/{id}")
public ResponseEntity<CommonResultObj<String>> deleteProject(@PathVariable Integer id) {
int i = projectService.deleteProject(id);
if (i != 0){
return CommonResult.success("id: " + id + "已删除","删除成功");
}else {
if (i != 0) {
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
}
......
......@@ -41,7 +41,7 @@ public class TestCaseController {
public ResponseEntity<CommonResultObj<List<TestCase>>> findAllTestCase() {
List<TestCase> results = testCaseService.findAllTestCase();
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -58,7 +58,7 @@ public class TestCaseController {
public ResponseEntity<CommonResultObj<TestCase>> findByIdTestCase(@PathVariable Integer id) {
TestCase result = testCaseService.findByIdTestCase(id);
if (result != null) {
return CommonResult.success(result,"查询成功");
return CommonResult.success(result, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......@@ -75,7 +75,7 @@ public class TestCaseController {
public ResponseEntity<CommonResultObj<TestCase>> insertTestCase(@RequestBody TestCase testCase) {
int i = testCaseService.insertTestCase(testCase);
if (i != 0) {
return CommonResult.success(testCase,"添加成功");
return CommonResult.success(testCase, "添加成功");
} else {
return CommonResult.failed("添加失败");
}
......@@ -87,12 +87,12 @@ public class TestCaseController {
* @param testCase 用例
* @return 修改后的用例
*/
@ApiOperation(value = "根据id修改用例")
@PutMapping("/{id}")
@ApiOperation(value = "修改用例")
@PutMapping
public ResponseEntity<CommonResultObj<TestCase>> updateTestCase(@RequestBody TestCase testCase) {
int i = testCaseService.updateTestCase(testCase);
if (i != 0) {
return CommonResult.success(testCase,"修改成功");
return CommonResult.success(testCase, "修改成功");
} else {
return CommonResult.failed("修改失败");
}
......@@ -109,7 +109,7 @@ public class TestCaseController {
public ResponseEntity<CommonResultObj<String>> deleteTestCase(@PathVariable Integer id) {
int i = testCaseService.deleteTestCase(id);
if (i != 0) {
return CommonResult.success("id: " + id + "已删除","删除成功");
return CommonResult.success("id: " + id + "已删除", "删除成功");
} else {
return CommonResult.failed("删除失败,或不存在需要删除的数据");
}
......@@ -126,7 +126,7 @@ public class TestCaseController {
public ResponseEntity<CommonResultObj<List<TestCase>>> findByProjectIdTestCase(@PathVariable Integer projectId) {
List<TestCase> results = testCaseService.findByProjectIdTestCase(projectId);
if (results != null && results.size() != 0) {
return CommonResult.success(results,"查询成功");
return CommonResult.success(results, "查询成功");
} else {
return CommonResult.failed("查询失败或无数据");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论