/**
* 查询【查询上下限当前数据】
*
* @param psns 【psn数组】主键
* @return 【集合】
*/
@Override
public List<Map> selectIotDevPropByPsns(String[] psns){
List<IotDevPropVo> iotDevPropVoList =iotDevPropMapper.selectIotDevPropByPsns(psns);
//合并值
//创建list的长度
List<Map> useSumList = new ArrayList<>(iotDevPropVoList.size());
//循环第一个list
for (int i = 0; i < iotDevPropVoList.size(); i++) {
//拿到下标为0的对象内容
IotDevPropVo item = iotDevPropVoList.get(i);
//判断是否等于当前集合的下标 是的话就结束循环 这么做的只要原因是因为下面的对象复制加1了 避免报错
if (i + 1 == iotDevPropVoList.size()){
break;
}
// 拿到下标为1的对象内容
IotDevPropVo itemNext = iotDevPropVoList.get(i + 1);
//新创建一个集合 用来放值
Map useSum = new HashMap();
//判断条件 自己定义
if (item.getPsn().equals(iotDevPropVoList.get(i).getPsn()) && itemNext.getPsn().equals(iotDevPropVoList.get(i).getPsn())
&&item.getLabel().equals("1")&&itemNext.getLabel().equals("2")) {
//业务逻辑
useSum.put("upperValue",item.getValue());
useSum.put("upperLabel",item.getLabel());
useSum.put("lowerValue",itemNext.getValue());
useSum.put("lowerLabel",itemNext.getLabel());
//字段psn
useSum.put("psn",item.getPsn());
//字段名称
useSum.put("name", item.getNname());
//字段名称
useSum.put("unit", item.getUnit());
useSumList.add(useSum);
}
}
return useSumList;
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/115961.html