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.PmPolicySteelType;
import com.xisc.pm.domain.repository.PmPolicySteelTypeRepository;
import com.xisc.pm.infra.mapper.PmPolicySteelTypeMapper;

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

/**
 * 策略信息内部钢种表(PmPolicySteelType)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:47:50
 */
@Component
public class PmPolicySteelTypeRepositoryImpl extends BaseRepositoryImpl<PmPolicySteelType> implements PmPolicySteelTypeRepository {
    @Resource
    private PmPolicySteelTypeMapper pmPolicySteelTypeMapper;

    @Override
    public List<PmPolicySteelType> selectList(PmPolicySteelType pmPolicySteelType) {
        return pmPolicySteelTypeMapper.selectList(pmPolicySteelType);
    }

    @Override
    public PmPolicySteelType selectByPrimary(Long policyStId) {
        PmPolicySteelType pmPolicySteelType = new PmPolicySteelType();
        pmPolicySteelType.setPolicyStId(policyStId);
        List<PmPolicySteelType> pmPolicySteelTypes = pmPolicySteelTypeMapper.selectList(pmPolicySteelType);
        if (CollectionUtils.isEmpty(pmPolicySteelTypes)) {
            return null;
        }
        return pmPolicySteelTypes.get(0);
    }
}
