mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
列表增加权限
This commit is contained in:
parent
03758082ab
commit
0fa9356dd9
@ -22,6 +22,7 @@ import org.dromara.web.domain.bo.*;
|
|||||||
import org.dromara.web.domain.vo.*;
|
import org.dromara.web.domain.vo.*;
|
||||||
import org.dromara.web.service.*;
|
import org.dromara.web.service.*;
|
||||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -325,7 +326,9 @@ public class EqHomeController extends BaseController {
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public TableDataInfo<EqEquipmentVo> list(EqAppHomeBo bo, PageQuery pageQuery){
|
public TableDataInfo<EqEquipmentVo> list(EqAppHomeBo bo, PageQuery pageQuery){
|
||||||
//当前用户为家庭主体 切换用户后需要传输用户id
|
//当前用户为家庭主体 切换用户后需要传输用户id
|
||||||
if (bo.getUserId() == null) bo.setUserId(LoginHelper.getUserId());
|
Long currentUserId = LoginHelper.getUserId();
|
||||||
|
if (bo.getUserId() == null) bo.setUserId(currentUserId);
|
||||||
|
checkUserId(bo.getUserId(), currentUserId);
|
||||||
// 下面返回的状态 会在设备状态变化时更新设备状态 状态更新由iot触发
|
// 下面返回的状态 会在设备状态变化时更新设备状态 状态更新由iot触发
|
||||||
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
|
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
|
||||||
eqEquipmentBo.setUserId(bo.getUserId());
|
eqEquipmentBo.setUserId(bo.getUserId());
|
||||||
@ -333,6 +336,24 @@ public class EqHomeController extends BaseController {
|
|||||||
return eqEquipmentService.queryPageList(eqEquipmentBo, pageQuery); //在设备表中增加了分布id
|
return eqEquipmentService.queryPageList(eqEquipmentBo, pageQuery); //在设备表中增加了分布id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查要查询的userId 是否为分享给当前用户的userId
|
||||||
|
* 如果不是 则抛出异常
|
||||||
|
* @param userId
|
||||||
|
* @param currentUserId
|
||||||
|
*/
|
||||||
|
private void checkUserId(Long userId, Long currentUserId) {
|
||||||
|
if (!currentUserId.equals(userId)){
|
||||||
|
EqShareBo eqShareBo = new EqShareBo();
|
||||||
|
eqShareBo.setShareUserId(userId);
|
||||||
|
eqShareBo.setSharedUserId(currentUserId);
|
||||||
|
List<EqShareVo> eqShareVos = shareService.queryList(eqShareBo);
|
||||||
|
if (CollectionUtils.isEmpty(eqShareVos)){
|
||||||
|
throw new RuntimeException("您没有权限查看该设备");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备重排
|
* 设备重排
|
||||||
|
|||||||
@ -17,16 +17,15 @@ import org.dromara.web.device.*;
|
|||||||
import org.dromara.web.device.iot.*;
|
import org.dromara.web.device.iot.*;
|
||||||
import org.dromara.web.domain.EqArea;
|
import org.dromara.web.domain.EqArea;
|
||||||
import org.dromara.web.domain.bo.*;
|
import org.dromara.web.domain.bo.*;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
import org.dromara.web.domain.vo.*;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentStatisticsVo;
|
|
||||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
|
||||||
import org.dromara.web.mapper.EqAreaMapper;
|
import org.dromara.web.mapper.EqAreaMapper;
|
||||||
|
import org.dromara.web.service.IEqShareService;
|
||||||
import org.dromara.web.service.IotService;
|
import org.dromara.web.service.IotService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
|
||||||
import org.dromara.web.domain.EqEquipment;
|
import org.dromara.web.domain.EqEquipment;
|
||||||
import org.dromara.web.mapper.EqEquipmentMapper;
|
import org.dromara.web.mapper.EqEquipmentMapper;
|
||||||
import org.dromara.web.service.IEqEquipmentService;
|
import org.dromara.web.service.IEqEquipmentService;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -41,6 +40,7 @@ import java.util.*;
|
|||||||
public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
||||||
|
|
||||||
private final EqEquipmentMapper baseMapper;
|
private final EqEquipmentMapper baseMapper;
|
||||||
|
private final IEqShareService shareService;
|
||||||
|
|
||||||
private final EqAreaMapper areaMapper;
|
private final EqAreaMapper areaMapper;
|
||||||
|
|
||||||
@ -346,4 +346,23 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查要查询的userId 是否为分享给当前用户的userId
|
||||||
|
* 如果不是 则抛出异常 zzc 目前操作不进行对设备控制设置的权限控制 后续如有需要再添加该方法进行验证
|
||||||
|
* @param userId
|
||||||
|
* @param currentUserId
|
||||||
|
*/
|
||||||
|
private void checkUserId(Long userId, Long currentUserId) {
|
||||||
|
if (!currentUserId.equals(userId)){
|
||||||
|
EqShareBo eqShareBo = new EqShareBo();
|
||||||
|
eqShareBo.setShareUserId(userId);
|
||||||
|
eqShareBo.setSharedUserId(currentUserId);
|
||||||
|
List<EqShareVo> eqShareVos = shareService.queryList(eqShareBo);
|
||||||
|
if (CollectionUtils.isEmpty(eqShareVos)){
|
||||||
|
throw new RuntimeException("您没有权限查看该设备");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user