PageHelper複雜分頁
三張表關聯,查詢出滿足條件的記錄,分頁顯示出來
封裝的物件
public class RefundInfoVo implements Serializable {
private BigDecimal refundInfoId;
private String refundsLocation;
private Date refundsDate;
private String receiptorName;
private String payeesPhone;
private String agentsName;
private String agentsPhone;
private String accountsName;
private String accountsNo;
private String banksName;
private BigDecimal refundAmtLowercase;
private String refundAmtLowercaseCurrency;
private String refundAmtUppercase;
private String refundAmtUppercaseCurrency;
private String refundReason;
private String refundReasonDsc;
private String operatorRefundName;
private Date createRefundDtm;
private Date updateRefundDtm;
private String createpersonId;
private String updatepersonId;
private String operatorId;
private BigDecimal status;
private Date approvalDate;
private String approvalRemark;
private static final long serialVersionUID = 1L;
private List<TBfuRefundPassengerInfo> refundPassengerInfos;
private List<TBfuAttachment> attachmentList;
}
業務層實現
public interface AfterSaleService {
public PageInfo<RefundInfoVo> getAllRefundInfoAsPageInfo(Integer pageNum, String refundTktNo, String refundPassagerName);
/**
* 分頁顯示所有滿足條件的退票單資訊
* @return
*/
@Override
public PageInfo<RefundInfoVo> getAllRefundInfoAsPageInfo(Integer pageNum, String refundTktNo, String refundPassagerName) {
List<RefundInfoVo> refundInfoVos=new ArrayList<RefundInfoVo>();
PageInfo<RefundInfoVo> info=null;
String refundTktNo01="";
String refundPassagerName01="";
try {
Page<RefundInfoVo> page = PageHelper.startPage(pageNum, 10);
System.out.println("==============getAllRefundInfoAsPageInfo=========================");
if(!StringUtil.isEmpty(refundTktNo)){
refundTktNo01="%"+refundTktNo+"%";
}
if(!StringUtil.isEmpty(refundPassagerName)){
refundPassagerName01="%"+refundPassagerName+"%";
}
List<BigDecimal> refundMainInfoIds = afterSaleDao.getAllRefundInfoAsPageInfo(refundTktNo01, refundPassagerName01);
info= new PageInfo<>(page.getResult());
for (BigDecimal refundMainInfoId : refundMainInfoIds) {
RefundInfoVo refundInfoVo = tBfuRefundMaininfoMapperExtend.selectByPrimaryKey(refundMainInfoId);
List<TBfuRefundPassengerInfo> tBfuRefundPassengerInfos = tBfuRefundPassengerInfoMapperExtend.selectByRefundMainInfoId(refundMainInfoId);
List<TBfuAttachment> tBfuAttachments = tBfuAttachmentMapperExtend.selectByRefundMainInfoId(refundMainInfoId);
refundInfoVo.setRefundPassengerInfos(tBfuRefundPassengerInfos);
refundInfoVo.setAttachmentList(tBfuAttachments);
refundInfoVos.add(refundInfoVo);
}
info.setList(refundInfoVos);
log.info("退票所有資訊查詢返回的集合為:{}",info);
} catch (Exception e) {
e.printStackTrace();
log.error("分頁展示所有的退票資訊發生異常,{}",e);
}
return info;
}
dao層介面
public interface AfterSaleDao{
List<BigDecimal> getAllRefundInfoAsPageInfo(@Param("refundTktNo") String refundTktNo01,@Param("refundPassagerName") String refundPassagerName01);
}
mybatis.xml的配置
<select id="getAllRefundInfoAsPageInfo" resultType="bigDecimal">
select REFUND_INFO_ID from (select distinct m.REFUND_INFO_ID as REFUND_INFO_ID ,m.CREATE_REFUND_DTM from t_bfu_refund_maininfo m left join T_BFU_REFUND_PASSENGER_INFO p on m.refund_info_id=p.refund_maininfo_id left join t_bfu_attachment a
on m.refund_info_id=a.key_1
where 1=1
<if test="refundTktNo!=null and refundTktNo!=''">
AND p.REFUND_TICKET like #{refundTktNo}
</if>
<if test="refundPassagerName!=null and refundPassagerName!=''">
AND p.REFUND_PASSENGER_NAME like #{refundPassagerName}
</if>
order by m.CREATE_REFUND_DTM desc)
</select>
測試
{
"total": 24,
"list": [
{
"refundInfoId": 1042,
"refundsLocation": "555",
"refundsDate": "2020-12-01T16:00:00.000+0000",
"receiptorName": "55",
"payeesPhone": "555",
"agentsName": "5555",
"agentsPhone": "555",
"accountsName": "55",
"accountsNo": "5555",
"banksName": "55",
"refundAmtLowercase": 555,
"refundAmtLowercaseCurrency": "CNY",
"refundAmtUppercase": "伍佰伍拾伍元整",
"refundAmtUppercaseCurrency": "CNY",
"refundReason": "自願退票",
"refundReasonDsc": "5555",
"operatorRefundName": "55",
"createRefundDtm": "2020-12-01T16:00:00.000+0000",
"updateRefundDtm": "2020-12-01T16:00:00.000+0000",
"createpersonId": "yc_sha_00",
"updatepersonId": null,
"operatorId": "55",
"status": 2,
"approvalDate": "2020-12-01T16:00:00.000+0000",
"approvalRemark": null,
"refundPassengerInfos": [
{
"ticketNo": "555-",
"amountPaid": 55,
"completeRouting": "555",
"usedAmount": 55,
"usedSector": "55",
"fareRefunded": 555,
"refundTicket": "555",
"taxRefunded": 55,
"issueDate": "2020-12-01T16:00:00.000+0000",
"serviceCharge": 55,
"issuePlace": "555",
"amountRefunded": 555,
"refundPassengerId": 1043,
"refundMaininfoId": 1042,
"refundPassengerName": "111"
}
],
"attachmentList": []
},
{
"refundInfoId": 1043,
"refundsLocation": "6666",
"refundsDate": "2020-12-01T16:00:00.000+0000",
"receiptorName": "66",
"payeesPhone": "6666",
"agentsName": "6",
"agentsPhone": "6666",
"accountsName": "6",
"accountsNo": "66",
"banksName": "66",
"refundAmtLowercase": 666,
"refundAmtLowercaseCurrency": "CNY",
"refundAmtUppercase": "陸佰陸拾陸元整",
"refundAmtUppercaseCurrency": "CNY",
"refundReason": "自願退票",
"refundReasonDsc": "666",
"operatorRefundName": "6666",
"createRefundDtm": "2020-12-01T16:00:00.000+0000",
"updateRefundDtm": "2020-12-01T16:00:00.000+0000",
"createpersonId": "yc_sha_00",
"updatepersonId": null,
"operatorId": "6666",
"status": 2,
"approvalDate": "2020-12-01T16:00:00.000+0000",
"approvalRemark": null,
"refundPassengerInfos": [
{
"ticketNo": "666-",
"amountPaid": 6,
"completeRouting": "666",
"usedAmount": 66,
"usedSector": "66",
"fareRefunded": 66,
"refundTicket": "666",
"taxRefunded": 66,
"issueDate": "2020-12-07T16:00:00.000+0000",
"serviceCharge": 66,
"issuePlace": "66",
"amountRefunded": 66,
"refundPassengerId": 1044,
"refundMaininfoId": 1043,
"refundPassengerName": "111"
}
],
"attachmentList": []
},
{
"refundInfoId": 1044,
"refundsLocation": "777777",
"refundsDate": "2020-12-01T16:00:00.000+0000",
"receiptorName": "7777",
"payeesPhone": "7777",
"agentsName": "7777",
"agentsPhone": "7777",
"accountsName": "7777",
"accountsNo": "7777",
"banksName": "7777",
"refundAmtLowercase": 7777,
"refundAmtLowercaseCurrency": "CNY",
"refundAmtUppercase": "柒仟柒佰柒拾柒元整",
"refundAmtUppercaseCurrency": "CNY",
"refundReason": "自願退票",
"refundReasonDsc": "7777",
"operatorRefundName": "7777",
"createRefundDtm": "2020-12-01T16:00:00.000+0000",
"updateRefundDtm": "2020-12-01T16:00:00.000+0000",
"createpersonId": "yc_sha_00",
"updatepersonId": "yc_sha_00",
"operatorId": "7777",
"status": 10,
"approvalDate": "2020-12-01T16:00:00.000+0000",
"approvalRemark": null,
"refundPassengerInfos": [
{
"ticketNo": "7777",
"amountPaid": 7777,
"completeRouting": "7777",
"usedAmount": 7777,
"usedSector": "7777",
"fareRefunded": 7777,
"refundTicket": "7777",
"taxRefunded": 7777,
"issueDate": "2020-12-01T16:00:00.000+0000",
"serviceCharge": 7777,
"issuePlace": "7777",
"amountRefunded": 7777,
"refundPassengerId": 1045,
"refundMaininfoId": 1044,
"refundPassengerName": "111"
}
],
"attachmentList": []
},
{
"refundInfoId": 3343,
"refundsLocation": "333",
"refundsDate": "2020-12-01T16:00:00.000+0000",
"receiptorName": "33",
"payeesPhone": "33",
"agentsName": "3",
"agentsPhone": "3",
"accountsName": "33",
"accountsNo": "3",
"banksName": "333",
"refundAmtLowercase": 3333,
"refundAmtLowercaseCurrency": "CNY",
"refundAmtUppercase": "叄仟叄佰叄拾叄元整",
"refundAmtUppercaseCurrency": "CNY",
"refundReason": "自願退票",
"refundReasonDsc": "33333",
"operatorRefundName": "333",
"createRefundDtm": "2020-12-01T16:00:00.000+0000",
"updateRefundDtm": "2020-12-01T16:00:00.000+0000",
"createpersonId": "yc_sha_00",
"updatepersonId": null,
"operatorId": "yc_sha_00",
"status": 2,
"approvalDate": "2020-12-01T16:00:00.000+0000",
"approvalRemark": null,
"refundPassengerInfos": [],
"attachmentList": []
}
],
"pageNum": 3,
"pageSize": 10,
"size": 4,
"startRow": 21,
"endRow": 24,
"pages": 3,
"prePage": 2,
"nextPage": 0,
"isFirstPage": false,
"isLastPage": true,
"hasPreviousPage": true,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3
],
"navigateFirstPage": 1,
"navigateLastPage": 3
}
相關文章
- SpringBoot 整合Mybatis + PageHelper 實現分頁Spring BootMyBatis
- Mybatis 分頁:Pagehelper + 攔截器實現MyBatis
- PageHelper 分頁外掛使用中的那些“坑”
- 複雜頁面架構架構
- Mybatis第三方PageHelper分頁外掛原理MyBatis
- springboot3+vue3(六)文章列表條件分頁(PageHelper)Spring BootVue
- Spring Boot入門系列(十六)使用pagehelper實現分頁功能Spring Boot
- springboot整合分頁外掛pageHelper 返回全部資料問題Spring Boot
- SpringBoot中使用Mybatis-plus整合PageHelper分頁外掛踩坑Spring BootMyBatis
- Spring Data Jpa 複雜查詢總結 (多表關聯 以及 自定義分頁 )Spring
- pagehelper踩坑記之分頁亂套
- SpringBoot中分頁外掛PageHelper的使用Spring Boot
- Springboot 整合通用mapper和pagehelper展示分頁資料(附github原始碼)Spring BootAPPGithub原始碼
- SpringBoot+Mybatis+ Druid+PageHelper 實現多資料來源並分頁Spring BootMyBatisUI
- DDD之理解複雜度、尊重複雜度、掌控複雜度複雜度
- 使用 Slow Admin 構建較複雜的頁面
- pageHelper分頁外掛導致的查詢慢的問題最佳化
- 得嘞,分頁外掛 PageHelper 返回記錄總數 total 竟然出錯了!
- 【譯】如何合理地處理複雜TableView頁面View
- 網頁中複雜伴隨式動畫的分析網頁動畫
- 複雜多邊形的三角剖分
- 時間複雜度與空間複雜度時間複雜度
- 複雜性Complex與複雜Complicated區別 - Sonja
- 時間複雜度和空間複雜度時間複雜度
- 時間複雜度跟空間複雜度時間複雜度
- 複雜度分析複雜度
- 複雜度分析的套路及常見的複雜度複雜度
- 時間複雜度O(n)和空間複雜度時間複雜度
- Kubernetes 複雜嗎?可以不復雜
- MySQL order by limit 分頁資料重複問題MySqlMIT
- 複雜連結串列的複製
- 【題解】AGC007E | 二分答案 複雜度分析GC複雜度
- 淺析程式碼圈複雜度及認知複雜度複雜度
- Spring boot入門(三):整合AdminLTE(Freemarker),結合generate程式碼生成器,利用DataTable和PageHelper分頁Spring Boot
- 複雜控制語句
- SQL 複雜查詢SQL
- 《演算法筆記一》複雜度、排序、二分、異或演算法筆記複雜度排序
- 時間複雜度怎麼算?如何計算時間複雜度?時間複雜度