cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java
@@ -5,17 +5,19 @@
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto;
import com.ruoyi.device.dto.DeviceMaintenancePlanDto;
import com.ruoyi.device.pojo.DeviceMaintenanceAttachment;
import com.ruoyi.device.pojo.DeviceMaintenancePlan;
import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails;
import com.ruoyi.device.service.DeviceMaintenancePlanDetailsService;
import com.ruoyi.device.service.DeviceMaintenancePlanService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
@@ -32,9 +34,6 @@
public class DeviceMaintenancePlanController {
    @Resource
    private DeviceMaintenancePlanService deviceMaintenancePlanService;
    @Resource
    private DeviceMaintenancePlanDetailsService deviceMaintenancePlanDetailsService;
    /**
     * 分页查询设备保养计划
@@ -95,6 +94,15 @@
    }
    /**
     * 保养计划年份列表(自动删除没有明细的空年份计划)
     */
    @Operation(summary = "保养计划年份列表")
    @GetMapping("/getPlanYears")
    public Result<List<String>> getPlanYears() {
        return Result.success(deviceMaintenancePlanService.getMaintenancePlanYears());
    }
    /**
     * 设备保养计划详情列表(含到点标红)
     */
    @Operation(summary = "设备保养计划详情列表")
@@ -109,7 +117,7 @@
    @Operation(summary = "修改设备保养计划详情")
    @PostMapping("/updateMaintenancePlanDetail")
    public Result updateMaintenancePlanDetail(@RequestBody DeviceMaintenancePlanDetails deviceMaintenancePlanDetails) {
        return Result.success(deviceMaintenancePlanDetailsService.updateById(deviceMaintenancePlanDetails));
        return Result.success(deviceMaintenancePlanService.updateMaintenancePlanDetail(deviceMaintenancePlanDetails));
    }
    /**
@@ -118,7 +126,7 @@
    @Operation(summary = "删除设备保养计划详情")
    @DeleteMapping("/delMaintenancePlanDetail")
    public Result delMaintenancePlanDetail(Integer maintenancePlanDetailId) {
        return Result.success(deviceMaintenancePlanDetailsService.removeById(maintenancePlanDetailId));
        return Result.success(deviceMaintenancePlanService.removeMaintenancePlanDetail(maintenancePlanDetailId));
    }
    /**
@@ -126,7 +134,8 @@
     */
    @Operation(summary = "导出设备保养计划")
    @GetMapping("/exportDeviceMaintenancePlan")
    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId, HttpServletResponse response) {
    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId,
                                              HttpServletResponse response) {
        return deviceMaintenancePlanService.exportDeviceMaintenancePlanDto(maintenancePlanId, response);
    }
@@ -147,4 +156,32 @@
    public Result reviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.reviewMaintenancePlanStatus(deviceMaintenancePlanDto);
    }
    /**
     * 查询保养计划明细附件
     */
    @Operation(summary = "查询保养计划明细附件")
    @GetMapping("/selectAttachments")
    public Result<List<DeviceMaintenanceAttachment>> selectAttachments(Integer maintenancePlanDetailId) {
        return Result.success(deviceMaintenancePlanService.selectAttachments(maintenancePlanDetailId));
    }
    /**
     * 上传保养计划明细附件
     */
    @Operation(summary = "上传保养计划明细附件")
    @PostMapping("/uploadAttachment")
    public Result uploadAttachment(@RequestParam("maintenancePlanDetailId") Integer maintenancePlanDetailId,
                                   @RequestParam("file") MultipartFile file) {
        return Result.success(deviceMaintenancePlanService.uploadAttachment(maintenancePlanDetailId, file));
    }
    /**
     * 删除保养计划明细附件
     */
    @Operation(summary = "删除保养计划明细附件")
    @DeleteMapping("/deleteAttachment")
    public Result deleteAttachment(Long id) {
        return Result.success(deviceMaintenancePlanService.deleteAttachment(id));
    }
}