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

import com.xisc.pm.domain.entity.PmPolicyKpi;
import com.xisc.pm.domain.repository.PmPolicyKpiRepository;
import com.xisc.pm.infra.mapper.PmPolicyKpiMapper;
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;

/**
 * 策略信息与评价指标关系表(PmPolicyKpi)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:44:41
 */
@Component
@Deprecated
public class PmPolicyKpiRepositoryImpl extends BaseRepositoryImpl<PmPolicyKpi> implements PmPolicyKpiRepository {
    @Resource
    private PmPolicyKpiMapper pmPolicyKpiMapper;

    @Override
    public List<PmPolicyKpi> selectList(PmPolicyKpi pmPolicyKpi) {
        return pmPolicyKpiMapper.selectList(pmPolicyKpi);
    }

    @Override
    public PmPolicyKpi selectByPrimary(Long policyKpiId) {
        PmPolicyKpi pmPolicyKpi = new PmPolicyKpi();
        pmPolicyKpi.setPolicyKpiId(policyKpiId);
        List<PmPolicyKpi> pmPolicyKpis = pmPolicyKpiMapper.selectList(pmPolicyKpi);
        if (CollectionUtils.isEmpty(pmPolicyKpis)) {
            return null;
        }
        return pmPolicyKpis.get(0);
    }
}
