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.PmSlabReplBtTra;
import com.xisc.pm.domain.repository.PmSlabReplBtTraRepository;
import com.xisc.pm.infra.mapper.PmSlabReplBtTraMapper;

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

/**
 * 余材组板内部钢种以优充次对照表履历表(PmSlabReplBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 11:30:49
 */
@Component
public class PmSlabReplBtTraRepositoryImpl extends BaseRepositoryImpl<PmSlabReplBtTra> implements PmSlabReplBtTraRepository {
    @Resource
    private PmSlabReplBtTraMapper pmSlabReplBtTraMapper;

    @Override
    public List<PmSlabReplBtTra> selectList(PmSlabReplBtTra pmSlabReplBtTra) {
        return pmSlabReplBtTraMapper.selectList(pmSlabReplBtTra);
    }

    @Override
    public PmSlabReplBtTra selectByPrimary(Long traId) {
        PmSlabReplBtTra pmSlabReplBtTra = new PmSlabReplBtTra();
        pmSlabReplBtTra.setTraId(traId);
        List<PmSlabReplBtTra> pmSlabReplBtTras = pmSlabReplBtTraMapper.selectList(pmSlabReplBtTra);
        if (CollectionUtils.isEmpty(pmSlabReplBtTras)) {
            return null;
        }
        return pmSlabReplBtTras.get(0);
    }
}
