From d9c7e6ff66ec25194562db85e2246146bb6ed6f6 Mon Sep 17 00:00:00 2001 From: tangzh Date: Mon, 14 Jul 2025 16:25:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BusDeviceServiceImpl.java | 24 +++++++++---------- .../impl/BusUserDeviceServiceImpl.java | 5 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java index 8ae9d7a..ae32751 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java @@ -15,7 +15,7 @@ */ package me.zhengjie.modules.system.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import me.zhengjie.exception.BadRequestException; import me.zhengjie.modules.front.domain.dto.DeviceLogCriteria; import me.zhengjie.modules.front.service.WeChatService; @@ -64,7 +64,7 @@ public class BusDeviceServiceImpl extends ServiceImpl().in(BusDevice::getDeviceCode, deviceCode)); + return busDeviceMapper.selectOne(new QueryWrapper().eq("device_code", deviceCode)); } @Override @@ -74,7 +74,7 @@ public class BusDeviceServiceImpl extends ServiceImpl().eq(BusDevice::getDeviceSn, deviceSn)); + return busDeviceMapper.selectOne(new QueryWrapper().eq("device_sn", deviceSn)); } @Async @@ -93,7 +93,7 @@ public class BusDeviceServiceImpl extends ServiceImpl newList = entity.getCommandList(); - List oldList = busCommandMapper.selectList(new LambdaQueryWrapper().eq(BusDeviceCommand::getDeviceId, device.getId())); + List oldList = busCommandMapper.selectList(new QueryWrapper().eq("device_id", device.getId())); if (newList.isEmpty() && !oldList.isEmpty()) { List dIds = oldList.stream().map(BusDeviceCommand::getId).collect(Collectors.toList()); busCommandMapper.deleteBatchIds(dIds); @@ -175,15 +175,15 @@ public class BusDeviceServiceImpl extends ServiceImpl().eq(BusDevice::getDeviceCode, deviceCode)); + BusDevice device = getByDeviceCode(deviceCode); if (null == device) { throw new BadRequestException("二维码有误,未查询到设备信息"); } JwtUserDto jwtUser = (JwtUserDto) SecurityUtils.getCurrentUser(); User user = jwtUser.getUser(); - BusUserDevice udEntity = userDeviceMapper.selectOne(new LambdaQueryWrapper() - .eq(BusUserDevice::getDeviceId, device.getId()) - .eq(BusUserDevice::getUserId, user.getId()) + BusUserDevice udEntity = userDeviceMapper.selectOne(new QueryWrapper() + .eq("device_id", device.getId()) + .eq("user_id", user.getId()) ); if (null != udEntity) { throw new BadRequestException("您已绑定过该设备,请勿重复绑定"); @@ -192,10 +192,10 @@ public class BusDeviceServiceImpl extends ServiceImpl commands = busCommandMapper.selectList(new LambdaQueryWrapper().eq(BusDeviceCommand::getDeviceId, device.getId())); - if (commands.isEmpty()) { return; } - List commandIds = commands.stream().map(BusDeviceCommand::getId).collect(Collectors.toList()); - busUserCommandMapper.bindingCommand(user.getId(), commandIds); + // List commands = busCommandMapper.selectList(new LambdaQueryWrapper().eq(BusDeviceCommand::getDeviceId, device.getId())); + // if (commands.isEmpty()) { return; } + // List commandIds = commands.stream().map(BusDeviceCommand::getId).collect(Collectors.toList()); + // busUserCommandMapper.bindingCommand(user.getId(), commandIds); } @Override diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusUserDeviceServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusUserDeviceServiceImpl.java index 634e507..0bf3331 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusUserDeviceServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusUserDeviceServiceImpl.java @@ -15,7 +15,6 @@ */ package me.zhengjie.modules.system.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import me.zhengjie.modules.system.domain.BusUser; import me.zhengjie.modules.system.domain.BusUserCommand; @@ -51,8 +50,8 @@ public class BusUserDeviceServiceImpl extends ServiceImpl userDevices = commands.stream().filter(i -> i.getId().contains("d")).collect(Collectors.toList()); List userCommands = commands.stream().filter(i -> i.getId().contains("c")).collect(Collectors.toList()); - List oldUserDevices = busUserDeviceMapper.selectList(new LambdaQueryWrapper().eq(BusUserDevice::getUserId, busUser.getId())); - List oldUserCommands = busUserCommandMapper.selectList(new LambdaQueryWrapper().eq(BusUserCommand::getUserId, busUser.getId())); + List oldUserDevices = busUserDeviceMapper.selectList(new QueryWrapper().eq("user_id", busUser.getId())); + List oldUserCommands = busUserCommandMapper.selectList(new QueryWrapper().eq("user_id", busUser.getId())); if (!oldUserDevices.isEmpty()) { List delIds = oldUserDevices.stream().map(i -> i.getId()).collect(Collectors.toList()); busUserDeviceMapper.deleteBatchIds(delIds);