package com.yssh.controller;
|
|
import com.yssh.entity.YsshBjyj;
|
import com.yssh.entity.YsshLocation;
|
import com.yssh.entity.YsshSuYuan;
|
import com.yssh.service.YsshBjyjService;
|
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.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author lishijia
|
* @ClassName YsshBjyjController
|
* @Description TODO
|
* @date 2022/10/30 13:21
|
* @Version 1.0
|
*/
|
@Api(tags="报警")
|
@RestController
|
@RequestMapping("bjyjController")
|
public class YsshBjyjController {
|
@Autowired
|
private YsshBjyjService ysshBjyjService;
|
|
@GetMapping("/query")
|
@ApiOperation("查询数据")
|
public Result query(int id){
|
List<YsshBjyj> data =ysshBjyjService.query(id);
|
return Result.OK(data);
|
}
|
@GetMapping("/getAll")
|
@ApiOperation("查询所有数据")
|
public Result getAll(){
|
List<YsshBjyj> list = ysshBjyjService.getAll();
|
return Result.OK(list);
|
}
|
// @PostMapping("/insert")
|
// @ApiOperation("插入数据")
|
// public Result insert(@RequestBody YsshBjyj ysshBjyj){
|
// int i = ysshBjyjService.insert(ysshBjyj);
|
// if(i == 0){
|
// return Result.error("插入失败");
|
// }
|
// return Result.OK("插入成功");
|
// }
|
//
|
// @DeleteMapping("/delete/{id}")
|
// @ApiOperation("删除数据")
|
// public Result delete(@PathVariable("id") String id){
|
// int i = ysshBjyjService.delete(id);
|
// if(i == 0){
|
// return Result.error("删除失败");
|
// }
|
// return Result.OK("删除成功");
|
// }
|
|
@PostMapping("/update")
|
@ApiOperation("更新数据")
|
public Result update(@RequestBody YsshBjyj ysshBjyj){
|
int i = ysshBjyjService.update(ysshBjyj);
|
if(i == 0){
|
return Result.error("更新失败");
|
}
|
return Result.OK("更新成功");
|
}
|
}
|