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.PmMinThickTolBtTra;
import com.xisc.pm.domain.repository.PmMinThickTolBtTraRepository;
import com.xisc.pm.infra.mapper.PmMinThickTolBtTraMapper;

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

/**
 * 最小轧制厚度公差范围基准表(PmMinThickTolBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-23 11:11:58
 */
@Component
public class PmMinThickTolBtTraRepositoryImpl extends BaseRepositoryImpl<PmMinThickTolBtTra> implements PmMinThickTolBtTraRepository {
    @Resource
    private PmMinThickTolBtTraMapper pmMinThickTolBtTraMapper;

    @Override
    public List<PmMinThickTolBtTra> selectList(PmMinThickTolBtTra pmMinThickTolBtTra) {
        return pmMinThickTolBtTraMapper.selectList(pmMinThickTolBtTra);
    }

    @Override
    public PmMinThickTolBtTra selectByPrimary(Long traId) {
        PmMinThickTolBtTra pmMinThickTolBtTra = new PmMinThickTolBtTra();
        pmMinThickTolBtTra.setTraId(traId);
        List<PmMinThickTolBtTra> pmMinThickTolBtTras = pmMinThickTolBtTraMapper.selectList(pmMinThickTolBtTra);
        if (CollectionUtils.isEmpty(pmMinThickTolBtTras)) {
            return null;
        }
        return pmMinThickTolBtTras.get(0);
    }
}
