9 小时以前 55d694aaae4e421b5e55cd941500e08f85cb5d4d
src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
@@ -1,7 +1,6 @@
package com.ruoyi.device.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.device.dto.DeviceLedgerDto;
@@ -35,30 +34,29 @@
    private DeviceMaintenanceMapper deviceMaintenanceMapper;
    @Operation(summary = "设备台账列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) {
        return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger));
    public AjaxResult page(Page page, DeviceLedgerDto deviceLedger) {
        return AjaxResult.success(deviceLedgerService.queryPage(page, deviceLedger));
    }
    @PostMapping()
    @Operation(summary = "添加设备台账")
    public AjaxResult add(@RequestBody DeviceLedger deviceLedger) {
        return deviceLedgerService.saveDeviceLedger(deviceLedger);
    public AjaxResult add(@RequestBody DeviceLedgerDto deviceLedgerDto) {
        return deviceLedgerService.saveDeviceLedger(deviceLedgerDto);
    }
    @Operation(summary = "根据id查询设备台账")
    @GetMapping("/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(deviceLedgerService.getById(id));
        DeviceLedgerDto deviceLedgerDto = deviceLedgerService.getDeviceLedgerDetail(id);
        return AjaxResult.success(deviceLedgerDto);
    }
    @PutMapping ()
    @PutMapping()
    @Operation(summary = "修改设备台账")
    public AjaxResult update(@RequestBody DeviceLedger deviceLedger) {
        return deviceLedgerService.updateDeviceLedger(deviceLedger);
    public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) {
        return deviceLedgerService.updateDeviceLedger(deviceLedgerDto);
    }
    @DeleteMapping("/{ids}")
@@ -74,7 +72,7 @@
    @PostMapping("export")
    @Operation(summary = "导出设备台账")
    public void export(HttpServletResponse response, Long[] ids) {
         deviceLedgerService.export(response, ids);
        deviceLedgerService.export(response, ids);
    }
    @Operation(summary = "下载模板")
@@ -96,10 +94,9 @@
    @GetMapping("getDeviceLedger")
    @Operation(summary = "获取设备台账")
    public AjaxResult getDeviceLedger( ) {
        return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda()
                .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel)));
    @Operation(summary = "获取设备台账(巡检选择设备,支持按区域筛选)")
    public AjaxResult getDeviceLedger(Long areaId) {
        return AjaxResult.success(deviceLedgerService.selectDeviceOptions(areaId));
    }
    @GetMapping("scanDevice")
@@ -108,8 +105,8 @@
    public AjaxResult scanDevice(Long id) {
        List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id);
        DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id);
        if (list.size()>0){
            deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//最后维护时间
        if (!list.isEmpty()) {
            deviceLedger.setUpdateTime(list.getFirst().getMaintenanceActuallyTime());//最后维护时间
        }
        deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//下次维护时间
        return AjaxResult.success(deviceLedger);