/** * 根据type(菜品1或套餐2)查询对应的菜品分类 * @param category * @return */ @GetMapping("/list") public R<List<Category>> list(Category category){ //条件构造器 LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<Category>(); //添加条件 queryWrapper.eq(category.getType()!=null, Category::getType, category.getType()); //添加排序条件 queryWrapper.orderByAsc(Category::getSort).orderByDesc(Category::getUpdateTime); //查询 List<Category> list = categoryService.list(queryWrapper); return R.success(list); }
标签:category,Category,queryWrapper,getType,list,获取,菜品,------ From: https://www.cnblogs.com/fxzm/p/17201604.html