| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain. TBoard; |
| | | import com.ruoyi.system.service.TBoardService; |
| | | import com.ruoyi.system.service. TBoardService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class TBoardController { |
| | | |
| | | private final TBoardService boardService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TBoardController( TBoardService boardService) { |
| | | public TBoardController(TBoardService boardService, TokenService tokenService) { |
| | | this. boardService = boardService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询餐桌列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TBoard>> list() { |
| | | return AjaxResult.success( boardService.list()); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | return AjaxResult.success( boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId,objectId))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "添加餐桌") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TBoard dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success( boardService.save(dto)); |
| | | } |
| | | |