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


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.dishesnutrition.vo.DishesNutritionPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dishesnutrition.DishesNutritionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 菜品营养 Mapper
 *
 * @author 开发账号
 */
@Mapper
public interface DishesNutritionMapper extends BaseMapperX<DishesNutritionDO> {

    default PageResult<DishesNutritionDO> selectPage(DishesNutritionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DishesNutritionDO>()
                .likeIfPresent(DishesNutritionDO::getNutritionName, reqVO.getNutritionName())
                .eqIfPresent(DishesNutritionDO::getNutritionNumber, reqVO.getNutritionNumber())
                .eqIfPresent(DishesNutritionDO::getDishesNumber, reqVO.getDishesNumber())
                .betweenIfPresent(DishesNutritionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DishesNutritionDO::getDishesId, reqVO.getDishesId())
                .eqIfPresent(DishesNutritionDO::getNutritionPer, reqVO.getNutritionPer())
                .orderByDesc(DishesNutritionDO::getId));
    }

}