|
|
@@ -0,0 +1,60 @@
|
|
|
+package com.fdage.controller.app;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.fdage.base.entity.TmDesk;
|
|
|
+import com.fdage.base.service.impl.TmDeskServiceImpl;
|
|
|
+import com.fdage.base.utils.DataUtils;
|
|
|
+import fdage.back.sdk.base.entity.Result;
|
|
|
+import fdage.back.sdk.base.enums.ResultCodeEnum;
|
|
|
+import fdage.back.sdk.base.exception.CommonBaseException;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 2 * @Author: Abner
|
|
|
+ * 3 * @Date: 2021/2/19 11:02
|
|
|
+ * 4
|
|
|
+ */
|
|
|
+@Api(tags = "餐桌相关接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/desk")
|
|
|
+@Log4j2
|
|
|
+public class AppDeskController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TmDeskServiceImpl tmDeskService;
|
|
|
+
|
|
|
+ @GetMapping("/listOfCanteen")
|
|
|
+ @ApiOperation(value = "获取餐厅下所有可预订的桌子列表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "canteenId", value = "餐厅ID", paramType = "query", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "当前页码", paramType = "query", required = true, dataType = "Long"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "每页大小", paramType = "query", required = true, dataType = "Long")
|
|
|
+ })
|
|
|
+ public Result<Object> getListByCanteen( @RequestParam(name = "canteenId") String canteenId ,
|
|
|
+ @RequestParam(name = "pageNum")Long pageNum,
|
|
|
+ @RequestParam(name = "pageSize")Long pageSize){
|
|
|
+ if(null == pageNum || null == pageSize){
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "缺失分页参数");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(canteenId)){
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "餐厅ID缺失");
|
|
|
+ }
|
|
|
+ IPage<TmDesk> resultPage = tmDeskService.getListByCanteen(pageNum , pageSize , canteenId);
|
|
|
+
|
|
|
+ return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
|
+ resultPage.getCurrent(), resultPage.getRecords()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|