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

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.activitytabledish.vo.ActivityTableDishPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.activitytabledish.ActivityTableDishDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 活动用餐桌子配置 Mapper
 *
 * @author 我是秦俊旗
 */
@Mapper
public interface ActivityTableDishMapper extends BaseMapperX<ActivityTableDishDO> {

    default PageResult<ActivityTableDishDO> selectPage(ActivityTableDishPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityTableDishDO>()
                .eqIfPresent(ActivityTableDishDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(ActivityTableDishDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(ActivityTableDishDO::getSerialNumber, reqVO.getSerialNumber())
                .eqIfPresent(ActivityTableDishDO::getPrice, reqVO.getPrice())
                .eqIfPresent(ActivityTableDishDO::getDish, reqVO.getDish())
                .betweenIfPresent(ActivityTableDishDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(ActivityTableDishDO::getId, reqVO.getIds())
                .inIfPresent(ActivityTableDishDO::getSerialNumber,  reqVO.getSerialNumbers())
                .orderByAsc(ActivityTableDishDO::getSerialNumber));
    }

}