From f8eb314bd04fb85025573228f054c4dc679396a8 Mon Sep 17 00:00:00 2001 From: kerwincui <164770707@qq.com> Date: Sat, 4 Jun 2022 13:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=8F=AA=E8=83=BD=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E8=87=AA=E5=B7=B1=E7=9A=84=E4=BA=A7=E5=93=81=E3=80=81?= =?UTF-8?q?=E5=9B=BA=E4=BB=B6=E3=80=81=E5=88=86=E7=BB=84=E5=92=8C=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E4=B8=8B=E8=AE=BE=E5=A4=87=E4=BB=A5=E5=8F=8A=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=AE=9A=E4=B9=89=E7=9A=84=E7=89=A9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=92=8C=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/service/impl/DeviceServiceImpl.java | 2 ++ .../iot/service/impl/GroupServiceImpl.java | 4 ++-- .../resources/mapper/iot/DeviceMapper.xml | 2 +- .../resources/mapper/iot/FirmwareMapper.xml | 2 +- .../resources/mapper/iot/ProductMapper.xml | 2 +- vue/src/views/iot/category/index.vue | 14 +++++++------- vue/src/views/iot/device/index.vue | 1 + vue/src/views/iot/firmware/index.vue | 19 +++---------------- vue/src/views/iot/product/index.vue | 1 + 9 files changed, 19 insertions(+), 28 deletions(-) diff --git a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java index 10123873..d745caab 100644 --- a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java +++ b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/DeviceServiceImpl.java @@ -247,9 +247,11 @@ public class DeviceServiceImpl implements IDeviceService { if(roles.get(i).getRoleKey().equals("tenant")){ // 租户查看产品下所有设备 device.setTenantId(user.getUserId()); + break; }else if (roles.get(i).getRoleKey().equals("general")){ // 用户查看自己设备 device.setUserId(user.getUserId()); + break; } } return deviceMapper.selectAllDeviceShortList(device); diff --git a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/GroupServiceImpl.java b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/GroupServiceImpl.java index f0545867..010d1b36 100644 --- a/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/GroupServiceImpl.java +++ b/springboot/wumei-iot/src/main/java/com/ruoyi/iot/service/impl/GroupServiceImpl.java @@ -67,8 +67,8 @@ public class GroupServiceImpl implements IGroupService SysUser user = getLoginUser().getUser(); List roles=user.getRoles(); for(int i=0;i and product_name like concat('%', #{productName}, '%') and user_id = #{userId} and user_name like concat('%', #{userName}, '%') - and (tenant_id = #{tenantId} or is_sys = 1) + and tenant_id = #{tenantId} and tenant_name like concat('%', #{tenantName}, '%') and serial_number = #{serialNumber} and status = #{status} diff --git a/springboot/wumei-iot/src/main/resources/mapper/iot/FirmwareMapper.xml b/springboot/wumei-iot/src/main/resources/mapper/iot/FirmwareMapper.xml index 24d9de25..894699b6 100644 --- a/springboot/wumei-iot/src/main/resources/mapper/iot/FirmwareMapper.xml +++ b/springboot/wumei-iot/src/main/resources/mapper/iot/FirmwareMapper.xml @@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and firmware_name like concat('%', #{firmwareName}, '%') and product_name like concat('%', #{productName}, '%') - and (tenant_id = #{tenantId} or is_sys = 1) + and tenant_id = #{tenantId} order by create_time desc diff --git a/springboot/wumei-iot/src/main/resources/mapper/iot/ProductMapper.xml b/springboot/wumei-iot/src/main/resources/mapper/iot/ProductMapper.xml index b7756a6a..bb8a7db4 100644 --- a/springboot/wumei-iot/src/main/resources/mapper/iot/ProductMapper.xml +++ b/springboot/wumei-iot/src/main/resources/mapper/iot/ProductMapper.xml @@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and status = #{status} and device_type = #{deviceType} and network_method = #{networkMethod} - and (tenant_id = #{tenantId} or is_sys = 1) + and tenant_id = #{tenantId} order by create_time desc diff --git a/vue/src/views/iot/category/index.vue b/vue/src/views/iot/category/index.vue index f2db0ad7..9110360d 100644 --- a/vue/src/views/iot/category/index.vue +++ b/vue/src/views/iot/category/index.vue @@ -32,8 +32,8 @@ @@ -54,7 +54,7 @@ @@ -77,8 +77,8 @@ export default { dicts: ["iot_yes_no"], data() { return { - // 判断是否获取到修改权限 - canEdit: false, + // 是否为租户 + isTenant: false, // 遮罩层 loading: true, // 选中数组 @@ -127,8 +127,8 @@ export default { }, methods: { init() { - if (this.$store.state.user.roles.indexOf("admin") !== -1) { - this.canEdit = true + if (this.$store.state.user.roles.indexOf("tenant") !== -1) { + this.isTenant = true } }, /** 查询产品分类列表 */ diff --git a/vue/src/views/iot/device/index.vue b/vue/src/views/iot/device/index.vue index 475169f9..934ea0eb 100644 --- a/vue/src/views/iot/device/index.vue +++ b/vue/src/views/iot/device/index.vue @@ -137,6 +137,7 @@ + diff --git a/vue/src/views/iot/firmware/index.vue b/vue/src/views/iot/firmware/index.vue index 4832a6dc..eeb90753 100644 --- a/vue/src/views/iot/firmware/index.vue +++ b/vue/src/views/iot/firmware/index.vue @@ -19,15 +19,10 @@ - + - - -