fix(oa/erp): 修复合同台账报表分页功能

- 在Controller层添加PageQuery参数支持分页查询
- 更新Mapper接口使用MPJLambdaWrapper和Page分页对象
- 修改Service实现类添加分页逻辑和序号计算
- 在VO对象中新增index字段用于显示序号
- 实现分页数据的序号自动编号功能
dev
Yangk 3 days ago
parent 4654c9ffbd
commit b0320d5bde

@ -6,6 +6,7 @@ import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.log.annotation.Log; import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
import org.dromara.oa.erp.service.IContractLedgerReportService; import org.dromara.oa.erp.service.IContractLedgerReportService;
@ -33,8 +34,8 @@ public class ContractLedgerReportController extends BaseController {
*/ */
// @SaCheckPermission("oa:erp:contractLedgerReport:list") // @SaCheckPermission("oa:erp:contractLedgerReport:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo<ContractLedgerReportVo> list(ContractLedgerReportVo bo) { public TableDataInfo<ContractLedgerReportVo> list(ContractLedgerReportVo bo, PageQuery pageQuery) {
return reportService.queryContractLedgerList(bo); return reportService.queryContractLedgerList(bo, pageQuery);
} }
/** /**

@ -25,6 +25,9 @@ public class ContractLedgerReportVo implements Serializable {
private List<Long> contractIdList; private List<Long> contractIdList;
@ExcelProperty({"序号", "序号"})
private Integer index;
@ExcelProperty({"月份", "月份"}) @ExcelProperty({"月份", "月份"})
private String month; private String month;

@ -1,8 +1,9 @@
package org.dromara.oa.erp.mapper; package org.dromara.oa.erp.mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.ErpContractInfo;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
@ -13,9 +14,14 @@ import java.util.List;
*/ */
public interface ContractLedgerReportMapper { public interface ContractLedgerReportMapper {
/**
*
*/
Page<ContractLedgerReportVo> selectContractLedgerList(@Param("page") Page<ContractLedgerReportVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<ErpContractInfo> wrapper);
/** /**
* *
*/ */
List<ContractLedgerReportVo> selectContractLedgerList(@Param(Constants.WRAPPER) Wrapper<ErpContractInfo> wrapper); List<ContractLedgerReportVo> selectContractLedgerList(@Param(Constants.WRAPPER) MPJLambdaWrapper<ErpContractInfo> wrapper);
} }

@ -1,5 +1,6 @@
package org.dromara.oa.erp.service; package org.dromara.oa.erp.service;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo;
@ -13,7 +14,7 @@ public interface IContractLedgerReportService {
/** /**
* *
*/ */
TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo); TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo, PageQuery pageQuery);
/** /**
* (使) * (使)

@ -15,6 +15,8 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/** /**
* Service * Service
*/ */
@ -51,15 +53,23 @@ public class ContractLedgerReportServiceImpl implements IContractLedgerReportSer
} }
@Override @Override
public TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo) { public TableDataInfo<ContractLedgerReportVo> queryContractLedgerList(ContractLedgerReportVo bo, PageQuery pageQuery) {
MPJLambdaWrapper<ErpContractInfo> lqw = buildQueryWrapper(bo); MPJLambdaWrapper<ErpContractInfo> lqw = buildQueryWrapper(bo);
List<ContractLedgerReportVo> list = reportMapper.selectContractLedgerList(lqw); Page<ContractLedgerReportVo> result = reportMapper.selectContractLedgerList(pageQuery.build(), lqw);
return TableDataInfo.build(list); List<ContractLedgerReportVo> list = result.getRecords();
for (int i = 0; i < list.size(); i++) {
list.get(i).setIndex((int) ((pageQuery.getPageNum() - 1) * pageQuery.getPageSize() + i + 1));
}
return TableDataInfo.build(result);
} }
@Override @Override
public List<ContractLedgerReportVo> queryContractLedgerAll(ContractLedgerReportVo bo) { public List<ContractLedgerReportVo> queryContractLedgerAll(ContractLedgerReportVo bo) {
MPJLambdaWrapper<ErpContractInfo> lqw = buildQueryWrapper(bo); MPJLambdaWrapper<ErpContractInfo> lqw = buildQueryWrapper(bo);
return reportMapper.selectContractLedgerList(lqw); List<ContractLedgerReportVo> list = reportMapper.selectContractLedgerList(lqw);
for (int i = 0; i < list.size(); i++) {
list.get(i).setIndex(i + 1);
}
return list;
} }
} }

Loading…
Cancel
Save