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


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.dishes.vo.DishesPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dishes.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>()
                .eqIfPresent(DishesDO::getCarteenId,reqVO.getCarteenId())
                .likeIfPresent(DishesDO::getDishesName, reqVO.getDishesName())
                .eqIfPresent(DishesDO::getDishesImageUrl, reqVO.getDishesImageUrl())
                .eqIfPresent(DishesDO::getDishesAttribute, reqVO.getDishesAttribute())
                .eqIfPresent(DishesDO::getDishesBasePrice, reqVO.getDishesBasePrice())
                .eqIfPresent(DishesDO::getDishesVipBasePrice, reqVO.getDishesVipBasePrice())
                .eqIfPresent(DishesDO::getDishesWeighPrice, reqVO.getDishesWeighPrice())
                .eqIfPresent(DishesDO::getDishesVipWeighPrice, reqVO.getDishesVipWeighPrice())
                .eqIfPresent(DishesDO::getDishecCook, reqVO.getDishecCook())
                .eqIfPresent(DishesDO::getDishecType, reqVO.getDishecType())
                .betweenIfPresent(DishesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DishesDO::getId));
    }

}