forked from dyf/fys-Multi-tenant
管理员
This commit is contained in:
@ -65,4 +65,9 @@ public class DeviceQueryCriteria extends BaseEntity {
|
||||
|
||||
/* app绑定用户id */
|
||||
private Long bindingUserId;
|
||||
|
||||
|
||||
/* 是否为管理员 */
|
||||
private Boolean isAdmin = false;
|
||||
|
||||
}
|
||||
|
||||
@ -35,4 +35,10 @@ public class DeviceTypeQueryCriteria extends BaseEntity implements Serializable
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
|
||||
/* 是否为管理员 */
|
||||
private Boolean isAdmin = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -106,6 +106,13 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
criteria.setDeviceType(deviceTypeGrant.getDeviceTypeId());
|
||||
}
|
||||
}
|
||||
|
||||
// 管理员
|
||||
String username = LoginHelper.getUsername();
|
||||
if (username.equals("admin")) {
|
||||
criteria.setIsAdmin(true);
|
||||
}
|
||||
|
||||
IPage<Device> devices = deviceMapper.findAll(criteria, page);
|
||||
|
||||
List<Device> records = devices.getRecords();
|
||||
|
||||
@ -53,8 +53,12 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<DeviceType> queryAll(DeviceTypeQueryCriteria criteria, Page<DeviceType> page) {
|
||||
criteria.setCustomerId(LoginHelper.getUserId());
|
||||
// return
|
||||
// 管理员
|
||||
String username = LoginHelper.getUsername();
|
||||
if (!username.equals("admin")) {
|
||||
criteria.setCustomerId(LoginHelper.getUserId());
|
||||
}
|
||||
|
||||
IPage<DeviceType> deviceTypeIPage = deviceTypeMapper.findAll(criteria, page);
|
||||
return new TableDataInfo<DeviceType>(deviceTypeIPage.getRecords(), deviceTypeIPage.getTotal());
|
||||
}
|
||||
@ -74,8 +78,16 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
||||
@Override
|
||||
public List<DeviceType> queryDeviceTypes() {
|
||||
DeviceTypeQueryCriteria criteria = new DeviceTypeQueryCriteria();
|
||||
Long userId = LoginHelper.getUserId();
|
||||
criteria.setCustomerId(userId);
|
||||
|
||||
// 管理员
|
||||
String username = LoginHelper.getUsername();
|
||||
if (!username.equals("admin")) {
|
||||
criteria.setCustomerId(LoginHelper.getUserId());
|
||||
|
||||
Long userId = LoginHelper.getUserId();
|
||||
criteria.setCustomerId(userId);
|
||||
}
|
||||
|
||||
return deviceTypeMapper.findAll(criteria);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user