81 lines
1.8 KiB
Java
81 lines
1.8 KiB
Java
package com.sky.mapper;
|
|
|
|
import com.github.pagehelper.Page;
|
|
import com.sky.annotation.AutoFill;
|
|
import com.sky.dto.DishPageQueryDTO;
|
|
import com.sky.entity.Dish;
|
|
import com.sky.entity.Employee;
|
|
import com.sky.enumeration.OperationType;
|
|
import com.sky.vo.DishVO;
|
|
import org.apache.ibatis.annotations.Delete;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface DishMapper {
|
|
|
|
/**
|
|
* 根据分类id查询菜品数量
|
|
* @param categoryId
|
|
* @return
|
|
*/
|
|
@Select("select count(id) from dish where category_id = #{categoryId}")
|
|
Integer countByCategoryId(Long categoryId);
|
|
|
|
/**
|
|
* 新增菜品
|
|
* @param dish
|
|
*/
|
|
@AutoFill(OperationType.INSERT)
|
|
void insert(Dish dish);
|
|
|
|
/**
|
|
* 菜品条件分页查询
|
|
* @param dto
|
|
* @return
|
|
*/
|
|
Page<DishVO> pageQuery(DishPageQueryDTO dto);
|
|
|
|
/**
|
|
* 根据id查询菜品
|
|
* @param id
|
|
* @return
|
|
*/
|
|
@Select("select * from dish where id = #{id}")
|
|
Dish getDishById(Long id);
|
|
|
|
/**
|
|
* 根据id删除菜品
|
|
* @param dishId
|
|
*/
|
|
@Delete("delete from dish where id = #{dishId}")
|
|
void deleteById(Long dishId);
|
|
|
|
/**
|
|
* 根据菜品id修改菜品信息
|
|
* @param dish
|
|
*/
|
|
@AutoFill(OperationType.UPDATE) //springAOP统一进行的自动填充功能
|
|
void update(Dish dish);
|
|
|
|
void startOrStop(Integer status, Long id);
|
|
|
|
|
|
/**
|
|
* 动态条件查询菜品
|
|
* @param dish
|
|
* @return
|
|
*/
|
|
List<Dish> list(Dish dish);
|
|
|
|
/**
|
|
* 根据套餐id查询菜品
|
|
* @param setmealId
|
|
* @return
|
|
*/
|
|
@Select("select a.* from dish a left join setmeal_dish b on a.id = b.dish_id where b.setmeal_id = #{setmealId}")
|
|
List<Dish> getBySetmealId(Long setmealId);
|
|
}
|