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

import com.xisc.pm.domain.entity.PmSlabSpecBtTra;
import com.xisc.pm.domain.repository.PmSlabSpecBtTraRepository;
import com.xisc.pm.infra.mapper.PmSlabSpecBtTraMapper;
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;

/**
 * 连铸板坯生产规格基准表-履历表(PmSlabSpecBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-23 08:26:12
 */
@Component
public class PmSlabSpecBtTraRepositoryImpl extends BaseRepositoryImpl<PmSlabSpecBtTra> implements PmSlabSpecBtTraRepository {
    @Resource
    private PmSlabSpecBtTraMapper pmSlabSpecBtTraMapper;

    @Override
    public List<PmSlabSpecBtTra> selectList(PmSlabSpecBtTra pmSlabSpecBtTra) {
        return pmSlabSpecBtTraMapper.selectList(pmSlabSpecBtTra);
    }

    @Override
    public PmSlabSpecBtTra selectByPrimary(Long traId) {
        PmSlabSpecBtTra pmSlabSpecBtTra = new PmSlabSpecBtTra();
        pmSlabSpecBtTra.setTraId(traId);
        List<PmSlabSpecBtTra> pmSlabSpecBtTras = pmSlabSpecBtTraMapper.selectList(pmSlabSpecBtTra);
        if (CollectionUtils.isEmpty(pmSlabSpecBtTras)) {
            return null;
        }
        return pmSlabSpecBtTras.get(0);
    }
}
