| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | | import com.by4cloud.platformx.common.log.annotation.SysLog; |
| | | import com.by4cloud.platformx.device.entity.DeviceDemandPlan; |
| | | import com.by4cloud.platformx.device.entity.DeviceInventory; |
| | | import com.by4cloud.platformx.device.service.DeviceInventoryService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | wrapper.like(StringUtils.isNotBlank(deviceInventory.getDeviceNumber()),DeviceInventory::getDeviceNumber,deviceInventory.getDeviceNumber()); |
| | | wrapper.like(StringUtils.isNotBlank(deviceInventory.getSerialNo()),DeviceInventory::getSerialNo,deviceInventory.getSerialNo()); |
| | | wrapper.like(StringUtils.isNotBlank(deviceInventory.getName()),DeviceInventory::getName,deviceInventory.getName()); |
| | | wrapper.eq(StringUtils.checkValNotNull(deviceInventory.getInventoryStatus()),DeviceInventory::getInventoryStatus,deviceInventory.getInventoryStatus()); |
| | | wrapper.orderByDesc(DeviceInventory::getCreateTime); |
| | | return R.ok(deviceInventoryService.page(page, wrapper)); |
| | | } |
| | | |
| | |
| | | public List<DeviceInventory> export(DeviceInventory deviceInventory,Long[] ids) { |
| | | return deviceInventoryService.list(Wrappers.lambdaQuery(deviceInventory).in(ArrayUtil.isNotEmpty(ids), DeviceInventory::getId, ids)); |
| | | } |
| | | |
| | | /** |
| | | * 设备下所有可用序列号下拉 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDropdowmList/{deviceId}" ) |
| | | public R getDeviceList(@PathVariable("deviceId")Long deviceId) { |
| | | QueryWrapper<DeviceInventory> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("device_id",deviceId); |
| | | queryWrapper.eq("inventory_status","1"); |
| | | return R.ok(deviceInventoryService.list(queryWrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 设备下所有报废序列号下拉 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDropdowmScrapList/{deviceId}" ) |
| | | public R getDropdowmScrapList(@PathVariable("deviceId")Long deviceId) { |
| | | QueryWrapper<DeviceInventory> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("device_id",deviceId); |
| | | queryWrapper.eq("inventory_status","4"); |
| | | return R.ok(deviceInventoryService.list(queryWrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 租赁状态下的设备租赁详情 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getReleaseDetail/{id}" ) |
| | | public R getReleaseDetail(@PathVariable("id")Long id) { |
| | | return deviceInventoryService.getReleaseDetail(id); |
| | | } |
| | | |
| | | /** |
| | | * 设备更新照片 |
| | | * @param deviceInventory 库存表 |
| | | * @return R |
| | | */ |
| | | @SysLog("设备更新照片" ) |
| | | @PutMapping("/uploadPic") |
| | | public R uploadPic(@RequestBody DeviceInventory deviceInventory) { |
| | | return R.ok(deviceInventoryService.updateById(deviceInventory)); |
| | | } |
| | | |
| | | /** |
| | | * 修改库存表 |
| | | * @param id 库存表 |
| | | * @return R |
| | | */ |
| | | @SysLog("设备归还入库" ) |
| | | @GetMapping("/return/{id}") |
| | | public R returnDevice(@PathVariable("id")Long id) { |
| | | return deviceInventoryService.returnDevice(id); |
| | | } |
| | | } |