|
|
@@ -4,6 +4,7 @@ import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
import com.zhongshu.card.client.model.base.IDsParam;
|
|
|
+import com.zhongshu.card.client.model.devices.DeviceInfoSearch;
|
|
|
import com.zhongshu.card.client.model.devices.deviceGroup.*;
|
|
|
import com.zhongshu.card.client.type.DataState;
|
|
|
import com.zhongshu.card.server.core.dao.devices.DeviceGroupDao;
|
|
|
@@ -17,11 +18,13 @@ import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.devices.permiss.DevicePermissEventService;
|
|
|
import com.zhongshu.card.server.core.util.BeanUtils;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
@@ -215,7 +218,24 @@ public class DeviceGroupService extends SuperService {
|
|
|
if (ObjectUtils.isEmpty(organization)) {
|
|
|
return ResultContent.buildFail("projectOid不存在");
|
|
|
}
|
|
|
- Page<DeviceGroupToDevice> page = deviceGroupToDeviceDao.page(pageable, param);
|
|
|
+
|
|
|
+ Page<DeviceGroupToDevice> page = null;
|
|
|
+ boolean isSearch = true;
|
|
|
+ // 先筛选用户
|
|
|
+ DeviceInfoSearch search = param;
|
|
|
+ if (search.hasSearchFilter()) {
|
|
|
+ Pageable pageable1 = PageRequest.of(0, 1000);
|
|
|
+ List<DeviceInfo> list = deviceInfoService.list(param, pageable1);
|
|
|
+ if (ObjectUtils.isEmpty(list)) {
|
|
|
+ page = CommonUtil.buildEmptyPage(pageable, DeviceGroupToDevice.class);
|
|
|
+ isSearch = false;
|
|
|
+ } else {
|
|
|
+ param.setDeviceIds(list.stream().map(it -> it.getDeviceId()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isSearch) {
|
|
|
+ page = deviceGroupToDeviceDao.page(pageable, param);
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toDeviceModel));
|
|
|
}
|
|
|
|