package com.yc.ship.module.miniapplet.dal.mysql.advertlog;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.miniapplet.controller.admin.advertlog.vo.AdvertLogPageReqVO;
import com.yc.ship.module.miniapplet.dal.dataobject.advertlog.AdvertLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 广告操作日志管理 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface AdvertLogMapper extends BaseMapperX<AdvertLogDO> {

    default PageResult<AdvertLogDO> selectPage(AdvertLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AdvertLogDO>()
                .eqIfPresent(AdvertLogDO::getAdvertId, reqVO.getAdvertId())
                .eqIfPresent(AdvertLogDO::getSubTitle, reqVO.getSubTitle())
                .eqIfPresent(AdvertLogDO::getAdvertUrl, reqVO.getAdvertUrl())
                .eqIfPresent(AdvertLogDO::getLinkUrl, reqVO.getLinkUrl())
                .eqIfPresent(AdvertLogDO::getAppSource, reqVO.getAppSource())
                .betweenIfPresent(AdvertLogDO::getCreateDate, reqVO.getCreateDate())
                .eqIfPresent(AdvertLogDO::getOpenId, reqVO.getOpenId())
                .orderByDesc(AdvertLogDO::getId));
    }

}
