change - 传感器分页问题处理。传感器信息中的列表,分页功能出现显示所有信息的情况

main
wenjy 3 years ago
parent 7169f305d1
commit e86b062eaa

@ -74,22 +74,7 @@ public class BaseSensorInfoController extends BaseController {
@ResponseBody
public TableDataInfo list(BaseSensorInfo baseSensorInfo) {
startPage();
//List<BaseSensorInfoDto> list = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
List<BaseSensorInfoDto> list = new ArrayList<>();
SysUser sysUser = ShiroUtils.getSysUser();
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
if(ShiroUtils.getLoginName().equals("admin")){
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
list.addAll(baseSensorInfoDtos);
}else{
for (SysRole sysRole : sysRoles) {
baseSensorInfo.setRoleId(sysRole.getRoleId());
List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
list.addAll(baseSensorInfoDtos);
}
}
List<BaseSensorInfoDto> list = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
return getDataTable(list);
}

@ -162,6 +162,7 @@
fixedColumns: true,
fixedNumber: 6,
fixedRightNumber: 1,
sidePagination: "client",
columns: [{
checkbox: true
},
@ -310,10 +311,6 @@
pageNumber: 1, //当前第几页
pageList: [5, 10, 15, 20, 25], //记录数可选列表
striped: true, //显示行间隔色
// search: true, //启用查询
// showColumns: true, //显示下拉框勾选要显示的列
// showRefresh: true, //显示刷新按钮
// showToggle:true, //显示切换视图模式按钮
sortOrder: "asc", //排序方式
sidePagination: "server", //分页方式client客户端分页server服务端分页
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder

@ -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> 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);
return baseSensorInfoDtos;
list.addAll(baseSensorInfoDtos);
}
}
return baseSensorInfoMapper.selectBaseSensorInfoList(baseSensorInfo);
return list;
}catch (Exception ex) {
System.out.println(ex.getMessage());
return null;

Loading…
Cancel
Save