develop
hanrenchun 10 months ago
parent 3856546cb4
commit 0d523c2bc9

@ -0,0 +1,40 @@
package com.ruoyi.common.utils;
import java.util.List;
public class PageByList {
/**
*
* @param list list
* @param pageNum
* @param pageSize
* @return
*/
public static List startPage(List list, Integer pageNum, Integer pageSize) {
if (list == null) {
return null;
}
if (list.size() == 0) {
return null;
}
Integer count = list.size(); // 记录总数
Integer pageCount = 0; // 页数
if (count % pageSize == 0) {
pageCount = count / pageSize;
} else {
pageCount = count / pageSize + 1;
}
int fromIndex = 0; // 开始索引
int toIndex = 0; // 结束索引
if (pageNum != pageCount) {
fromIndex = (pageNum - 1) * pageSize;
toIndex = fromIndex + pageSize;
} else {
fromIndex = (pageNum - 1) * pageSize;
toIndex = count;
}
List pageList = list.subList(fromIndex, toIndex);
return pageList;
}
}

@ -3,11 +3,15 @@ package com.ruoyi.database.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageByList;
import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.database.domain.DevopsVideoStatus; import com.ruoyi.database.domain.DevopsVideoStatus;
import com.ruoyi.database.domain.DisposalInfo; import com.ruoyi.database.domain.DisposalInfo;
@ -38,10 +42,12 @@ public class DisposalInfoController extends BaseController {
@GetMapping @GetMapping
@ApiOperation("查询预警信息处置表") @ApiOperation("查询预警信息处置表")
public TableDataInfo<DisposalInfo> list(TransitHuntersUserModelRecord modelRecord) { public TableDataInfo<DisposalInfo> list(TransitHuntersUserModelRecord modelRecord) {
int count = transitHuntersUserModelRecordService.count(); PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
// int count = transitHuntersUserModelRecordService.count();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
PageUtils.startPage();
QueryWrapper<TransitHuntersUserModelRecord> queryWrapper = new QueryWrapper<>(modelRecord); QueryWrapper<TransitHuntersUserModelRecord> queryWrapper = new QueryWrapper<>(modelRecord);
queryWrapper.orderByDesc("warning_time"); queryWrapper.orderByDesc("warning_time");
List<TransitHuntersUserModelRecord> list1 = transitHuntersUserModelRecordService.list(queryWrapper); List<TransitHuntersUserModelRecord> list1 = transitHuntersUserModelRecordService.list(queryWrapper);
@ -78,19 +84,23 @@ public class DisposalInfoController extends BaseController {
String warningTime = transitHuntersUserModelRecord.getWarningTime(); String warningTime = transitHuntersUserModelRecord.getWarningTime();
LocalDateTime localDateTime = LocalDateTime.parse(warningTime, inputFormatter); LocalDateTime localDateTime = LocalDateTime.parse(warningTime, inputFormatter);
transitHuntersUserModelRecord.setWarningTime(localDateTime.format(formatter)); transitHuntersUserModelRecord.setWarningTime(localDateTime.format(formatter));
if (modelRecord.getDisposalResultCn() != null && modelRecord.getDisposalResultCn().equals(transitHuntersUserModelRecord.getDisposalResultCn())) { if (modelRecord.getSignStatusCn()!=null && modelRecord.getSignStatusCn().equals(transitHuntersUserModelRecord.getSignStatusCn())){
transitHuntersUserModelRecords.add(transitHuntersUserModelRecord); transitHuntersUserModelRecords.add(transitHuntersUserModelRecord);
continue;
} }
if (modelRecord.getSignStatusCn() != null && modelRecord.getSignStatusCn().equals(transitHuntersUserModelRecord.getSignStatusCn())){ if (modelRecord.getDisposalResultCn()!=null && modelRecord.getDisposalResultCn().equals(transitHuntersUserModelRecord.getDisposalResultCn())){
transitHuntersUserModelRecords.add(transitHuntersUserModelRecord); transitHuntersUserModelRecords.add(transitHuntersUserModelRecord);
continue;
} }
if (modelRecord.getSignStatusCn() == null && modelRecord.getDisposalResultCn() == null){ if ( modelRecord.getDisposalResultCn()==null && modelRecord.getSignStatusCn()==null ){
transitHuntersUserModelRecords.add(transitHuntersUserModelRecord); transitHuntersUserModelRecords.add(transitHuntersUserModelRecord);
} }
} }
TableDataInfo dataTable = getDataTable(transitHuntersUserModelRecords); TableDataInfo rspData = new TableDataInfo();
dataTable.setTotal(count); rspData.setCode(200);
return dataTable; rspData.setRows(PageByList.startPage(transitHuntersUserModelRecords, pageNum, pageSize));
rspData.setTotal(new PageInfo(transitHuntersUserModelRecords).getTotal());
return rspData;
} }
@PostMapping @PostMapping

Loading…
Cancel
Save