liyong
3 天以前 4635770544e2d57416ad88a8983ee293919f5fec
src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
@@ -35,7 +35,6 @@
    private DeviceMaintenanceMapper deviceMaintenanceMapper;
    @Operation(summary = "设备台账列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) {
@@ -44,21 +43,21 @@
    @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 ()
    @Operation(summary = "修改设备台账")
    public AjaxResult update(@RequestBody DeviceLedger deviceLedger) {
        return deviceLedgerService.updateDeviceLedger(deviceLedger);
    public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) {
        return deviceLedgerService.updateDeviceLedger(deviceLedgerDto);
    }
    @DeleteMapping("/{ids}")
@@ -108,8 +107,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);