From 0d2d37f11b0804d71395582b9bb2d589cfe9003d Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 18 十二月 2023 13:38:26 +0800 Subject: [PATCH] 修改注解 --- src/main/java/com/yssh/controller/LocationController.java | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/yssh/controller/LocationController.java b/src/main/java/com/yssh/controller/LocationController.java index f3e727e..833ff01 100644 --- a/src/main/java/com/yssh/controller/LocationController.java +++ b/src/main/java/com/yssh/controller/LocationController.java @@ -5,7 +5,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; @@ -16,8 +15,10 @@ import org.springframework.web.bind.annotation.RestController; import com.yssh.entity.Location; -import com.yssh.service.ILocationService; +import com.yssh.service.LocationService; import com.yssh.utils.Result; + +import javax.annotation.Resource; /** * @author wMeng @@ -31,33 +32,32 @@ @RequestMapping("/location") @SuppressWarnings("rawtypes") public class LocationController { - - @Autowired - private ILocationService locationService; + @Resource + private LocationService locationService; - @ApiOperation(value = "鏉′欢鏌ヨ鐐逛綅鏁版嵁", notes = "鏍规嵁鍚嶇О鍙婂叾绫诲瀷鏌ヨ鐐逛綅璇︾粏淇℃伅") + @ApiOperation(value = "鏉′欢鏌ヨ鐐逛綅鏁版嵁", notes = "鏍规嵁鍚嶇О鍙婂叾绫诲瀷鏌ヨ鐐逛綅璇︾粏淇℃伅") @GetMapping("/query") public Result query( - @RequestParam(value = "name", required = false) String name, - @RequestParam(value = "type", required = true) String type){ - List<Location> data = locationService.query(name, type); + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "type", required = false) String type) { + List<Location> data = locationService.query(name, type); return Result.OK(data); } - - + + @GetMapping("/list") @ApiOperation(value = "鏌ヨ鎵�鏈夌偣浣嶆暟鎹�", notes = "鏌ヨ鎵�鏈夊巶鍖虹儹鐐圭偣浣嶆暟鎹�") - public Result list(){ - List<Location> list = locationService.getAll(); + public Result list() { + List<Location> list = locationService.getAll(); return Result.OK(list); } - - + + @ApiOperation(value = "鏂板鐐逛綅鏁版嵁", notes = "鏂板鐐逛綅璇︽儏鏁版嵁") @PostMapping - public Result insertLocation(@RequestBody Location location){ + public Result insertLocation(@RequestBody Location location) { int i = locationService.insertLocation(location); - if(i == 0){ + if (i == 0) { return Result.error("鎻掑叆澶辫触"); } return Result.OK("鎻掑叆鎴愬姛"); @@ -65,9 +65,9 @@ @ApiOperation(value = "鍒犻櫎鐐逛綅鏁版嵁", notes = "鍒犻櫎鐐逛綅璇︽儏鏁版嵁") @DeleteMapping("/{id}") - public Result deleteLocation(@PathVariable String id){ + public Result deleteLocation(@PathVariable String id) { int i = locationService.deleteLocation(id); - if(i == 0){ + if (i == 0) { return Result.error("鍒犻櫎澶辫触"); } return Result.OK("鍒犻櫎鎴愬姛"); -- Gitblit v1.9.3