diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/SmDeviceMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/SmDeviceMapper.xml index f833e126..cd8f3179 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/SmDeviceMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/SmDeviceMapper.xml @@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sm.model_name as model, sm.picture as picture, sm.tags as model_tags, + ss.user_id as user_id, ss.name as store_name, su.user_name as user_name from sm_device sd @@ -296,8 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sm_device - set user_id = null, - store_id = null + set store_id = null where device_id = #{deviceId} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java index 65e08bec..4407ffce 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java @@ -135,19 +135,21 @@ public class StoreServiceImpl implements IStoreService public List listCount(StoreQuery query) { List list = new ArrayList<>(); + // 查询各各店铺的设备数据 + List storeList = storeMapper.selectSmStoreList(query); + storeAssembler.assembleDeviceCount(storeList); + // 查询全部设备数据 SmDeviceQuery deviceDto = new SmDeviceQuery(); - deviceDto.setUserId(query.getUserId()); + deviceDto.setStoreIds(storeList.stream().map(StoreVo::getStoreId).collect(Collectors.toList())); int count = smDeviceService.selectCount(deviceDto); StoreVo all = new StoreVo(); all.setDeviceCount(count); all.setName("全部"); - list.add(all); - // 查询各各店铺的设备数据 - List storeList = storeMapper.selectSmStoreList(query); - storeAssembler.assembleDeviceCount(storeList); + list.add(all); list.addAll(storeList); + return list; }