From e3ecf5cafe10140be3c79b92e9fd28516cf4dd58 Mon Sep 17 00:00:00 2001 From: chengjunwang <952621270@qq.com> Date: Wed, 7 May 2025 10:26:59 +0800 Subject: [PATCH] =?UTF-8?q?[add]=E6=96=B0=E5=A2=9E=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=B0=B4=E9=87=8F=E5=92=8C=E6=8B=89=E6=B3=A5=E8=BD=A6=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...paishuiWatertreatmentrecordController.java | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/jdc/jdcproject/controller/FangpaishuiWatertreatmentrecordController.java b/src/main/java/com/jdc/jdcproject/controller/FangpaishuiWatertreatmentrecordController.java index a09aeb3..75324f5 100644 --- a/src/main/java/com/jdc/jdcproject/controller/FangpaishuiWatertreatmentrecordController.java +++ b/src/main/java/com/jdc/jdcproject/controller/FangpaishuiWatertreatmentrecordController.java @@ -1,6 +1,7 @@ package com.jdc.jdcproject.controller; import com.jdc.jdcproject.entity.DicekePrecipitation; +import com.jdc.jdcproject.entity.Equipment; import com.jdc.jdcproject.entity.FangpaishuiWatertreatmentrecord; import com.jdc.jdcproject.entity.VO.FangpaishuiWatertreatmentrecordVo; import com.jdc.jdcproject.service.FangpaishuiWatertreatmentrecordService; @@ -8,14 +9,12 @@ import com.jdc.jdcproject.utils.LastDayOfMonth; 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.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -53,4 +52,51 @@ public class FangpaishuiWatertreatmentrecordController { return Result.successResult().data("fangpaishuiWatertreatmentrecordVo",fangpaishuiWatertreatmentrecordVo); } + + @Operation(summary = "根据时间段查询处理水量和拉泥车数详细数据") + @GetMapping("findWatertreatmentrecordDetailByMonth/{dateTime}") + public Result findWatertreatmentrecordDetailByMonth(@PathVariable String dateTime) throws ParseException { + String[] s = dateTime.split("到"); + List fangpaishuiWatertreatmentrecords = new ArrayList<>(); + if (s.length!=0&&!s[0].isEmpty()&&!s[1].isEmpty()) { + fangpaishuiWatertreatmentrecords = fangpaishuiWatertreatmentrecordService.findByDate(s[0], s[1]); + } + + return Result.successResult().data("fangpaishuiWatertreatmentrecords",fangpaishuiWatertreatmentrecords); + } + + @Operation(summary = "修改处理水量和拉泥车信息") + @PostMapping("updateWatertreatmentrecord") + public Result updateEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) { + boolean updateflag = fangpaishuiWatertreatmentrecordService.updateById(fangpaishuiWatertreatmentrecord); + if (updateflag) { + return Result.successResult(); + } else { + return Result.errorResult(); + } + } + + @Operation(summary = "删除处理水量和拉泥车信息") + @DeleteMapping("deleteWatertreatmentrecord/{id}") + public Result deleteEquipment(@PathVariable String id) { + boolean updateflag = fangpaishuiWatertreatmentrecordService.removeById(id); + if (updateflag) { + return Result.successResult(); + } else { + return Result.errorResult(); + } + } + + @Operation(summary = "新增处理水量和拉泥车信息") + @PostMapping("addWatertreatmentrecord") + public Result addEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) { + System.out.println(fangpaishuiWatertreatmentrecord); + boolean updateflag = fangpaishuiWatertreatmentrecordService.save(fangpaishuiWatertreatmentrecord); + if (updateflag) { + return Result.successResult(); + } else { + return Result.errorResult(); + } + } + }