package cn.iocoder.yudao.module.member.dal.mysql.activityadddish;

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.member.controller.admin.activityadddish.vo.ActivityAddDishPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.activityadddish.ActivityAddDishDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 活动用餐桌子加菜 Mapper
 *
 * @author 我是秦俊旗
 */
@Mapper
public interface ActivityAddDishMapper extends BaseMapperX<ActivityAddDishDO> {

    default PageResult<ActivityAddDishDO> selectPage(ActivityAddDishPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityAddDishDO>()
                .eqIfPresent(ActivityAddDishDO::getTableDishId, reqVO.getTableDishId())
                .eqIfPresent(ActivityAddDishDO::getSerialNumber, reqVO.getSerialNumber())
                .likeIfPresent(ActivityAddDishDO::getDishName, reqVO.getDishName())
                .eqIfPresent(ActivityAddDishDO::getDishPrice, reqVO.getDishPrice())
                .eqIfPresent(ActivityAddDishDO::getDishImg, reqVO.getDishImg())
                .betweenIfPresent(ActivityAddDishDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(ActivityAddDishDO::getTableDishId, reqVO.getTableDishIds())
                .orderByDesc(ActivityAddDishDO::getId));
    }

}