Commit dc5f5e01 by zzrdark

1.修复适量配置功能

parent 033f1b47
......@@ -23,6 +23,8 @@ public interface DeviceInfoChannelService extends IService<DeviceInfoChannelEnti
void removeDeivceInfoChannelByDeviceIdAndChannelId(Long channelId, List<Long> deviceIds);
void removeDeivceInfoChannelByDeviceIds(List<Long> deviceIds);
List<DeviceInfoChannelEntity> queryDeviceInfoChannelByChannelIds(List<Long> channelIds);
List<DeviceInfoChannelEntity> queryDeviceInfoChannelByDeviceIds(List<Long> deviceIds);
......
......@@ -49,6 +49,13 @@ public class DeviceInfoChannelServiceImpl extends ServiceImpl<DeviceInfoChannelD
}
@Override
public void removeDeivceInfoChannelByDeviceIds(List<Long> deviceIds){
getBaseMapper().delete(
new QueryWrapper<DeviceInfoChannelEntity>()
.in("device_id",deviceIds));
}
@Override
public List<DeviceInfoChannelEntity> queryDeviceInfoChannelByChannelIds(List<Long> channelIds){
List<DeviceInfoChannelEntity> deviceInfoChannelEntities = getBaseMapper().selectList(new QueryWrapper<DeviceInfoChannelEntity>()
.in("channel_id", channelIds));
......
......@@ -262,11 +262,12 @@ public class DeviceInfoController {
* 保存
*/
@RequestMapping("/updateDeviceChannelBatch")
@Transactional
@Transactional(rollbackFor = Exception.class)
public R updateDeviceChannelBatch(@RequestBody DevicesDto devicesDto){
List<DeviceInfoEntity> deviceInfoEntityList = new LinkedList<>();
List<DeviceInfoChannelEntity> deviceChannelEntities = new LinkedList<>();
List<Long> deviceIds = new ArrayList<>();
if (devicesDto.getImeis() != null && devicesDto.getImeis().size() != 0) {
......@@ -285,10 +286,12 @@ public class DeviceInfoController {
entities.forEach(entity -> {
if (entity.getImei().equals(str)){
infoChannel.setDeviceId(entity.getDeviceId());
deviceIds.add(entity.getDeviceId());
}
});
infoChannel.setChannelId(channelNum);
deviceChannelEntities.add(infoChannel);
});
});
......@@ -296,7 +299,9 @@ public class DeviceInfoController {
deviceInfoService.updateBatchByImei(deviceInfoEntityList);
// TODO 把已经增加过的删除
// 删除原来的
deviceInfoChannelService.removeDeivceInfoChannelByDeviceIds(deviceIds);
deviceInfoChannelService.saveBatch(deviceChannelEntities);
return R.ok();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment