package com.xisc.pm.infra.repository.impl;

import com.xisc.pm.domain.entity.PmPolicyOrder;
import com.xisc.pm.domain.repository.PmPolicyOrderRepository;
import com.xisc.pm.infra.mapper.PmPolicyOrderMapper;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 策略信息与合同分组头表(PmPolicyOrder)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:45:14
 */
@Component
@Deprecated
public class PmPolicyOrderRepositoryImpl extends BaseRepositoryImpl<PmPolicyOrder> implements PmPolicyOrderRepository {
    @Resource
    private PmPolicyOrderMapper pmPolicyOrderMapper;

    @Override
    public List<PmPolicyOrder> selectList(PmPolicyOrder pmPolicyOrder) {
        return pmPolicyOrderMapper.selectList(pmPolicyOrder);
    }

    @Override
    public PmPolicyOrder selectByPrimary(Long policyContractGroupId) {
        PmPolicyOrder pmPolicyOrder = new PmPolicyOrder();
        pmPolicyOrder.setPolicyContractGroupId(policyContractGroupId);
        List<PmPolicyOrder> pmPolicyOrders = pmPolicyOrderMapper.selectList(pmPolicyOrder);
        if (CollectionUtils.isEmpty(pmPolicyOrders)) {
            return null;
        }
        return pmPolicyOrders.get(0);
    }
}
