Browse Source

1、添加聚合列表分页

master
Augcl 6 months ago
parent
commit
c28b832dfa
1 changed files with 133 additions and 12 deletions
  1. +133
    -12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/IndexApiServiceImpl.java

+ 133
- 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/IndexApiServiceImpl.java View File

@ -582,10 +582,12 @@ public class IndexApiServiceImpl implements IndexApiService {
for (TravelVideo video : videoList) {
VideoApiBean videoApiBean = new VideoApiBean();
boolean thumpupFlag = false;
for (TravelThumpup thumpup : thumpupList) {
if(video.getId().equals(thumpup.getItemId())){
thumpupFlag = true;
break;
if(null != thumpupList){
for (TravelThumpup thumpup : thumpupList) {
if(video.getId().equals(thumpup.getItemId())){
thumpupFlag = true;
break;
}
}
}
videoApiBean.setThumpupFlag(thumpupFlag);
@ -593,7 +595,36 @@ public class IndexApiServiceImpl implements IndexApiService {
videoApiBeanList.add(videoApiBean);
}
return Result.OK("视频列表", videoApiBeanList);
//分页
//页码
int pageNo = pageBean.getPageNo();
//每一页展示数量
int pageSize = pageBean.getPageSize();
//数据总量
int listCount = videoApiBeanList.size();
if(listCount < 1){
return Result.OK("没有视频数据");
}
//总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
//边界判断
if(pageNo < 1){
pageNo = 1;
}else if(pageNo > pageCount){
pageNo = pageCount;
}
//起始下标
int startIndex = (pageNo-1)*pageBean.getPageSize();
//结束下标
int endIndex = startIndex + pageBean.getPageSize();
if(endIndex > listCount){
endIndex = listCount;
}
List<VideoApiBean> videoApiBeanListPage = videoApiBeanList.subList(startIndex,endIndex);
return Result.OK("视频列表", videoApiBeanListPage);
}
//获取游玩项目列表
@ -721,20 +752,20 @@ public class IndexApiServiceImpl implements IndexApiService {
public Result<?> queryCollectionList(String token, String collectionType, PageBean pageBean) {
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
Page<TravelCollection> page = new Page<TravelCollection>(pageBean.getPageNo(), pageBean.getPageSize());
//收藏列表
List<TravelCollection> list;
List<TravelCollection> pageList = null;
if(null != collectionType){
list = travelCollectionService
.lambdaQuery()
.eq(TravelCollection::getUserId, hanHaiMember.getId())
.eq(TravelCollection::getCollectionType, collectionType)
.orderByDesc(TravelCollection::getCreateTime)
.list();
}else {
list = travelCollectionService
.lambdaQuery()
.eq(TravelCollection::getUserId, hanHaiMember.getId())
.orderByDesc(TravelCollection::getCreateTime)
.list();
}
@ -789,7 +820,36 @@ public class IndexApiServiceImpl implements IndexApiService {
}
}
return Result.OK("我的收藏列表", cellectionList);
//分页显示
//页码
int pageNo = pageBean.getPageNo();
//每一页展示数量
int pageSize = pageBean.getPageSize();
//数据总量
int listCount = cellectionList.size();
if(listCount < 1){
return Result.OK("没有收藏");
}
//总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
//边界判断
if(pageNo < 1){
pageNo = 1;
}else if(pageNo > pageCount){
pageNo = pageCount;
}
//起始下标
int startIndex = (pageNo-1)*pageBean.getPageSize();
//结束下标
int endIndex = startIndex + pageBean.getPageSize();
if(endIndex > listCount){
endIndex = listCount;
}
List<Object> pageList = cellectionList.subList(startIndex,endIndex);
return Result.OK("我的收藏列表", pageList);
}
//新增收藏
@ -1089,6 +1149,7 @@ public class IndexApiServiceImpl implements IndexApiService {
List<WaresOrderApiBean> waresOrderApiBeans = new ArrayList<>();
//获取订单列表
List<TravelWaresOrder> travelWaresOrders = null;
if(null != status){
travelWaresOrders = travelWaresOrderService
@ -1103,7 +1164,7 @@ public class IndexApiServiceImpl implements IndexApiService {
.list();
}
//获取订单相关的商品列表
for (TravelWaresOrder travelWaresOrder : travelWaresOrders) {
WaresOrderApiBean waresOrderApiBean = new WaresOrderApiBean();
@ -1127,7 +1188,37 @@ public class IndexApiServiceImpl implements IndexApiService {
}
return Result.OK("文创好物订单列表", waresOrderApiBeans);
//分页查询
//页码
int pageNo = pageBean.getPageNo();
//每一页展示数量
int pageSize = pageBean.getPageSize();
//数据总量
int listCount = waresOrderApiBeans.size();
if(listCount < 1){
//没有数据
Result.OK("没有订单,请先去创建订单!");
}
//总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
//边界判断
if(pageNo < 1){
pageNo = 1;
}else if(pageNo > pageCount){
pageNo = pageCount;
}
//起始下标
int startIndex = (pageNo-1)*pageBean.getPageSize();
//结束下标
int endIndex = startIndex + pageBean.getPageSize();
if(endIndex > listCount){
endIndex = listCount;
}
List<WaresOrderApiBean> pageList = waresOrderApiBeans.subList(startIndex,endIndex);
return Result.OK("文创好物订单列表", pageList);
}
//创建文创好物订单
@ -1235,7 +1326,37 @@ public class IndexApiServiceImpl implements IndexApiService {
}
}
return Result.OK("购物车列表", shopcarApiBeanList);
//分页查询
//页码
int pageNo = pageBean.getPageNo();
//每一页展示数量
int pageSize = pageBean.getPageSize();
//数据总量
int listCount = shopcarApiBeanList.size();
if(listCount < 1){
//没有数据
return null;
}
//总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
//边界判断
if(pageNo < 1){
pageNo = 1;
}else if(pageNo > pageCount){
pageNo = pageCount;
}
//起始下标
int startIndex = (pageNo-1)*pageBean.getPageSize();
//结束下标
int endIndex = startIndex + pageBean.getPageSize();
if(endIndex > listCount){
endIndex = listCount;
}
List<ShopcarApiBean> pageList = shopcarApiBeanList.subList(startIndex,endIndex);
return Result.OK("购物车列表", pageList);
}
//添加购物车


Loading…
Cancel
Save