返回pc需要的分页数据

This commit is contained in:
hupeng
2021-06-02 09:03:18 +08:00
parent 8c1e172c24
commit 18d746602e
3 changed files with 18 additions and 12 deletions

View File

@ -183,7 +183,11 @@ public class UserBillController {
newType = Integer.valueOf(type); newType = Integer.valueOf(type);
} }
Long uid = LocalUser.getUser().getUid(); Long uid = LocalUser.getUser().getUid();
return ApiResult.resultPage(Collections.singletonList(userBillService.getUserBillList(page,limit,uid,newType)),limit); Map<String, Object> map = userBillService.getUserBillList(page,limit,uid,newType);
Long total = (Long)map.get("total");
Long totalPage = (Long)map.get("totalPage");
return ApiResult.resultPage(total.intValue(),totalPage.intValue(),map.get("list"));
// return ApiResult.resultPage(Collections.singletonList(userBillService.getUserBillList(page,limit,uid,newType)),limit);
} }

View File

@ -70,9 +70,10 @@ public interface YxUserBillService extends BaseService<YxUserBill>{
* @param limit limit * @param limit limit
* @param uid uid * @param uid uid
* @param type BillDetailEnum * @param type BillDetailEnum
* @return list * @return map
*/ */
List<BillVo> getUserBillList(int page, int limit, long uid, int type); Map<String,Object> getUserBillList(int page, int limit, long uid, int type);
double getBrokerage(int uid); double getBrokerage(int uid);

View File

@ -40,11 +40,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays; import java.util.stream.Collectors;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
@ -174,10 +171,10 @@ public class YxUserBillServiceImpl extends BaseServiceImpl<UserBillMapper, YxUse
* @param limit limit * @param limit limit
* @param uid uid * @param uid uid
* @param type BillDetailEnum * @param type BillDetailEnum
* @return list * @return map
*/ */
@Override @Override
public List<BillVo> getUserBillList(int page, int limit, long uid, int type) { public Map<String,Object> getUserBillList(int page, int limit, long uid, int type) {
QueryWrapper<YxUserBill> wrapper = new QueryWrapper<>(); QueryWrapper<YxUserBill> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YxUserBill::getUid,uid).orderByDesc(YxUserBill::getCreateTime) wrapper.lambda().eq(YxUserBill::getUid,uid).orderByDesc(YxUserBill::getCreateTime)
.orderByAsc(YxUserBill::getId); .orderByAsc(YxUserBill::getId);
@ -216,8 +213,12 @@ public class YxUserBillServiceImpl extends BaseServiceImpl<UserBillMapper, YxUse
billDTO.setList(yxUserBillMapper.getUserBillList(wrapperT)); billDTO.setList(yxUserBillMapper.getUserBillList(wrapperT));
} }
Map<String,Object> map = new HashMap<>();
return billDTOList; map.put("list",billDTOList);
map.put("total",pageModel.getTotal());
map.put("totalPage",pageModel.getPages());
return map;
// return billDTOList;
} }
@Override @Override