2025-04-27 16:49:30 +08:00
|
|
|
package com.jdc.jdcproject.controller;
|
|
|
|
|
2025-04-27 22:14:11 +08:00
|
|
|
import com.jdc.jdcproject.entity.DicekePrecipitation;
|
|
|
|
import com.jdc.jdcproject.service.IDicekePrecipitationService;
|
|
|
|
import com.jdc.jdcproject.utils.Result;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
2025-04-27 16:49:30 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>
|
|
|
|
* 降水量表; 前端控制器
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @author haoyanlu
|
|
|
|
* @since 2025-04-26
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/dicekePrecipitation")
|
|
|
|
public class DicekePrecipitationController {
|
|
|
|
|
2025-04-27 22:14:11 +08:00
|
|
|
@Autowired
|
|
|
|
private IDicekePrecipitationService dicekePrecipitationService;
|
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "查询所有降水量信息")
|
|
|
|
@GetMapping("findAllPrecipitation")
|
|
|
|
public Result findAllPrecipitation() {
|
|
|
|
List<DicekePrecipitation> precipitationList = dicekePrecipitationService.list();
|
|
|
|
return Result.successResult().data("precipitation",precipitationList);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "修改降水量信息")
|
|
|
|
@PostMapping("updatePrecipitation")
|
|
|
|
public Result updatePrecipitation(@RequestBody DicekePrecipitation precipitation) {
|
|
|
|
boolean updateflag = dicekePrecipitationService.updateById(precipitation);
|
|
|
|
if (updateflag) {
|
|
|
|
return Result.successResult();
|
|
|
|
} else {
|
|
|
|
return Result.errorResult();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "删除降水量信息")
|
|
|
|
@DeleteMapping("deletePrecipitation/{id}")
|
|
|
|
public Result deletePlateArea(@PathVariable String id) {
|
|
|
|
boolean updateflag = dicekePrecipitationService.removeById(id);
|
|
|
|
if (updateflag) {
|
|
|
|
return Result.successResult();
|
|
|
|
} else {
|
|
|
|
return Result.errorResult();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "新增降水量信息")
|
|
|
|
@PostMapping("addPrecipitation")
|
|
|
|
public Result addPlateArea(@RequestBody DicekePrecipitation precipitation) {
|
|
|
|
boolean updateflag = dicekePrecipitationService.save(precipitation);
|
|
|
|
if (updateflag) {
|
|
|
|
return Result.successResult();
|
|
|
|
} else {
|
|
|
|
return Result.errorResult();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-05-05 22:35:04 +08:00
|
|
|
@Operation(summary = "根据id查询降水量信息")
|
|
|
|
@GetMapping("findPrecipitationById/{id}")
|
|
|
|
public Result findPrecipitationById(@PathVariable String id) {
|
|
|
|
DicekePrecipitation dicekePrecipitation = dicekePrecipitationService.getById(id);
|
|
|
|
return Result.successResult().data("precipitationById",dicekePrecipitation);
|
|
|
|
}
|
|
|
|
|
2025-04-27 16:49:30 +08:00
|
|
|
}
|