| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.ehcache.spi.service.MaintainableService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "设备台账管理") |
| | | @RequestMapping("/device/ledger") |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | |
| | | @ApiModelProperty("设备台账列表") |
| | | @GetMapping("/page") |
| | |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | } |
| | | |
| | | @GetMapping("scanDevice") |
| | | @ApiModelProperty("获取设备台账") |
| | | @Anonymous |
| | | 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());//最后维护时间 |
| | | } |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//下次维护时间 |
| | | return AjaxResult.success(deviceLedger); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | IPage<DeviceLedgerDto> queryPage(Page page, @Param("deviceLedger") DeviceLedgerDto deviceLedgerDto); |
| | | |
| | | List<DeviceLedgerExeclDto> deviceLedgerExportList(DeviceLedger deviceLedger); |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | DeviceLedger selectById1(Long id); |
| | | } |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface DeviceMaintenanceMapper extends BaseMapper<DeviceMaintenance> { |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | DeviceMaintenanceDto detailById(Long id); |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | List<DeviceMaintenance> list1(Long id); |
| | | } |
| | |
| | | dl.update_user, |
| | | dl.tenant_id |
| | | FROM device_ledger dl |
| | | left join sys_user su on dl.create_user = su.user_id |
| | | left join sys_user su on dl.create_user = su.user_id |
| | | <where> |
| | | <!-- 设备名称 --> |
| | | <if test="deviceLedger.deviceName != null and deviceLedger.deviceName != ''"> |
| | |
| | | AND dl.create_time >= DATE_FORMAT(#{deviceLedger.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="deviceLedger.entryDateEnd != null and deviceLedger.entryDateEnd != '' "> |
| | | AND dl.create_time <= DATE_FORMAT(#{deviceLedger.entryDateEnd},'%Y-%m-%d') |
| | | AND dl.create_time <= DATE_FORMAT(#{deviceLedger.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | |
| | | <!-- 租户ID --> |
| | |
| | | <select id="deviceLedgerExportList" resultType="com.ruoyi.device.execl.DeviceLedgerExeclDto"> |
| | | |
| | | </select> |
| | | <select id="selectById1" resultType="com.ruoyi.device.pojo.DeviceLedger"> |
| | | select * |
| | | from device_ledger |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="queryPage" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto"> |
| | | select dm.id, |
| | | dm.device_ledger_id, |
| | | dm.maintenance_plan_time, |
| | | dm.maintenance_actually_time, |
| | | dm.maintenance_result, |
| | | dm.status, |
| | | dm.create_time, |
| | | dm.update_time, |
| | | dm.create_user, |
| | | dm.update_user, |
| | | dm.tenant_id, |
| | | dm.maintenance_actually_name, |
| | | dl.device_name, |
| | | dl.device_model, |
| | | dm.device_ledger_id, |
| | | dm.maintenance_plan_time, |
| | | dm.maintenance_actually_time, |
| | | dm.maintenance_result, |
| | | dm.status, |
| | | dm.create_time, |
| | | dm.update_time, |
| | | dm.create_user, |
| | | dm.update_user, |
| | | dm.tenant_id, |
| | | dm.maintenance_actually_name, |
| | | dl.device_name, |
| | | dl.device_model, |
| | | su.user_name as create_user_name |
| | | from device_maintenance dm |
| | | left join device_ledger dl on dm.device_ledger_id = dl.id |
| | |
| | | dl.device_model, |
| | | su.user_name as create_user_name |
| | | from device_maintenance dm |
| | | left join device_ledger dl on dm.device_ledger_id = dl.id |
| | | left join sys_user su on dm.create_user = su.user_id |
| | | left join device_ledger dl on dm.device_ledger_id = dl.id |
| | | left join sys_user su on dm.create_user = su.user_id |
| | | where dm.id = #{id} |
| | | </select> |
| | | <select id="list1" resultType="com.ruoyi.device.pojo.DeviceMaintenance"> |
| | | select * |
| | | from device_maintenance |
| | | where device_ledger_id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |