|
@@ -669,7 +669,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
@Override
|
|
@Override
|
|
@ApiOperation("小程序-商户设备首页列表")
|
|
@ApiOperation("小程序-商户设备首页列表")
|
|
public R<List<DeviceInfoDto.MercHomeListVO>> mercHomeList(DeviceInfoDto.MercHomeQueryDTO dto) {
|
|
public R<List<DeviceInfoDto.MercHomeListVO>> mercHomeList(DeviceInfoDto.MercHomeQueryDTO dto) {
|
|
-
|
|
|
|
|
|
+ String searchKey = dto.getSearchKey();
|
|
Long mercId = dto.getMercId();
|
|
Long mercId = dto.getMercId();
|
|
String deviceName = dto.getDeviceName();
|
|
String deviceName = dto.getDeviceName();
|
|
Long deviceId = dto.getDeviceId();
|
|
Long deviceId = dto.getDeviceId();
|
|
@@ -679,6 +679,23 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
} else {
|
|
} else {
|
|
dto.setActiveState("1");
|
|
dto.setActiveState("1");
|
|
}
|
|
}
|
|
|
|
+ List<Long> searchDeviceIds = new ArrayList<>();
|
|
|
|
+ if (StrUtil.isNotEmpty(searchKey)) {
|
|
|
|
+ //名称或者编号搜索设备
|
|
|
|
+ List<DeviceInfo> list = list(Wrappers.<DeviceInfo>lambdaQuery()
|
|
|
|
+ .eq(DeviceInfo::getMercId, mercId)
|
|
|
|
+ .and(wrapper -> wrapper
|
|
|
|
+ .eq(DeviceInfo::getDeviceId, deviceId)
|
|
|
|
+ .or()
|
|
|
|
+ .likeRight(DeviceInfo::getDeviceName, searchKey)
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
|
+ return R.ok(new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
+ searchDeviceIds = list.stream().map(DeviceInfo::getDeviceId).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
List<Long> myDeviceIds = dto.getDeviceIdList();
|
|
List<Long> myDeviceIds = dto.getDeviceIdList();
|
|
|
|
|
|
@@ -706,6 +723,19 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
}
|
|
}
|
|
if (CollUtil.isNotEmpty(deviceIdList)) {
|
|
if (CollUtil.isNotEmpty(deviceIdList)) {
|
|
dto.setDeviceIdList(deviceIdList);
|
|
dto.setDeviceIdList(deviceIdList);
|
|
|
|
+ List<Long> queryDeviceIds = new ArrayList<>();
|
|
|
|
+ if (CollUtil.isNotEmpty(searchDeviceIds)) {
|
|
|
|
+ searchDeviceIds.forEach(id -> {
|
|
|
|
+ if (deviceIdList.contains(id)) {
|
|
|
|
+ queryDeviceIds.add(id);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ //无符合权限的搜索设备,返空
|
|
|
|
+ if (CollUtil.isEmpty(queryDeviceIds)) {
|
|
|
|
+ return R.ok(new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
return R.ok(new ArrayList<>());
|
|
return R.ok(new ArrayList<>());
|
|
}
|
|
}
|