maven
2025-11-19 72a372cb26c4ba489efae6b65dbf9fdfea1b5815
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;
@@ -16,6 +18,7 @@
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Api(tags = "设备报修管理")
@RequestMapping("/device/repair")
@@ -37,9 +40,6 @@
    @PostMapping()
    @ApiModelProperty("添加设备报修")
    public AjaxResult add( @RequestBody DeviceRepair deviceRepair) {
        DeviceLedger byId = deviceLedgerService.getById(deviceRepair.getDeviceLedgerId());
        deviceRepair.setDeviceName(byId.getDeviceName());
        deviceRepair.setDeviceModel(byId.getDeviceModel());
        return deviceRepairService.saveDeviceRepair(deviceRepair);
    }
@@ -78,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);
    }
}