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.PmSpeStAddvBtTra;
import com.xisc.pm.domain.repository.PmSpeStAddvBtTraRepository;
import com.xisc.pm.infra.mapper.PmSpeStAddvBtTraMapper;

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

/**
 * 特殊钢种余量增加表履历表(PmSpeStAddvBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 08:50:36
 */
@Component
public class PmSpeStAddvBtTraRepositoryImpl extends BaseRepositoryImpl<PmSpeStAddvBtTra> implements PmSpeStAddvBtTraRepository {
    @Resource
    private PmSpeStAddvBtTraMapper pmSpeStAddvBtTraMapper;

    @Override
    public List<PmSpeStAddvBtTra> selectList(PmSpeStAddvBtTra pmSpeStAddvBtTra) {
        return pmSpeStAddvBtTraMapper.selectList(pmSpeStAddvBtTra);
    }

    @Override
    public PmSpeStAddvBtTra selectByPrimary(Long traId) {
        PmSpeStAddvBtTra pmSpeStAddvBtTra = new PmSpeStAddvBtTra();
        pmSpeStAddvBtTra.setTraId(traId);
        List<PmSpeStAddvBtTra> pmSpeStAddvBtTras = pmSpeStAddvBtTraMapper.selectList(pmSpeStAddvBtTra);
        if (CollectionUtils.isEmpty(pmSpeStAddvBtTras)) {
            return null;
        }
        return pmSpeStAddvBtTras.get(0);
    }
}
