From 436e03fe73a19bd485e23f78da5d851bbfe85d25 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 08 八月 2023 20:14:44 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/controller/AlertConfigController.java | 37 ++++++++++++++++++------------------- 1 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/yssh/controller/AlertConfigController.java b/src/main/java/com/yssh/controller/AlertConfigController.java index dd29ecd..026b20f 100644 --- a/src/main/java/com/yssh/controller/AlertConfigController.java +++ b/src/main/java/com/yssh/controller/AlertConfigController.java @@ -6,7 +6,6 @@ import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -18,66 +17,66 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.yssh.entity.AlertConfig; -import com.yssh.service.IAlertConfigService; +import com.yssh.service.AlertConfigService; import com.yssh.utils.Result; + +import javax.annotation.Resource; @Api(tags="鍛婅閰嶇疆") @RestController @RequestMapping("/config") @SuppressWarnings("rawtypes") public class AlertConfigController { - - @Autowired - private IAlertConfigService alertConfigService; + @Resource + private AlertConfigService alertConfigService; @ApiOperationSupport(order = 1) @ApiOperation(value = "鏌ヨ鎵�鏈夊憡璀﹂厤缃暟鎹�", notes = "鏌ヨ鎵�鏈夊憡璀﹂厤缃暟鎹�") @GetMapping("/all") - public Result getAll(){ - List<AlertConfig> list = alertConfigService.getAll(); + public Result getAll() { + List<AlertConfig> list = alertConfigService.getAll(); return Result.OK(list); } - + @ApiOperationSupport(order = 2) @ApiImplicitParam(name = "id", value = "鍛婅閰嶇疆缂栧彿", required = true, type = "int") @ApiOperation(value = "鏍规嵁缂栧彿鏌ヨ鍛婅閰嶇疆鏁版嵁璇︽儏", notes = "鏍规嵁缂栧彿鏌ヨ鍛婅閰嶇疆鏁版嵁璇︽儏") @GetMapping("/query/{id}") - public Result query(@PathVariable("id") Integer id){ - List<AlertConfig> data = alertConfigService.query(id); + public Result query(@PathVariable("id") Integer id) { + List<AlertConfig> data = alertConfigService.query(id); return Result.OK(data); } @ApiOperationSupport(order = 3) @ApiOperation(value = "鏇存柊鍛婅閰嶇疆鏁版嵁", notes = "鏍规嵁鍛婅閰嶇疆缂栧彿淇敼鍛婅閰嶇疆鏁版嵁鍐呭") @PutMapping - public Result update(@RequestBody AlertConfig config){ + public Result update(@RequestBody AlertConfig config) { int row = alertConfigService.update(config); - if(row == 0){ + if (row == 0) { return Result.error("鏇存柊澶辫触"); } return Result.OK("鏇存柊鎴愬姛"); } - + @ApiOperationSupport(order = 4) @ApiOperation(value = "鏂板鍛婅閰嶇疆鏁版嵁", notes = "鏂板鍛婅閰嶇疆璇︽儏鏁版嵁") @PostMapping - public Result add(@RequestBody AlertConfig alert){ + public Result add(@RequestBody AlertConfig alert) { int row = alertConfigService.insert(alert); - if(row == 0){ + if (row == 0) { return Result.error("鏂板澶辫触"); } return Result.OK("鏂板鎴愬姛"); } - + @ApiOperationSupport(order = 5) @ApiOperation(value = "鍒犻櫎鍛婅閰嶇疆鏁版嵁", notes = "鍒犻櫎鍛婅閰嶇疆璇︽儏鏁版嵁") @DeleteMapping("/{id}") - public Result delete(@PathVariable Integer id){ + public Result delete(@PathVariable Integer id) { int row = alertConfigService.delete(id); - if(row == 0){ + if (row == 0) { return Result.error("鍒犻櫎澶辫触"); } return Result.OK("鍒犻櫎鎴愬姛"); } - } -- Gitblit v1.9.3