package com.jeesharp.business.modules.finance.merchantsettlement.mapper;

import com.jeesharp.business.modules.finance.merchantsettlement.entity.MerchantSettlementBill;
import com.jeesharp.business.modules.finance.merchantsettlement.vo.MerchantSettlementBillQueryVO;
import com.jeesharp.framework.mybatis.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;

/**
 * 商户结算单 MyBatis Mapper。
 *
 * @author jeesharp
 * @since 2026-06-29
 */
@Mapper
public interface MerchantSettlementBillMapper extends BaseMapper<MerchantSettlementBill, MerchantSettlementBillQueryVO> {

    /**
     * 按商户与账期查询有效结算单（幂等生成校验）。
     */
    MerchantSettlementBill findByMerchantAndPeriod(@Param("merchantTenantId") String merchantTenantId,
            @Param("periodStart") LocalDateTime periodStart,
            @Param("periodEnd") LocalDateTime periodEnd);
}
