Commit dc5f5e01 by zzrdark

1.修复适量配置功能

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