|
@@ -410,6 +410,53 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
return R.ok(toPageBean(DeviceInfoDto.Vo.class, iPage));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 按商户分页查设备
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ * @return {@link PageBean}<{@link DeviceInfoDto.Vo}>
|
|
|
+ */
|
|
|
+ public PageBean<DeviceInfoDto.Vo> pageByMerc(DeviceInfoDto.PageByMercDto dto) {
|
|
|
+ PageBean pageBean = dto.getPage();
|
|
|
+ String deviceSearch = dto.getDeviceSearch();
|
|
|
+ List<Long> myDeviceIds = dto.getMyDeviceIds();
|
|
|
+ LambdaQueryWrapper<DeviceInfo> lqw = new MybatisPlusQuery().eqWrapper(dto, DeviceInfo.class)
|
|
|
+ .build();
|
|
|
+ List<Long> deviceIds = dto.getDeviceIds();
|
|
|
+ Boolean choosed = dto.getChoosed();
|
|
|
+
|
|
|
+
|
|
|
+ if (BooleanUtil.isFalse(choosed)) {
|
|
|
+ //未选择 排除已选择
|
|
|
+ if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
+ lqw.notIn(DeviceInfo::getDeviceId, deviceIds);
|
|
|
+ } else {
|
|
|
+ if (CollUtil.isEmpty(myDeviceIds)) {
|
|
|
+ return new PageBean<>();
|
|
|
+ }
|
|
|
+ lqw.in(DeviceInfo::getDeviceId, myDeviceIds);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //已选择
|
|
|
+ //指定设备 已选择
|
|
|
+ if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
+ lqw.in(DeviceInfo::getDeviceId, deviceIds);
|
|
|
+ } else {
|
|
|
+ return new PageBean<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //设备搜索
|
|
|
+ lqw.and(StrUtil.isNotEmpty(deviceSearch),
|
|
|
+ wrapper -> wrapper
|
|
|
+ .likeRight(DeviceInfo::getDeviceName, deviceSearch)
|
|
|
+ .or()
|
|
|
+ .likeRight(DeviceInfo::getDeviceId, deviceSearch)
|
|
|
+ );
|
|
|
+ IPage<DeviceInfo> iPage = page(toIPage(pageBean), lqw);
|
|
|
+ return toPageBean(DeviceInfoDto.Vo.class, iPage);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@ApiOperation("对象查询")
|
|
|
public R<DeviceInfoDto.Vo> obj(DeviceInfoDto.Obj obj) {
|