package cn.iocoder.yudao.module.system.dal.mysql.restaurant;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.restaurant.vo.DishesPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.restaurant.DishesDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 餐厅菜品 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface DishesMapper extends BaseMapperX<DishesDO> {

    default PageResult<DishesDO> selectPage(DishesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DishesDO>()
                .eq(DishesDO::getRestaurantId,reqVO.getRestaurantId())
                .likeIfPresent(DishesDO::getFoodName, reqVO.getFoodName())
                .eqIfPresent(DishesDO::getCategoryId, reqVO.getCategoryId())
                .eqIfPresent(DishesDO::getOrgType,reqVO.getOrgType())
                .eqIfPresent(DishesDO::getTenantId,reqVO.getTenantId())
                .orderByDesc(DishesDO::getCreatedTime));
    }

}