mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge remote-tracking branch 'origin/dev' into dev-zzx
This commit is contained in:
@@ -435,8 +435,8 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
if (CollectionUtils.isEmpty(pileSns) && CollectionUtils.isEmpty(connectorIds) && CollectionUtils.isEmpty(connectorCodeList)) {
|
||||
return new PageResponse();
|
||||
}
|
||||
// 分页
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
// 分页 (2025.06.16 改为 先查询数据,再总体手动分页)
|
||||
// PageHelper.startPage(pageNum, pageSize);
|
||||
|
||||
List<PileConnectorInfoVO> pileConnectorInfoList = pileConnectorInfoMapper.getPileConnectorInfoList(pileSns, connectorIds, connectorCodeList);
|
||||
|
||||
@@ -450,11 +450,24 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
put(Integer.parseInt(PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue()), 5); // 离线 → 5
|
||||
}});
|
||||
pileConnectorInfoList.sort(
|
||||
Comparator.comparingInt((PileConnectorInfoVO vo) -> priority.get(vo.getStatus()))
|
||||
.thenComparing(PileConnectorInfoVO::getPileConnectorCode) // 状态相同则按枪口号排序
|
||||
Comparator.comparingInt((PileConnectorInfoVO vo) ->
|
||||
priority.getOrDefault(vo.getStatus(), Integer.MAX_VALUE)) // 未定义状态排最后
|
||||
.thenComparing(PileConnectorInfoVO::getPileConnectorCode,
|
||||
Comparator.nullsLast(Comparator.naturalOrder())) // 处理可能的null值
|
||||
);
|
||||
|
||||
PageInfo<PileConnectorInfoVO> pageInfo = new PageInfo<>(pileConnectorInfoList);
|
||||
// 4. 手动分页(取出当前页的数据)
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, pileConnectorInfoList.size());
|
||||
List<PileConnectorInfoVO> pagedList = pileConnectorInfoList.subList(fromIndex, toIndex);
|
||||
|
||||
// PageInfo<PileConnectorInfoVO> pageInfo = new PageInfo<>(pileConnectorInfoList);
|
||||
|
||||
// 5. 构造 PageInfo(注意:PageInfo 需要总记录数)
|
||||
PageInfo<PileConnectorInfoVO> pageInfo = new PageInfo<>(pagedList);
|
||||
pageInfo.setTotal(pileConnectorInfoList.size()); // 设置总记录数
|
||||
pageInfo.setPageNum(pageNum); // 设置当前页码
|
||||
pageInfo.setPageSize(pageSize); // 设置每页大小
|
||||
|
||||
// 查询枪口当前订单
|
||||
for (PileConnectorInfoVO pileConnectorInfoVO : pageInfo.getList()) {
|
||||
|
||||
Reference in New Issue
Block a user