package com.openhis.financial.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.common.enums.PaymentResult;
import com.openhis.financial.domain.PaymentRecDetail;
import com.openhis.financial.mapper.PaymentRecDetailMapper;
import com.openhis.financial.model.PaymentRecDetailAccountResult;
import com.openhis.financial.service.IPaymentRecDetailService;

/**
 * 付款管理Service业务层处理
 *
 * @author system
 * @date 2025-02-20
 */
@Service
public class PaymentRecDetailServiceImpl extends ServiceImpl<PaymentRecDetailMapper, PaymentRecDetail>
    implements IPaymentRecDetailService {

    /**
     * 根据paymentId更改结算结果
     * 
     * @param id id
     * @param paid PaymentResult
     */
    @Override
    public void updateResultByPaymentId(Long id, PaymentResult paid) {
        baseMapper.update(new PaymentRecDetail().setResultEnum(PaymentResult.PAID.getValue()),
            new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, id));
    }

    /**
     * 根据paymentId集合查询详情信息
     * 
     * @param paymentIdList 集合
     * @return 集合
     */
    @Override
    public List<PaymentRecDetailAccountResult> getListByReconciliationIds(List<Long> paymentIdList) {
        return baseMapper.getListByReconciliationIds(paymentIdList);
    }
}