package com.yssh.controller; import com.yssh.entity.YsshLocation; import com.yssh.service.YsshLocationService; import com.yssh.utils.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author wMeng * @ClassName YsshLocationController * @Description YsshLocationController * @date 2022/10/30 13:21 * @Version 1.0 */ @Api(tags="厂区热点点位") @RestController @RequestMapping("/locationController") public class YsshLocationController { @Autowired private YsshLocationService ysshLocationService; @GetMapping("/query") @ApiOperation("查询数据") public Result query(String name, String type){ List data =ysshLocationService.query(name, type); return Result.OK(data); } @GetMapping("/getAll") @ApiOperation("查询所有数据") public Result getAll(){ List list = ysshLocationService.getAll(); return Result.OK(list); } @PostMapping("/insertLocation") @ApiOperation("插入数据") public Result insertLocation(@RequestBody YsshLocation ysshLocation){ int i = ysshLocationService.insertLocation(ysshLocation); if(i == 0){ return Result.error("插入失败"); } return Result.OK("插入成功"); } @DeleteMapping("/deleteLocation/{id}") @ApiOperation("删除数据") public Result deleteLocation(@PathVariable("id") String id){ int i = ysshLocationService.deleteLocation(id); if(i == 0){ return Result.error("删除失败"); } return Result.OK("删除成功"); } }