select dishes by setmealId
select dishes by categoryId
This commit is contained in:
@@ -4,6 +4,7 @@ import com.sky.entity.Category;
|
|||||||
import com.sky.result.Result;
|
import com.sky.result.Result;
|
||||||
import com.sky.service.CategoryService;
|
import com.sky.service.CategoryService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -22,6 +23,7 @@ public class UserCategoryController {
|
|||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("category list")
|
||||||
public Result<List<Category>> list(Integer type){
|
public Result<List<Category>> list(Integer type){
|
||||||
log.info("user category list: {}",type);
|
log.info("user category list: {}",type);
|
||||||
List<Category> list = categoryService.list(type);
|
List<Category> list = categoryService.list(type);
|
||||||
|
|||||||
@@ -1,6 +1,41 @@
|
|||||||
package com.sky.controller.user;
|
package com.sky.controller.user;
|
||||||
|
|
||||||
|
|
||||||
public class UserSetmealController {
|
import com.sky.entity.Setmeal;
|
||||||
|
import com.sky.result.Result;
|
||||||
|
import com.sky.service.SetmealService;
|
||||||
|
import com.sky.vo.DishItemVO;
|
||||||
|
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.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user/setmeal")
|
||||||
|
@Api(tags = "UserSetmeal")
|
||||||
|
@Slf4j
|
||||||
|
public class UserSetmealController {
|
||||||
|
@Autowired
|
||||||
|
private SetmealService setmealService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("select setmeal by categoryId")
|
||||||
|
public Result<List<Setmeal>> list(Integer categoryId){
|
||||||
|
log.info("select setmeal by categoryId :{}", categoryId);
|
||||||
|
List<Setmeal> setmealList = setmealService.selectSetmealByCategoryId(categoryId);
|
||||||
|
return Result.success(setmealList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/dish/{id}")
|
||||||
|
@ApiOperation("select dishes by setmealId")
|
||||||
|
public Result<List<DishItemVO>> getDishBySetmealId(@PathVariable Long id){
|
||||||
|
log.info("select dishes by setmealId :{}", id);
|
||||||
|
return Result.success(setmealService.getDishBySetmealId(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.sky.annotation.AutoFill;
|
|||||||
import com.sky.dto.DishPageQueryDTO;
|
import com.sky.dto.DishPageQueryDTO;
|
||||||
import com.sky.entity.Dish;
|
import com.sky.entity.Dish;
|
||||||
import com.sky.enumeration.OperationType;
|
import com.sky.enumeration.OperationType;
|
||||||
|
import com.sky.result.Result;
|
||||||
|
import com.sky.vo.DishItemVO;
|
||||||
import com.sky.vo.DishVO;
|
import com.sky.vo.DishVO;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -70,4 +72,6 @@ public interface DishMapper {
|
|||||||
List<Dish> selectByCategoryId(Long categoryId);
|
List<Dish> selectByCategoryId(Long categoryId);
|
||||||
|
|
||||||
List<Dish> selectByDishIdsAndStatusDisable(List<Long> dishIds);
|
List<Dish> selectByDishIdsAndStatusDisable(List<Long> dishIds);
|
||||||
|
|
||||||
|
List<DishItemVO> selectDishBySetmealId(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,7 @@ public interface SetmealMapper {
|
|||||||
|
|
||||||
@AutoFill(OperationType.UPDATE)
|
@AutoFill(OperationType.UPDATE)
|
||||||
void update(Setmeal setmeal);
|
void update(Setmeal setmeal);
|
||||||
|
|
||||||
|
@Select("select * from setmeal where category_id = #{categoryId}")
|
||||||
|
List<Setmeal> selectByCategoryId(Integer categoryId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package com.sky.service;
|
|||||||
|
|
||||||
import com.sky.dto.SetmealDTO;
|
import com.sky.dto.SetmealDTO;
|
||||||
import com.sky.dto.SetmealPageQueryDTO;
|
import com.sky.dto.SetmealPageQueryDTO;
|
||||||
|
import com.sky.entity.Setmeal;
|
||||||
import com.sky.result.PageResult;
|
import com.sky.result.PageResult;
|
||||||
|
import com.sky.result.Result;
|
||||||
|
import com.sky.vo.DishItemVO;
|
||||||
import com.sky.vo.SetmealVO;
|
import com.sky.vo.SetmealVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -48,4 +51,8 @@ public interface SetmealService {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
void startOrStop(Integer status, Long id);
|
void startOrStop(Integer status, Long id);
|
||||||
|
|
||||||
|
List<Setmeal> selectSetmealByCategoryId(Integer categoryId);
|
||||||
|
|
||||||
|
List<DishItemVO> getDishBySetmealId(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import com.sky.mapper.DishMapper;
|
|||||||
import com.sky.mapper.SetmealDishMapper;
|
import com.sky.mapper.SetmealDishMapper;
|
||||||
import com.sky.mapper.SetmealMapper;
|
import com.sky.mapper.SetmealMapper;
|
||||||
import com.sky.result.PageResult;
|
import com.sky.result.PageResult;
|
||||||
|
import com.sky.result.Result;
|
||||||
import com.sky.service.SetmealService;
|
import com.sky.service.SetmealService;
|
||||||
|
import com.sky.vo.DishItemVO;
|
||||||
import com.sky.vo.SetmealVO;
|
import com.sky.vo.SetmealVO;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -164,4 +166,14 @@ public class SetmealServiceImpl implements SetmealService {
|
|||||||
setmealMapper.update(setmeal);
|
setmealMapper.update(setmeal);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Setmeal> selectSetmealByCategoryId(Integer categoryId) {
|
||||||
|
return setmealMapper.selectByCategoryId(categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DishItemVO> getDishBySetmealId(Long id) {
|
||||||
|
return dishMapper.selectDishBySetmealId(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,10 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
and status = 0
|
and status = 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectDishBySetmealId" resultType="com.sky.vo.DishItemVO">
|
||||||
|
select copies,description,image,d.name
|
||||||
|
from sky_take_out.setmeal_dish s
|
||||||
|
join dish d on d.id = s.dish_id
|
||||||
|
where s.setmeal_id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user