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.PmPolicySlabMethod;
import com.xisc.pm.domain.repository.PmPolicySlabMethodRepository;
import com.xisc.pm.infra.mapper.PmPolicySlabMethodMapper;

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

/**
 * 策略信息与组板方式关系表(PmPolicySlabMethod)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:46:56
 */
@Component
public class PmPolicySlabMethodRepositoryImpl extends BaseRepositoryImpl<PmPolicySlabMethod> implements PmPolicySlabMethodRepository {
    @Resource
    private PmPolicySlabMethodMapper pmPolicySlabMethodMapper;

    @Override
    public List<PmPolicySlabMethod> selectList(PmPolicySlabMethod pmPolicySlabMethod) {
        return pmPolicySlabMethodMapper.selectList(pmPolicySlabMethod);
    }

    @Override
    public PmPolicySlabMethod selectByPrimary(Long policySlabMethodId) {
        PmPolicySlabMethod pmPolicySlabMethod = new PmPolicySlabMethod();
        pmPolicySlabMethod.setPolicySlabMethodId(policySlabMethodId);
        List<PmPolicySlabMethod> pmPolicySlabMethods = pmPolicySlabMethodMapper.selectList(pmPolicySlabMethod);
        if (CollectionUtils.isEmpty(pmPolicySlabMethods)) {
            return null;
        }
        return pmPolicySlabMethods.get(0);
    }
}
