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

import com.xisc.pm.domain.entity.PmPolicyAttr;
import com.xisc.pm.domain.repository.PmPolicyAttrRepository;
import com.xisc.pm.infra.mapper.PmPolicyAttrMapper;
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;

/**
 * 策略信息扩展表(PmPolicyAttr)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:43:56
 */
@Component
@Deprecated
public class PmPolicyAttrRepositoryImpl extends BaseRepositoryImpl<PmPolicyAttr> implements PmPolicyAttrRepository {
    @Resource
    private PmPolicyAttrMapper pmPolicyAttrMapper;

    @Override
    public List<PmPolicyAttr> selectList(PmPolicyAttr pmPolicyAttr) {
        return pmPolicyAttrMapper.selectList(pmPolicyAttr);
    }

    @Override
    public PmPolicyAttr selectByPrimary(Long policyAttrId) {
        PmPolicyAttr pmPolicyAttr = new PmPolicyAttr();
        pmPolicyAttr.setPolicyAttrId(policyAttrId);
        List<PmPolicyAttr> pmPolicyAttrs = pmPolicyAttrMapper.selectList(pmPolicyAttr);
        if (CollectionUtils.isEmpty(pmPolicyAttrs)) {
            return null;
        }
        return pmPolicyAttrs.get(0);
    }
}
