| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | String picUrl = File.separator + filePath.substring(filePath.indexOf(split)); |
| | | spare.setPictureUrl(picUrl); |
| | | } |
| | | |
| | | } |
| | | |
| | | //新增列表 |
| | | List<DeviceSpare> spareListNew = new ArrayList<>(); |
| | | //更新列表 |
| | | List<DeviceSpare> spareListUpdate = new ArrayList<>(); |
| | | //查询库中的所有设备器件 |
| | | List<DeviceSpare> deviceSpareListInDB = mapper.selectList((Wrapper<DeviceSpare>) CommonUtil.nullObject); |
| | | for (DeviceSpare spare : spareList){ |
| | | for (DeviceSpare spareInDB : deviceSpareListInDB){ |
| | | if (spare.getName().equals(spareInDB.getName()) |
| | | && spare.getModel().equals(spareInDB.getModel()) |
| | | && spare.getVersion().equals(spareInDB.getVersion()) |
| | | && spare.getBrand().equals(spareInDB.getBrand()) |
| | | && spare.getType().equals(spareInDB.getType()) |
| | | && spare.getSupplier().equals(spareInDB.getSupplier()) |
| | | ){ |
| | | spare.setId(spareInDB.getId()); |
| | | spare.setQuantity(spareInDB.getQuantity()+spare.getQuantity()); |
| | | if (spare.getPictureUrl() != null && spareInDB.getPictureUrl()!=null){ |
| | | spare.setPictureUrl(spareInDB.getPictureUrl()+","+spare.getPictureUrl()); |
| | | } |
| | | spareListUpdate.add(spare); |
| | | |
| | | }else{ |
| | | spareListNew.add(spare); |
| | | } |
| | | } |
| | | } |
| | | //更新TODO |
| | | |
| | | //addBatch(spareList); |
| | | |