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.PmHeatTreatFurnaceBtTra;
import com.xisc.pm.domain.repository.PmHeatTreatFurnaceBtTraRepository;
import com.xisc.pm.infra.mapper.PmHeatTreatFurnaceBtTraMapper;

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

/**
 * 热处理炉基准规格表履历表(PmHeatTreatFurnaceBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 12:25:00
 */
@Component
public class PmHeatTreatFurnaceBtTraRepositoryImpl extends BaseRepositoryImpl<PmHeatTreatFurnaceBtTra> implements PmHeatTreatFurnaceBtTraRepository {
    @Resource
    private PmHeatTreatFurnaceBtTraMapper pmHeatTreatFurnaceBtTraMapper;

    @Override
    public List<PmHeatTreatFurnaceBtTra> selectList(PmHeatTreatFurnaceBtTra pmHeatTreatFurnaceBtTra) {
        return pmHeatTreatFurnaceBtTraMapper.selectList(pmHeatTreatFurnaceBtTra);
    }

    @Override
    public PmHeatTreatFurnaceBtTra selectByPrimary(Long traId) {
        PmHeatTreatFurnaceBtTra pmHeatTreatFurnaceBtTra = new PmHeatTreatFurnaceBtTra();
        pmHeatTreatFurnaceBtTra.setTraId(traId);
        List<PmHeatTreatFurnaceBtTra> pmHeatTreatFurnaceBtTras = pmHeatTreatFurnaceBtTraMapper.selectList(pmHeatTreatFurnaceBtTra);
        if (CollectionUtils.isEmpty(pmHeatTreatFurnaceBtTras)) {
            return null;
        }
        return pmHeatTreatFurnaceBtTras.get(0);
    }
}
