mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
租户只能查看自己的产品、固件、分组和产品下设备以及系统定义的物模型和分类
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -67,8 +67,8 @@ public class GroupServiceImpl implements IGroupService
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
for(int i=0;i<roles.size();i++){
|
||||
if (roles.get(i).getRoleKey().equals("general")){
|
||||
// 用户查看自己设备
|
||||
// 租户和用户,只查看自己分组
|
||||
if(roles.get(i).getRoleKey().equals("tenant") || roles.get(i).getRoleKey().equals("general")){
|
||||
group.setUserId(user.getUserId());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="tenantId != null "> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
|
||||
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="firmwareName != null and firmwareName != ''"> and firmware_name like concat('%', #{firmwareName}, '%')</if>
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="tenantId != null and tenantId != ''"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="deviceType != null "> and device_type = #{deviceType}</if>
|
||||
<if test="networkMethod != null "> and network_method = #{networkMethod}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user