| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @Autowired |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | |
| | | @ApiModelProperty("设备台账列表") |
| | | @GetMapping("/page") |
| | |
| | | @ApiModelProperty("获取设备台账") |
| | | @Anonymous |
| | | public AjaxResult scanDevice(Long id) { |
| | | List<DeviceMaintenance> list = deviceMaintenanceService.list(Wrappers.<DeviceMaintenance>lambdaQuery() |
| | | .eq(DeviceMaintenance::getDeviceLedgerId, id) |
| | | .orderByDesc(DeviceMaintenance::getMaintenanceActuallyTime)); |
| | | DeviceLedger deviceLedger = deviceLedgerService.getById(id); |
| | | List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id); |
| | | DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id); |
| | | if (list.size()>0){ |
| | | deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime()); |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1)); |
| | | deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//最后维护时间 |
| | | } |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//下次维护时间 |
| | | return AjaxResult.success(deviceLedger); |
| | | } |
| | | } |