|
|
@@ -1,5 +1,6 @@
|
|
|
package shop.alien.store.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -32,24 +33,36 @@ public class StoreBookingTableController {
|
|
|
private final StoreBookingTableService storeBookingTableService;
|
|
|
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
- @ApiOperation("查询预订服务桌号列表")
|
|
|
+ @ApiOperation("查询预订服务桌号列表(分页)")
|
|
|
@ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "页容", dataType = "Integer", paramType = "query", required = false),
|
|
|
@ApiImplicitParam(name = "storeId", value = "门店ID", dataType = "Integer", paramType = "query", required = true),
|
|
|
@ApiImplicitParam(name = "categoryId", value = "分类ID(可选,不传则查询全部)", dataType = "Integer", paramType = "query", required = false)
|
|
|
})
|
|
|
@GetMapping("/list")
|
|
|
- public R<List<StoreBookingTableVo>> getTableList(
|
|
|
+ public R<IPage<StoreBookingTableVo>> getTableList(
|
|
|
+ @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
@RequestParam Integer storeId,
|
|
|
@RequestParam(required = false) Integer categoryId) {
|
|
|
- log.info("StoreBookingTableController.getTableList?storeId={}, categoryId={}", storeId, categoryId);
|
|
|
+ log.info("StoreBookingTableController.getTableList?pageNum={}, pageSize={}, storeId={}, categoryId={}",
|
|
|
+ pageNum, pageSize, storeId, categoryId);
|
|
|
|
|
|
if (storeId == null) {
|
|
|
return R.fail("门店ID不能为空");
|
|
|
}
|
|
|
|
|
|
+ if (pageNum == null || pageNum < 1) {
|
|
|
+ pageNum = 1;
|
|
|
+ }
|
|
|
+ if (pageSize == null || pageSize < 1) {
|
|
|
+ pageSize = 10;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
- List<StoreBookingTableVo> list = storeBookingTableService.getTableListWithCategoryName(storeId, categoryId);
|
|
|
- return R.data(list);
|
|
|
+ IPage<StoreBookingTableVo> page = storeBookingTableService.getTableListPage(pageNum, pageSize, storeId, categoryId);
|
|
|
+ return R.data(page);
|
|
|
} catch (Exception e) {
|
|
|
log.error("查询预订服务桌号列表失败", e);
|
|
|
return R.fail("查询失败:" + e.getMessage());
|