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

main
wenjy 3 years ago
parent 7169f305d1
commit e86b062eaa

@ -74,22 +74,7 @@ public class BaseSensorInfoController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo list(BaseSensorInfo baseSensorInfo) { public TableDataInfo list(BaseSensorInfo baseSensorInfo) {
startPage(); startPage();
//List<BaseSensorInfoDto> list = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); 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);
}
}
return getDataTable(list); return getDataTable(list);
} }

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

@ -5,12 +5,15 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.Ztree; 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.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.domain.dto.BaseSensorInfoDto; import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseSensorInfoMapper; import com.ruoyi.system.mapper.BaseSensorInfoMapper;
@ -30,6 +33,9 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService
@Autowired @Autowired
private BaseSensorInfoMapper baseSensorInfoMapper; private BaseSensorInfoMapper baseSensorInfoMapper;
@Autowired
private ISysRoleService iSysRoleService;
/** /**
* *
* *
@ -52,11 +58,23 @@ public class BaseSensorInfoServiceImpl implements IBaseSensorInfoService
public List<BaseSensorInfoDto> selectBaseSensorInfoList(BaseSensorInfo baseSensorInfo) public List<BaseSensorInfoDto> selectBaseSensorInfoList(BaseSensorInfo baseSensorInfo)
{ {
try{ 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); List<BaseSensorInfoDto> baseSensorInfoDtos = baseSensorInfoMapper.selectBaseSensorInfoListByRoleId(baseSensorInfo);
return baseSensorInfoDtos; list.addAll(baseSensorInfoDtos);
}
} }
return baseSensorInfoMapper.selectBaseSensorInfoList(baseSensorInfo);
return list;
}catch (Exception ex) { }catch (Exception ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
return null; return null;

Loading…
Cancel
Save