From 0100359605ba05638c1f683d68a2948cc273b0d2 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 08 十二月 2025 11:21:29 +0800
Subject: [PATCH] yys 修改设备模块
---
src/main/java/com/ruoyi/device/controller/DeviceRepairController.java | 52 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
index 9dd898a..7b386bd 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO;
import com.ruoyi.device.dto.DeviceRepairDto;
+import com.ruoyi.device.dto.RepairAmountGroupDTO;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.device.pojo.DeviceRepair;
import com.ruoyi.device.service.IDeviceLedgerService;
@@ -15,14 +17,19 @@
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
@Api(tags = "璁惧鎶ヤ慨绠$悊")
-@RequestMapping("/device/reppair")
+@RequestMapping("/device/repair")
@RestController
public class DeviceRepairController {
@Autowired
private IDeviceRepairService deviceRepairService;
+
+ @Autowired
+ private IDeviceLedgerService deviceLedgerService;
@ApiModelProperty("璁惧鎶ヤ慨鍒楄〃")
@GetMapping("/page")
@@ -32,26 +39,34 @@
@PostMapping()
@ApiModelProperty("娣诲姞璁惧鎶ヤ慨")
- public AjaxResult add(DeviceRepair deviceRepair) {
+ public AjaxResult add( @RequestBody DeviceRepair deviceRepair) {
return deviceRepairService.saveDeviceRepair(deviceRepair);
}
@ApiModelProperty("鏍规嵁id鏌ヨ璁惧鎶ヤ慨")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {
- return AjaxResult.success(deviceRepairService.getById(id));
+ DeviceRepairDto byId = deviceRepairService.detailById(id);
+ return AjaxResult.success(byId);
}
@PutMapping ()
@ApiModelProperty("淇敼璁惧鎶ヤ慨")
- public AjaxResult update(DeviceRepair deviceRepair) {
+ public AjaxResult update( @RequestBody DeviceRepair deviceRepair) {
return deviceRepairService.updateDeviceRepair(deviceRepair);
}
- @DeleteMapping("/{id}")
+ @PostMapping ("repair")
+ @ApiModelProperty("璁惧缁翠慨")
+ public AjaxResult repair( @RequestBody DeviceRepair deviceRepair) {
+ deviceRepair.setStatus(1);
+ return deviceRepairService.updateDeviceRepair(deviceRepair);
+ }
+
+ @DeleteMapping("/{ids}")
@ApiModelProperty("鍒犻櫎璁惧鎶ヤ慨")
- public AjaxResult delete(@PathVariable ArrayList<Long> ids) {
- boolean b = deviceRepairService.removeBatchByIds(ids);
+ public AjaxResult delete(@PathVariable("ids") Long[] ids) {
+ boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids));
if (!b) {
return AjaxResult.error("鍒犻櫎澶辫触");
}
@@ -63,4 +78,27 @@
public void export(HttpServletResponse response, Long[] ids) {
deviceRepairService.export(response, ids);
}
+
+ /**
+ * 鎸夊勾浠芥煡璇㈡瘡鏈堟姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級
+ * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�2025锛�
+ */
+ @GetMapping("/monthlyAmount")
+ @ApiModelProperty("鎸夊勾浠芥煡璇㈡瘡鏈堟姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級")
+ public AjaxResult getMonthlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) {
+ List<DeviceMonthlyRepairTableDTO> result = deviceRepairService.getMonthlyRepairAmountByYear(year);
+ return AjaxResult.success(result);
+ }
+
+ /**
+ * 鎸夊勾浠芥煡璇㈡姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級
+ * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�2025锛�
+ */
+ @GetMapping("/yearlyAmount")
+ @ApiModelProperty("鎸夊勾浠芥煡璇㈡姤淇噾棰濓紙鎸夎澶囧彴璐﹀垎缁勶級")
+ public AjaxResult yearlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) {
+ List<RepairAmountGroupDTO> result = deviceRepairService.getRepairAmountByYear(year);
+ return AjaxResult.success(result);
+ }
+
}
--
Gitblit v1.9.3