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

import com.xisc.pm.domain.entity.PmPolicyGrOrder;
import com.xisc.pm.domain.repository.PmPolicyGrOrderRepository;
import com.xisc.pm.infra.mapper.PmPolicyGrOrderMapper;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

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

/**
 * 策略组与合同分组表(PmPolictGrOrder)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-11-08 12:28:51
 */
@Component
public class PmPolicyGrOrderRepositoryImpl extends BaseRepositoryImpl<PmPolicyGrOrder> implements PmPolicyGrOrderRepository {
    @Resource
    private PmPolicyGrOrderMapper pmPolicyGrOrderMapper;

    @Override
    public List<PmPolicyGrOrder> selectList(PmPolicyGrOrder pmPolicyGrOrder) {
        return pmPolicyGrOrderMapper.selectList(pmPolicyGrOrder);
    }

    @Override
    public PmPolicyGrOrder selectByPrimary(Long policyGroupOrderId) {
        PmPolicyGrOrder pmPolicyGrOrder = new PmPolicyGrOrder();
        pmPolicyGrOrder.setPolicyGroupOrderId(policyGroupOrderId);
        List<PmPolicyGrOrder> pmPolicyGrOrders = pmPolicyGrOrderMapper.selectList(pmPolicyGrOrder);
        if (pmPolicyGrOrders.size() == 0) {
            return null;
        }
        return pmPolicyGrOrders.get(0);
    }

}

