Commit ca5d9984 authored by Junling Bu's avatar Junling Bu
Browse files

refactor: 分页的中每页的数量统一采用limit,而不是size

parent 6db1c80d
......@@ -1090,7 +1090,7 @@ public interface Storage {
public class WxTopicController {
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
...
......@@ -1144,7 +1144,7 @@ public interface Storage {
public class WxTopicController {
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
...
......
......@@ -26,7 +26,7 @@ public class LitemallIssueService {
issueMapper.insertSelective(issue);
}
public List<LitemallIssue> querySelective(String question, Integer page, Integer size, String sort, String order) {
public List<LitemallIssue> querySelective(String question, Integer page, Integer limit, String sort, String order) {
LitemallIssueExample example = new LitemallIssueExample();
LitemallIssueExample.Criteria criteria = example.createCriteria();
......@@ -39,7 +39,7 @@ public class LitemallIssueService {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, size);
PageHelper.startPage(page, limit);
return issueMapper.selectByExample(example);
}
......
......@@ -28,11 +28,11 @@ public class LitemallKeywordService {
return keywordsMapper.selectByExample(example);
}
public List<LitemallKeyword> queryByKeyword(String keyword, Integer page, Integer size) {
public List<LitemallKeyword> queryByKeyword(String keyword, Integer page, Integer limit) {
LitemallKeywordExample example = new LitemallKeywordExample();
example.setDistinct(true);
example.or().andKeywordLike("%" + keyword + "%").andDeletedEqualTo(false);
PageHelper.startPage(page, size);
PageHelper.startPage(page, limit);
return keywordsMapper.selectByExampleSelective(example, LitemallKeyword.Column.keyword);
}
......
......@@ -69,7 +69,7 @@ public class LitemallOrderService {
return orderSn;
}
public List<LitemallOrder> queryByOrderStatus(Integer userId, List<Short> orderStatus, Integer page, Integer size) {
public List<LitemallOrder> queryByOrderStatus(Integer userId, List<Short> orderStatus, Integer page, Integer limit) {
LitemallOrderExample example = new LitemallOrderExample();
example.setOrderByClause(LitemallOrder.Column.addTime.desc());
LitemallOrderExample.Criteria criteria = example.or();
......@@ -78,11 +78,11 @@ public class LitemallOrderService {
criteria.andOrderStatusIn(orderStatus);
}
criteria.andDeletedEqualTo(false);
PageHelper.startPage(page, size);
PageHelper.startPage(page, limit);
return litemallOrderMapper.selectByExample(example);
}
public List<LitemallOrder> querySelective(Integer userId, String orderSn, List<Short> orderStatusArray, Integer page, Integer size, String sort, String order) {
public List<LitemallOrder> querySelective(Integer userId, String orderSn, List<Short> orderStatusArray, Integer page, Integer limit, String sort, String order) {
LitemallOrderExample example = new LitemallOrderExample();
LitemallOrderExample.Criteria criteria = example.createCriteria();
......@@ -101,7 +101,7 @@ public class LitemallOrderService {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, size);
PageHelper.startPage(page, limit);
return litemallOrderMapper.selectByExample(example);
}
......
......@@ -37,7 +37,7 @@ public class LitemallRoleService {
}
public List<LitemallRole> querySelective(String name, Integer page, Integer size, String sort, String order) {
public List<LitemallRole> querySelective(String name, Integer page, Integer limit, String sort, String order) {
LitemallRoleExample example = new LitemallRoleExample();
LitemallRoleExample.Criteria criteria = example.createCriteria();
......@@ -50,7 +50,7 @@ public class LitemallRoleService {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, size);
PageHelper.startPage(page, limit);
return roleMapper.selectByExample(example);
}
......
......@@ -127,18 +127,18 @@ public class WxOrderService {
* 3,待收货;
* 4,待评价。
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 订单列表
*/
public Object list(Integer userId, Integer showType, Integer page, Integer size) {
public Object list(Integer userId, Integer showType, Integer page, Integer limit) {
if (userId == null) {
return ResponseUtil.unlogin();
}
List<Short> orderStatus = OrderUtil.orderStatus(showType);
List<LitemallOrder> orderList = orderService.queryByOrderStatus(userId, orderStatus, page, size);
List<LitemallOrder> orderList = orderService.queryByOrderStatus(userId, orderStatus, page, limit);
long count = PageInfo.of(orderList).getTotal();
int totalPages = (int) Math.ceil((double) count / size);
int totalPages = (int) Math.ceil((double) count / limit);
List<Map<String, Object>> orderVoList = new ArrayList<>(orderList.size());
for (LitemallOrder order : orderList) {
......
......@@ -33,16 +33,16 @@ public class WxBrandController {
* 品牌列表
*
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 品牌列表
*/
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
@RequestParam(defaultValue = "10") Integer limit) {
List<LitemallBrand> brandList = brandService.queryVO(page, size);
List<LitemallBrand> brandList = brandService.queryVO(page, limit);
int total = brandService.queryTotalCount();
int totalPages = (int) Math.ceil((double) total / size);
int totalPages = (int) Math.ceil((double) total / limit);
Map<String, Object> data = new HashMap<String, Object>();
data.put("brandList", brandList);
......
......@@ -40,21 +40,21 @@ public class WxCollectController {
* @param userId 用户ID
* @param type 类型,如果是0则是商品收藏,如果是1则是专题收藏
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 用户收藏列表
*/
@GetMapping("list")
public Object list(@LoginUser Integer userId,
@NotNull Byte type,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
@RequestParam(defaultValue = "10") Integer limit) {
if (userId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCollect> collectList = collectService.queryByType(userId, type, page, size);
List<LitemallCollect> collectList = collectService.queryByType(userId, type, page, limit);
int count = collectService.countByType(userId, type);
int totalPages = (int) Math.ceil((double) count / size);
int totalPages = (int) Math.ceil((double) count / limit);
List<Object> collects = new ArrayList<>(collectList.size());
for (LitemallCollect collect : collectList) {
......
......@@ -126,7 +126,7 @@ public class WxCommentController {
* @param valueId 商品或专题ID。如果type是0,则是商品ID;如果type是1,则是专题ID。
* @param showType 显示类型。如果是0,则查询全部;如果是1,则查询有图片的评论。
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 评论列表
*/
@GetMapping("list")
......@@ -134,8 +134,8 @@ public class WxCommentController {
@NotNull Integer valueId,
@NotNull Integer showType,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
List<LitemallComment> commentList = commentService.query(type, valueId, showType, page, size);
@RequestParam(defaultValue = "10") Integer limit) {
List<LitemallComment> commentList = commentService.query(type, valueId, showType, page, limit);
long count = PageInfo.of(commentList).getTotal();
List<Map<String, Object>> commentVoList = new ArrayList<>(commentList.size());
......
......@@ -51,18 +51,18 @@ public class WxCouponController {
* 优惠券列表
*
* @param page
* @param size
* @param limit
* @param sort
* @param order
* @return
*/
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallCoupon> couponList = couponService.queryList(page, size, sort, order);
List<LitemallCoupon> couponList = couponService.queryList(page, limit, sort, order);
int total = couponService.queryTotal();
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", couponList);
......@@ -76,7 +76,7 @@ public class WxCouponController {
* @param userId
* @param status
* @param page
* @param size
* @param limit
* @param sort
* @param order
* @return
......@@ -85,14 +85,14 @@ public class WxCouponController {
public Object mylist(@LoginUser Integer userId,
@NotNull Short status,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
if (userId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, size, sort, order);
List<LitemallCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, limit, sort, order);
List<CouponVo> couponVoList = change(couponUserList);
int total = couponService.queryTotal();
Map<String, Object> data = new HashMap<String, Object>();
......
......@@ -70,20 +70,20 @@ public class WxFootprintController {
* 用户足迹列表
*
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 用户足迹列表
*/
@GetMapping("list")
public Object list(@LoginUser Integer userId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
@RequestParam(defaultValue = "10") Integer limit) {
if (userId == null) {
return ResponseUtil.unlogin();
}
List<LitemallFootprint> footprintList = footprintService.queryByAddTime(userId, page, size);
List<LitemallFootprint> footprintList = footprintService.queryByAddTime(userId, page, limit);
long count = PageInfo.of(footprintList).getTotal();
int totalPages = (int) Math.ceil((double) count / size);
int totalPages = (int) Math.ceil((double) count / limit);
List<Object> footprintVoList = new ArrayList<>(footprintList.size());
for (LitemallFootprint footprint : footprintList) {
......
......@@ -237,7 +237,7 @@ public class WxGoodsController {
* @param isHot 是否热买,可选
* @param userId 用户ID
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @param sort 排序方式,支持"add_time", "retail_price"或"name"
* @param order 排序类型,顺序或者降序
* @return 根据条件搜素的商品详情
......@@ -251,7 +251,7 @@ public class WxGoodsController {
Boolean isHot,
@LoginUser Integer userId,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort(accepts = {"add_time", "retail_price", "name"}) @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
......@@ -265,7 +265,7 @@ public class WxGoodsController {
}
//查询列表数据
List<LitemallGoods> goodsList = goodsService.querySelective(categoryId, brandId, keyword, isHot, isNew, page, size, sort, order);
List<LitemallGoods> goodsList = goodsService.querySelective(categoryId, brandId, keyword, isHot, isNew, page, limit, sort, order);
// 查询商品所属类目列表。
List<Integer> goodsCatIds = goodsService.getCatIds(brandId, keyword, isHot, isNew);
......
......@@ -59,15 +59,15 @@ public class WxGrouponController {
* 团购规则列表
*
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 团购规则列表
*/
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<Map<String, Object>> topicList = grouponRulesService.queryList(page, size, sort, order);
List<Map<String, Object>> topicList = grouponRulesService.queryList(page, limit, sort, order);
long total = PageInfo.of(topicList).getTotal();
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", topicList);
......
......@@ -27,15 +27,15 @@ public class WxOrderController {
* @param userId 用户ID
* @param showType 订单信息
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 订单列表
*/
@GetMapping("list")
public Object list(@LoginUser Integer userId,
@RequestParam(defaultValue = "0") Integer showType,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
return wxOrderService.list(userId, showType, page, size);
@RequestParam(defaultValue = "10") Integer limit) {
return wxOrderService.list(userId, showType, page, limit);
}
/**
......
......@@ -76,8 +76,8 @@ public class WxSearchController {
@GetMapping("helper")
public Object helper(@NotEmpty String keyword,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
List<LitemallKeyword> keywordsList = keywordsService.queryByKeyword(keyword, page, size);
@RequestParam(defaultValue = "10") Integer limit) {
List<LitemallKeyword> keywordsList = keywordsService.queryByKeyword(keyword, page, limit);
String[] keys = new String[keywordsList.size()];
int index = 0;
for (LitemallKeyword key : keywordsList) {
......
......@@ -40,15 +40,15 @@ public class WxTopicController {
* 专题列表
*
* @param page 分页页数
* @param size 分页大小
* @param limit 分页大小
* @return 专题列表
*/
@GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallTopic> topicList = topicService.queryList(page, size, sort, order);
List<LitemallTopic> topicList = topicService.queryList(page, limit, sort, order);
int total = topicService.queryTotal();
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", topicList);
......
......@@ -14,7 +14,7 @@ Page({
hasPicCount: 0,
allPage: 1,
picPage: 1,
size: 20
limit: 20
},
getCommentCount: function() {
let that = this;
......
......@@ -7,7 +7,7 @@ Page({
data: {
couponList: [],
page: 1,
size: 10,
limit: 10,
count: 0,
scrollTop: 0,
showPage: false
......@@ -86,7 +86,7 @@ Page({
util.request(api.CouponList, {
page: that.data.page,
size: that.data.size
limit: that.data.limit
}).then(function (res) {
if (res.errno === 0) {
......@@ -124,7 +124,7 @@ Page({
},
nextPage: function (event) {
var that = this;
if (this.data.page > that.data.count / that.data.size) {
if (this.data.page > that.data.count / that.data.limit) {
return true;
}
......
......@@ -22,7 +22,7 @@
<view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
<view class="next {{ (count / limit) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
......@@ -16,7 +16,7 @@ Page({
currentSort: 'add_time',
currentSortOrder: 'desc',
page: 1,
size: 100
limit: 100
},
getGoodsList: function() {
var that = this;
......
Supports Markdown
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