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

import com.xisc.pm.domain.entity.PmPolicyGroupAttr;
import com.xisc.pm.domain.repository.PmPolicyGroupAttrRepository;
import com.xisc.pm.infra.mapper.PmPolicyGroupAttrMapper;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

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

/**
 * 策略组扩展表(PmPolicyGroupAttr)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-11-14 15:58:27
 */
@Component
public class PmPolicyGroupAttrRepositoryImpl extends BaseRepositoryImpl<PmPolicyGroupAttr> implements PmPolicyGroupAttrRepository {
    @Resource
    private PmPolicyGroupAttrMapper pmPolicyGroupAttrMapper;

    @Override
    public List<PmPolicyGroupAttr> selectList(PmPolicyGroupAttr pmPolicyGroupAttr) {
        return pmPolicyGroupAttrMapper.selectList(pmPolicyGroupAttr);
    }

    @Override
    public PmPolicyGroupAttr selectByPrimary(Long policyGroupId) {
        PmPolicyGroupAttr pmPolicyGroupAttr = new PmPolicyGroupAttr();
        pmPolicyGroupAttr.setPolicyGroupId(policyGroupId);
        List<PmPolicyGroupAttr> pmPolicyGroupAttrs = pmPolicyGroupAttrMapper.selectList(pmPolicyGroupAttr);
        if (pmPolicyGroupAttrs.size() == 0) {
            return null;
        }
        return pmPolicyGroupAttrs.get(0);
    }

}

