package cn.iocoder.yudao.module.energy.dal.mysql.account;

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.energy.controller.admin.account.vo.EnergyAccountFlowPageReqVO;
import cn.iocoder.yudao.module.energy.dal.dataobject.account.EnergyAccountFlowDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface EnergyAccountFlowMapper extends BaseMapperX<EnergyAccountFlowDO> {

    default PageResult<EnergyAccountFlowDO> selectPage(EnergyAccountFlowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnergyAccountFlowDO>()
                .eqIfPresent(EnergyAccountFlowDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(EnergyAccountFlowDO::getProjectAccountId, reqVO.getProjectAccountId())
                .eqIfPresent(EnergyAccountFlowDO::getFlowType, reqVO.getFlowType())
                .eqIfPresent(EnergyAccountFlowDO::getBizType, reqVO.getBizType())
                .betweenIfPresent(EnergyAccountFlowDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EnergyAccountFlowDO::getId));
    }

}
