package com.cf.imes.module.system.dal.mysql.incomeandexpense;


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.balancedetails.vo.BalanceDetailsPageReqVO;
import com.cf.imes.module.system.dal.dataobject.incomeandexpense.IncomeExpenseDetailsDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 收支明细 Mapper
 *
 * @author Gqr
 * @since 2025/8/13 11:41
 */
@Mapper
public interface IncomeExpenseDetailsMapper extends BaseMapperX<IncomeExpenseDetailsDO> {
    default PageResult<IncomeExpenseDetailsDO> selectDetailsPage(BalanceDetailsPageReqVO pageReqVO, List<Long> organIds) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<IncomeExpenseDetailsDO>()
                .eqIfPresent(IncomeExpenseDetailsDO::getOrganId, pageReqVO.getOrganId())
                .inIfPresent(IncomeExpenseDetailsDO::getOrganId, organIds)
                .eq(IncomeExpenseDetailsDO::getDeleted, false)
                .likeIfPresent(IncomeExpenseDetailsDO::getBusinessNo, pageReqVO.getBusinessNo())
                .eqIfPresent(IncomeExpenseDetailsDO::getTradeType,pageReqVO.getTradeType())
                .eqIfPresent(IncomeExpenseDetailsDO::getIncomeExpenseType,pageReqVO.getIncomeExpenseType())
                .betweenIfPresent(IncomeExpenseDetailsDO::getCreateTime,pageReqVO.getCreateTime()));

    }
}
