package com.cf.imes.module.system.dal.mysql.funds.delay;

import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.system.controller.admin.funds.delay.vo.ProductDelayPageReqVO;
import com.cf.imes.module.system.dal.dataobject.funds.delay.ProductDelayRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 产品延期记录 Mapper
 *
 * @author Gqr
 * @since 2025/9/15 11:14
 */
@Mapper
public interface ProductDelayRecordMapper extends BaseMapperX<ProductDelayRecordDO> {
    /**
     * 分页查询延期记录
     * @param pageReqVO
     * @return
     */
    default PageResult<ProductDelayRecordDO> selectPage(ProductDelayPageReqVO pageReqVO) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<ProductDelayRecordDO>()
                .eqIfPresent(ProductDelayRecordDO::getOrganName, pageReqVO.getOrganName())
                .eqIfPresent(ProductDelayRecordDO::getProductName, pageReqVO.getProductName())
                .eqIfPresent(ProductDelayRecordDO::getDelayDuration, pageReqVO.getDelayDuration())
                .betweenIfPresent(ProductDelayRecordDO::getCreateTime, pageReqVO.getCreateTime())
                .eqIfPresent(ProductDelayRecordDO::getCreator, pageReqVO.getOperator())
                .orderByDesc(ProductDelayRecordDO::getId));
    }
}
