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

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

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

/**
 * 策略信息与重要客户关系表(PmPolicyVip)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:48:16
 */
@Component
public class PmPolicyVipRepositoryImpl extends BaseRepositoryImpl<PmPolicyVip> implements PmPolicyVipRepository {
    @Resource
    private PmPolicyVipMapper pmPolicyVipMapper;

    @Override
    public List<PmPolicyVip> selectList(PmPolicyVip pmPolicyVip) {
        return pmPolicyVipMapper.selectList(pmPolicyVip);
    }

    @Override
    public PmPolicyVip selectByPrimary(Long policyVipCustId) {
        PmPolicyVip pmPolicyVip = new PmPolicyVip();
        pmPolicyVip.setPolicyVipCustId(policyVipCustId);
        List<PmPolicyVip> pmPolicyVips = pmPolicyVipMapper.selectList(pmPolicyVip);
        if (CollectionUtils.isEmpty(pmPolicyVips)) {
            return null;
        }
        return pmPolicyVips.get(0);
    }
}
