苍穹外卖学习笔记(十四)

embedded/2024/10/22 8:31:35/

3. 根据分类ID查询套餐

SetmealController

java">package com.sky.controller.user;import com.sky.constant.StatusConstant;
import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.RestController;import java.util.List;/*** @author Jie.* @description: TODO* @date 2024/9/25* @version: 1.0*/
@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
@Api(tags = "套餐管理")
@Slf4j
public class SetmealController {@Autowiredprivate SetmealService setmealService;/** 根据分类id查询套餐*/@GetMapping("/list")@ApiOperation("套餐列表")public Result<List<Setmeal>> list(Long categoryId) {Setmeal setmeal = new Setmeal();setmeal.setCategoryId(categoryId);setmeal.setStatus(StatusConstant.ENABLE);List<Setmeal> list = setmealService.list(setmeal);return Result.success(list);}
}

Service

java"> /*** 查询套餐列表*/
List<Setmeal> list(Setmeal setmeal);

Impl

java">   /*** 查询套餐列表*/@Overridepublic List<Setmeal> list(Setmeal setmeal) {LambdaQueryWrapper<Setmeal> lambdaQueryWrapper = new LambdaQueryWrapper<>();lambdaQueryWrapper.eq(setmeal.getCategoryId() != null, Setmeal::getCategoryId, setmeal.getCategoryId());lambdaQueryWrapper.eq(setmeal.getStatus() != null, Setmeal::getStatus, setmeal.getStatus());return setmealMapper.selectList(lambdaQueryWrapper);}

4. 根据套餐ID查询菜品

controller

java">    /*** 根据套餐id查询包含的菜品*/@GetMapping("/dish/{id}")@ApiOperation("根据套餐id查询包含的菜品")public Result<List<DishItemVO>> dishList(@PathVariable Long id) {List<DishItemVO> list = setmealService.getDishItemById(id);return Result.success(list);}

service

java">/*** 根据套餐id查询包含的菜品*/List<DishItemVO> getDishItemById(Long id);

impl

java">    /*** 根据套餐id查询包含的菜品列表*/@Overridepublic List<DishItemVO> getDishItemById(Long id) {return setmealMapper.getDishItemBySetmealId(id);}

mapper

java">    /*** 根据id查询菜品选项*/@Select("select sd.name, sd.copies, d.image, d.description " +"from setmeal_dish sd left join dish d on sd.dish_id = d.id " +"where sd.setmeal_id = #{setmealId}")List<DishItemVO> getDishItemBySetmealId(Long id);

http://www.ppmy.cn/embedded/118200.html

相关文章

【css】常见布局概述

本文将对css的常见布局方案进行概述&#xff0c;给大家提供系统化的布局解决方案参考。 一、流式布局 二、浮动布局 三、定位布局 四、弹性布局 五、网格布局 一、流式布局 顾名思义&#xff0c;该布局基于dom的文档流进行布局&#xff0c;是最常用、最原始的布局方式。 …

SSH 远程连接到 Linux 服务器上的 SQLite

通过 SSH 远程连接到 Linux 服务器上的 SQLite 数据库文件的流程&#xff0c;可以分为以下几个步骤&#xff1a; 通过 SSH 连接到远程 Linux 服务器。在远程服务器上执行 SQLite 命令行工具&#xff0c;操作数据库文件。在本地使用工具&#xff0c;通过 SSH 隧道间接访问远程的…

后端开发面试题7(附答案)

前言 在下首语言是golang,所以会用他作为示例。 原文参见 @arialdomartini的: Back-End Developer Interview Questions 逻辑和算法相关问题 1. 只用LIFO栈如何构造一个FIFO队列?只用FIFO队列如何构造一个LIFO栈? 使用两个栈(LIFO栈)来模拟FIFO队列: 在Go语言中,可以…

【STM32】 TCP/IP通信协议(1)

一、前言 TCP/IP是干啥的&#xff1f;它跟SPI、IIC、CAN有什么区别&#xff1f;它如何实现stm32的通讯&#xff1f;如何去配置&#xff1f;为了搞懂这些问题&#xff0c;查询资料可解决如下疑问&#xff1a; 1.为什么要用以太网通信? 以太网(Ethernet) 是指遵守 IEEE 802.3 …

流媒体服务软件-LiveNVR channeltree 未授权访问

0x01 产品描述&#xff1a; LiveNVR 能够通过简单的网络摄像机通道配置&#xff0c;将传统监控行业里面的高清网络摄像机 IPCamera、NVR 等具有 RTSP/Onvif 协议输出的设备接入到 LiveNVR&#xff0c;LiveNVR 能够将这些设备源的音/视频数据进行采集、转换、输出&#xff0c;进…

STL各种map比较

STL各种map比较 1、map底层是用红黑树实现的&#xff0c;查找时间复杂度是O(log(n))&#xff1b; 2、hash_map底层是用hash表存储的&#xff0c;查询时间复杂度是O(1)&#xff1b; 3、unordered_map和hash_map基本一样&#xff0c;只是unordered_map已经加到C11标准&#xf…

Python在进行LLM应用相关开发常用的技术框架

在Python中进行大型语言模型&#xff08;LLM&#xff09;相关开发时&#xff0c;有几个框架和库可以使用&#xff1a; LangChain&#xff1a;这是一个用于构建由大型语言模型&#xff08;LLMs&#xff09;驱动的应用程序的框架。它提供了各种不同基础模型的通用接口、帮助管理…

iOS 消息机制详解

应用 解决NSTimer、CADisplayLink循环引用。 二者都是基于runloop的定时器&#xff0c;由于处理事件内容不一样&#xff0c;runloop 每运行一次运行耗时就不一样&#xff0c;无法准确的定时触发timer的事件。 NSProxy 与 NSObject 如果继承自NSProxy 直接开始消息转发&…