From 13397d5c78868fe3cc7b12a6369e5237c59ba8d2 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Sat, 1 Jun 2024 15:41:42 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=95=B0=E6=8D=AE=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/AsDeviceController.java | 2 +- .../com/ruoyi/system/domain/vo/EtOrderVo.java | 2 +- .../ruoyi/system/mapper/AsDeviceMapper.java | 8 +++++ .../system/service/IAsDeviceService.java | 8 +++++ .../service/impl/AsDeviceServiceImpl.java | 34 ++++++++++++++++++- .../mapper/system/AsDeviceMapper.xml | 21 ++++++++++++ 6 files changed, 72 insertions(+), 3 deletions(-) diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java index 5133917..f3c737e 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java @@ -43,7 +43,7 @@ public class AsDeviceController extends BaseController public TableDataInfo list(AsDevice asDevice) { startPage(); - List list = asDeviceService.selectAsDeviceList(asDevice); + List list = asDeviceService.selectAsDeviceListWithIsolate(asDevice); return getDataTable(list); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/EtOrderVo.java b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/EtOrderVo.java index 7b582ed..214266e 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/EtOrderVo.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/EtOrderVo.java @@ -10,7 +10,7 @@ import lombok.Data; @Data public class EtOrderVo { - /** 用户id */ + /** 用户id Cannot deserialize value of type `long` from String "union select 1,md5(3141592657)--": not a valid `long` value */ private Long userId; /** 设备编码 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java index 9523a18..363a136 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java @@ -47,6 +47,14 @@ public interface AsDeviceMapper extends BaseMapper */ public List selectAsDeviceList(AsDevice asDevice); + /** + * 查询设备列表(带数据隔离) + * + * @param asDevice 设备 + * @return 设备集合 + */ + public List selectAsDeviceListWithIsolate(AsDevice asDevice); + /** * 新增设备 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java index d9a8c3e..9bcb4d4 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java @@ -50,6 +50,14 @@ public interface IAsDeviceService extends IService */ public List selectAsDeviceList(AsDevice asDevice); + /** + * 查询设备列表 + * + * @param asDevice 设备 + * @return 设备集合 + */ + public List selectAsDeviceListWithIsolate(AsDevice asDevice); + /** * 新增设备 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index f1feb2a..e9e1076 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -165,7 +165,6 @@ public class AsDeviceServiceImpl extends ServiceImpl i * @return 设备 */ @Override - @DataScope(deptAlias = "d") public List selectAsDeviceList(AsDevice asDevice) { List asDevices = asDeviceMapper.selectAsDeviceList(asDevice); @@ -191,6 +190,39 @@ public class AsDeviceServiceImpl extends ServiceImpl i return asDevices; } + /** + * 查询设备列表 + * + * @param asDevice 设备 隔离 + * @return 设备 + */ + @Override + @DataScope(deptAlias = "d") + public List selectAsDeviceListWithIsolate(AsDevice asDevice) + { + List asDevices = asDeviceMapper.selectAsDeviceListWithIsolate(asDevice); + for (AsDevice asDevice1:asDevices){ + Long areaId = asDevice1.getAreaId(); + if (ObjectUtil.isNotNull(areaId)){ + EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId); + asDevice1.setAreaName(etOperatingArea.getAreaName()); + } + Long modelId = asDevice1.getModelId(); + if (ObjectUtil.isNotNull(modelId)){ + EtModel model = etModelService.selectEtModelByModelId(modelId); + if(ObjectUtil.isNotNull(model)){ + asDevice1.setModel(model.getModel()); + } + } + String status = asDevice1.getStatus(); + if(ObjectUtil.isNotNull(status)){ + String typeName = sysDictDataService.selectDictLabel("as_device_status", status); + asDevice1.setStatusStr(typeName); + } + } + return asDevices; + } + /** * 新增设备 * diff --git a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml index 4cc5f80..6c2d66c 100644 --- a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml @@ -57,6 +57,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} + +