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.PmSlabScrapLenBtTra;
import com.xisc.pm.domain.repository.PmSlabScrapLenBtTraRepository;
import com.xisc.pm.infra.mapper.PmSlabScrapLenBtTraMapper;

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

/**
 * 余坯组板采用判定基准表履历表(PmSlabScrapLenBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-23 14:28:57
 */
@Component
public class PmSlabScrapLenBtTraRepositoryImpl extends BaseRepositoryImpl<PmSlabScrapLenBtTra> implements PmSlabScrapLenBtTraRepository {
    @Resource
    private PmSlabScrapLenBtTraMapper pmSlabScrapLenBtTraMapper;

    @Override
    public List<PmSlabScrapLenBtTra> selectList(PmSlabScrapLenBtTra pmSlabScrapLenBtTra) {
        return pmSlabScrapLenBtTraMapper.selectList(pmSlabScrapLenBtTra);
    }

    @Override
    public PmSlabScrapLenBtTra selectByPrimary(Long traId) {
        PmSlabScrapLenBtTra pmSlabScrapLenBtTra = new PmSlabScrapLenBtTra();
        pmSlabScrapLenBtTra.setTraId(traId);
        List<PmSlabScrapLenBtTra> pmSlabScrapLenBtTras = pmSlabScrapLenBtTraMapper.selectList(pmSlabScrapLenBtTra);
        if (CollectionUtils.isEmpty(pmSlabScrapLenBtTras)) {
            return null;
        }
        return pmSlabScrapLenBtTras.get(0);
    }
}
