add:添加批量删除

V0.5.x
荭琪枫 2023-07-02 22:22:55 +08:00
parent 6cf1b30503
commit 8bdd46a1c9
3 changed files with 19 additions and 9 deletions

View File

@ -219,8 +219,8 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
} }
@Override @Override
public List<DeviceInfo> findByIds(Collection<String> id) { public List<DeviceInfo> findByIds(Collection<String> ids) {
return null; return deviceInfoData.findByIds(ids);
} }
@Override @Override
@ -252,7 +252,17 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi
} }
@Override @Override
public void deleteByIds(Collection<String> strings) { public void deleteByIds(Collection<String> ids) {
List<DeviceInfo> deviceInfos = deviceInfoData.findByIds(ids);
deviceInfos.forEach(device -> {
deviceInfoCacheEvict.findByDeviceId(device.getDeviceId());
deviceInfoCacheEvict.findByProductKeyAndDeviceName(device.getProductKey(), device.getDeviceName());
//清除属性缓存
clearProperties(device.getDeviceId());
//更新子设备列表缓存
putSubDeviceIds(device.getParentId());
});
deviceInfoData.deleteByIds(ids);
} }
@Override @Override

View File

@ -60,8 +60,8 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData {
} }
@Override @Override
public void deleteByIds(Collection<String> strings) { public void deleteByIds(Collection<String> ids) {
deviceInfoData.deleteByIds(ids);
} }
@Override @Override

View File

@ -465,8 +465,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
} }
@Override @Override
public List<DeviceInfo> findByIds(Collection<String> id) { public List<DeviceInfo> findByIds(Collection<String> ids) {
return null; return MapstructUtils.convert(deviceInfoRepository.findAllById(ids),DeviceInfo.class);
} }
@Override @Override
@ -514,8 +514,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
} }
@Override @Override
public void deleteByIds(Collection<String> strings) { public void deleteByIds(Collection<String> ids) {
deviceInfoRepository.deleteAllById(ids);
} }