|
|
|
@ -5,12 +5,15 @@ import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.Ztree;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
|
import com.ruoyi.common.exception.BusinessException;
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.system.domain.BaseMonitorunitInfo;
|
|
|
|
|
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.ruoyi.system.mapper.BaseSensorInfoMapper;
|
|
|
|
@ -30,6 +33,9 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService
|
|
|
|
|
@Autowired
|
|
|
|
|
private BaseSensorInfoMapper baseSensorInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysRoleService iSysRoleService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询传感器信息
|
|
|
|
|
*
|
|
|
|
@ -52,11 +58,23 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService
|
|
|
|
|
public List<BaseSensorInfoDto> selectBaseSensorInfoList(BaseSensorInfo baseSensorInfo)
|
|
|
|
|
{
|
|
|
|
|
try{
|
|
|
|
|
if(baseSensorInfo.getRoleId() != null && baseSensorInfo.getRoleId() > 1){
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoMapper.selectBaseSensorInfoListByRoleId(baseSensorInfo);
|
|
|
|
|
return baseSensorInfoDtos;
|
|
|
|
|
List<BaseSensorInfoDto> list = new ArrayList<>();
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoMapper.selectBaseSensorInfoList(baseSensorInfo);
|
|
|
|
|
list.addAll(baseSensorInfoDtos);
|
|
|
|
|
}else{
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
baseSensorInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoMapper.selectBaseSensorInfoListByRoleId(baseSensorInfo);
|
|
|
|
|
list.addAll(baseSensorInfoDtos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return baseSensorInfoMapper.selectBaseSensorInfoList(baseSensorInfo);
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}catch (Exception ex) {
|
|
|
|
|
System.out.println(ex.getMessage());
|
|
|
|
|
return null;
|
|
|
|
|