zss
2026-04-25 b069101e1bf347ceab11e33d73b2fbb7f37d4686
src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
@@ -8,34 +8,32 @@
import com.ruoyi.device.service.IDeviceLedgerService;
import com.ruoyi.device.service.IDeviceMaintenanceService;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
@Api(tags = "设备保养")
@Tag(name = "设备保养")
@RestController
@RequestMapping("/device/maintenance")
@AllArgsConstructor
public class DeviceMaintenanceController {
    @Autowired
    private IDeviceMaintenanceService deviceMaintenanceService;
    @Autowired
    private IDeviceLedgerService deviceLedgerService;
    @ApiOperation("设备保养列表")
    @Operation(summary = "设备保养列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) {
        return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto));
    }
    @PostMapping()
    @ApiOperation("添加设备保养")
    @Operation(summary = "添加设备保养")
    public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) {
        DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId());
        deviceMaintenance.setDeviceName(byId.getDeviceName());
@@ -43,14 +41,14 @@
        return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance);
    }
    @ApiOperation("根据id查询设备保养")
    @Operation(summary = "根据id查询设备保养")
    @GetMapping("/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(deviceMaintenanceService.detailById(id));
    }
    @PutMapping ()
    @ApiOperation("修改设备保养")
    @Operation(summary = "修改设备保养")
    public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) {
        DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId());
        deviceMaintenance.setDeviceName(byId.getDeviceName());
@@ -59,14 +57,14 @@
    }
    @PostMapping ("maintenance")
    @ApiOperation("修改设备保养")
    @Operation(summary = "修改设备保养")
    public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) {
        return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance);
    }
    @DeleteMapping("/{ids}")
    @ApiOperation("删除设备保养")
    @Operation(summary = "删除设备保养")
    public AjaxResult delete(@PathVariable("ids") Long[] ids) {
        boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids));
        if (!b) {
@@ -76,7 +74,7 @@
    }
    @PostMapping("export")
    @ApiOperation("导出设备保养")
    @Operation(summary = "导出设备保养")
    public void export(HttpServletResponse response, Long[] ids) {
        deviceMaintenanceService.export(response, ids);
    }