|
|
@ -111,15 +111,13 @@ public class DeviceProServiceImpl implements IDeviceProService { |
|
|
|
|
|
|
|
List<DeviceEntity> deviceEntityList = deviceMapper.selectList(new LambdaQueryWrapper<DeviceEntity>().in(DeviceEntity::getProId, ids)); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(deviceEntityList)) { |
|
|
|
throw new ServiceException("该项目已绑定设备,无法删除,请联系管理员!"); |
|
|
|
} |
|
|
|
deviceEntityList.forEach(deviceEntity -> { |
|
|
|
deviceMapper.updatePor(deviceEntity.getId(),null); |
|
|
|
}); |
|
|
|
|
|
|
|
List<DeviceProUserEntity> proUserEntityList = deviceProUserMapper.selectList(new LambdaQueryWrapper<DeviceProUserEntity>().in(DeviceProUserEntity::getDeviceProId, ids)); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(proUserEntityList)) { |
|
|
|
throw new ServiceException("该项目已绑定人员,无法删除,请联系管理员!"); |
|
|
|
} |
|
|
|
//todo人员是否要删除
|
|
|
|
List<DeviceProUserEntity> proUserEntityList = deviceProUserMapper.selectList(new LambdaQueryWrapper<DeviceProUserEntity>().in(DeviceProUserEntity::getDeviceProId, ids)); |
|
|
|
|
|
|
|
|
|
|
|
return deviceProMapper.deleteByIds(ids)>0; |
|
|
@ -128,15 +126,14 @@ public class DeviceProServiceImpl implements IDeviceProService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Boolean updateDeviceProUser(List<DeviceProUserEntity> userEntity,Long proId) { |
|
|
|
if (ObjectUtil.isNotEmpty(userEntity)) { |
|
|
|
throw new ServiceException("参数为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//先清除原来的项目组成员
|
|
|
|
deviceProUserMapper.delete(new LambdaQueryWrapper<DeviceProUserEntity>().eq(DeviceProUserEntity::getDeviceProId, proId)); |
|
|
|
|
|
|
|
deviceProUserMapper.insert(userEntity); |
|
|
|
if (ObjectUtil.isNotEmpty(userEntity)) { |
|
|
|
//添加新的项目组成员
|
|
|
|
deviceProUserMapper.insert(userEntity); |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} catch (ServiceException e) { |
|
|
@ -167,6 +164,11 @@ public class DeviceProServiceImpl implements IDeviceProService { |
|
|
|
return deviceMapper.update(wrapper) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前成员所属项目组 |
|
|
|
* @param userId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<Integer> listDeviceGroup(Long userId) { |
|
|
|
LambdaQueryWrapper<DeviceProUserEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|