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

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

import java.util.List;

/**
 * 菜品统计 Mapper
 *
 * @author 开发账号
 */
@Mapper
public interface DishStatisticsMapper extends BaseMapperX<DishStatisticsDO> {

    default PageResult<DishStatisticsDO> selectPage(DishStatisticsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DishStatisticsDO>()
                .eqIfPresent(DishStatisticsDO::getDeviceSn, reqVO.getDeviceSn())
                .eqIfPresent(DishStatisticsDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(DishStatisticsDO::getDishId, reqVO.getDishId())
                .likeIfPresent(DishStatisticsDO::getDishesName, reqVO.getDishesName())
                .eqIfPresent(DishStatisticsDO::getWeight, reqVO.getWeight())
                .betweenIfPresent(DishStatisticsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DishStatisticsDO::getId));
    }

    List<DishStatisticsDO> getSaleData(String time);

}