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.PmHeatTreatFurnaceBt;
import com.xisc.pm.domain.repository.PmHeatTreatFurnaceBtRepository;
import com.xisc.pm.infra.mapper.PmHeatTreatFurnaceBtMapper;

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

/**
 * 热处理炉基准规格表(PmHeatTreatFurnaceBt)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 12:24:42
 */
@Component
public class PmHeatTreatFurnaceBtRepositoryImpl extends BaseRepositoryImpl<PmHeatTreatFurnaceBt> implements PmHeatTreatFurnaceBtRepository {
    @Resource
    private PmHeatTreatFurnaceBtMapper pmHeatTreatFurnaceBtMapper;

    @Override
    public List<PmHeatTreatFurnaceBt> selectList(PmHeatTreatFurnaceBt pmHeatTreatFurnaceBt) {
        return pmHeatTreatFurnaceBtMapper.selectList(pmHeatTreatFurnaceBt);
    }

    @Override
    public PmHeatTreatFurnaceBt selectByPrimary(Long phtfbId) {
        PmHeatTreatFurnaceBt pmHeatTreatFurnaceBt = new PmHeatTreatFurnaceBt();
        pmHeatTreatFurnaceBt.setPhtfbId(phtfbId);
        List<PmHeatTreatFurnaceBt> pmHeatTreatFurnaceBts = pmHeatTreatFurnaceBtMapper.selectList(pmHeatTreatFurnaceBt);
        if (CollectionUtils.isEmpty(pmHeatTreatFurnaceBts)) {
            return null;
        }
        return pmHeatTreatFurnaceBts.get(0);
    }
}
