From a796117f96a746a0391304b371dbff9839efdd43 Mon Sep 17 00:00:00 2001 From: chengjunwang <952621270@qq.com> Date: Sun, 27 Apr 2025 22:14:11 +0800 Subject: [PATCH] =?UTF-8?q?[add]=E6=8E=92=E6=B0=B4=E9=87=8F=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DicekePrecipitationController.java | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jdc/jdcproject/controller/DicekePrecipitationController.java b/src/main/java/com/jdc/jdcproject/controller/DicekePrecipitationController.java index 5e770fa..9ac5640 100644 --- a/src/main/java/com/jdc/jdcproject/controller/DicekePrecipitationController.java +++ b/src/main/java/com/jdc/jdcproject/controller/DicekePrecipitationController.java @@ -1,8 +1,13 @@ package com.jdc.jdcproject.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RestController; +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; /** *

@@ -16,4 +21,49 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/dicekePrecipitation") public class DicekePrecipitationController { + @Autowired + private IDicekePrecipitationService dicekePrecipitationService; + + + @Operation(summary = "查询所有降水量信息") + @GetMapping("findAllPrecipitation") + public Result findAllPrecipitation() { + List 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(); + } + } + }