记得上下班打卡 | git大法好,push需谨慎

Commit 2c8f4a37 authored by 胡佳晨's avatar 胡佳晨

分页提交

parent 3837a853
...@@ -752,7 +752,8 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa ...@@ -752,7 +752,8 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
} else {//演出列表 } else {//演出列表
try { try {
PageHelper.startPage(performancePartnerListParam.getPage(), performancePartnerListParam.getSize()); PageHelper.startPage(performancePartnerListParam.getPage(), performancePartnerListParam.getSize());
List<PerformancePartnerListDao> voList = mongoSlimeUtils.getPerformanceList(performancePartnerListParam); HashMap<String,Object> map = mongoSlimeUtils.getPerformanceList(performancePartnerListParam);
List<PerformancePartnerListDao> voList = (List<PerformancePartnerListDao>) map.get("data");
for (int i = 0; i < voList.size(); i++) { for (int i = 0; i < voList.size(); i++) {
PerformancePartnerListDao vo = voList.get(i); PerformancePartnerListDao vo = voList.get(i);
vo.setSaleGeneral(vo.getNumber() - vo.getRefundNumber()); vo.setSaleGeneral(vo.getNumber() - vo.getRefundNumber());
...@@ -772,6 +773,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa ...@@ -772,6 +773,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
} }
} }
pageInfoTmp = new PageInfo(voList); pageInfoTmp = new PageInfo(voList);
pageInfoTmp.setTotal((Long) map.get("total"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ResponseDto.failure(ErrorMapping.get(20104)); return ResponseDto.failure(ErrorMapping.get(20104));
......
package com.liquidnet.service.slime.util; package com.liquidnet.service.slime.util;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao; import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam; import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
...@@ -255,7 +256,7 @@ public class MongoSlimeUtils { ...@@ -255,7 +256,7 @@ public class MongoSlimeUtils {
return docTicket; return docTicket;
} }
public List<PerformancePartnerListDao> getPerformanceList(PerformancePartnerListParam performancePartnerListParam) { public HashMap<String,Object> getPerformanceList(PerformancePartnerListParam performancePartnerListParam) {
performancePartnerListParam.setOrderType(performancePartnerListParam.getOrderType()); performancePartnerListParam.setOrderType(performancePartnerListParam.getOrderType());
//分页排序 //分页排序
Sort.Direction orderBy = Sort.Direction.DESC; Sort.Direction orderBy = Sort.Direction.DESC;
...@@ -301,7 +302,12 @@ public class MongoSlimeUtils { ...@@ -301,7 +302,12 @@ public class MongoSlimeUtils {
Query.query(new Criteria().andOperator(criteria).orOperator(criteriaPerformanceId, Criteria.where("merchantId").is(performancePartnerListParam.getMerchantId()))) Query.query(new Criteria().andOperator(criteria).orOperator(criteriaPerformanceId, Criteria.where("merchantId").is(performancePartnerListParam.getMerchantId())))
.with(Sort.by(orderBy, performancePartnerListParam.getOrderItem())) .with(Sort.by(orderBy, performancePartnerListParam.getOrderItem()))
.skip(((performancePartnerListParam.getPage() - 1) * performancePartnerListParam.getSize())) .skip(((performancePartnerListParam.getPage() - 1) * performancePartnerListParam.getSize()))
.limit(performancePartnerListParam.getSize()), .limit(performancePartnerListParam.getSize()),
KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
long total = mongoTemplate.count(
Query.query(new Criteria().andOperator(criteria).orOperator(criteriaPerformanceId, Criteria.where("merchantId").is(performancePartnerListParam.getMerchantId())))
.with(Sort.by(orderBy, performancePartnerListParam.getOrderItem())),
KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName()); KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
//查询销量 //查询销量
Aggregation aggregation = Aggregation.newAggregation( Aggregation aggregation = Aggregation.newAggregation(
...@@ -404,8 +410,10 @@ public class MongoSlimeUtils { ...@@ -404,8 +410,10 @@ public class MongoSlimeUtils {
} }
list.add(dao); list.add(dao);
} }
HashMap<String ,Object> map = CollectionUtil.mapStringObject();
return list; map.put("data",list);
map.put("total",total);
return map;
} }
public List<PerformancePartnerListDao> getPerformanceListField(PerformancePartnerListParam performancePartnerListParam) { public List<PerformancePartnerListDao> getPerformanceListField(PerformancePartnerListParam performancePartnerListParam) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment