package cn.newfeifan.mall.module.distri.dal.mysql.integralchangelog;


import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.module.distri.dal.dataobject.integralchangelog.IntegralChangeLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.distri.controller.admin.integralchangelog.vo.*;

/**
 * 平台消费分变动记录 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface IntegralChangeLogMapper extends BaseMapperX<IntegralChangeLogDO> {

    default PageResult<IntegralChangeLogDO> selectPage(IntegralChangeLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IntegralChangeLogDO>()
                .eq(IntegralChangeLogDO::getUserId, reqVO.getUserId())
                .eq(IntegralChangeLogDO::getIntegralType, reqVO.getIntegralType())
                .eqIfPresent(IntegralChangeLogDO::getIntegralPoints, reqVO.getIntegralPoints())
                .eqIfPresent(IntegralChangeLogDO::getAfterIntegralPoints, reqVO.getAfterIntegralPoints())
                .betweenIfPresent(IntegralChangeLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IntegralChangeLogDO::getId));
    }

}