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.PmPlateSpecYieldBtTra;
import com.xisc.pm.domain.repository.PmPlateSpecYieldBtTraRepository;
import com.xisc.pm.infra.mapper.PmPlateSpecYieldBtTraMapper;

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

/**
 * 钢板轧制规格对应收得率基准表履历表(PmPlateSpecYieldBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-23 16:38:55
 */
@Component
public class PmPlateSpecYieldBtTraRepositoryImpl extends BaseRepositoryImpl<PmPlateSpecYieldBtTra> implements PmPlateSpecYieldBtTraRepository {
    @Resource
    private PmPlateSpecYieldBtTraMapper pmPlateSpecYieldBtTraMapper;

    @Override
    public List<PmPlateSpecYieldBtTra> selectList(PmPlateSpecYieldBtTra pmPlateSpecYieldBtTra) {
        return pmPlateSpecYieldBtTraMapper.selectList(pmPlateSpecYieldBtTra);
    }

    @Override
    public PmPlateSpecYieldBtTra selectByPrimary(Long traId) {
        PmPlateSpecYieldBtTra pmPlateSpecYieldBtTra = new PmPlateSpecYieldBtTra();
        pmPlateSpecYieldBtTra.setTraId(traId);
        List<PmPlateSpecYieldBtTra> pmPlateSpecYieldBtTras = pmPlateSpecYieldBtTraMapper.selectList(pmPlateSpecYieldBtTra);
        if (CollectionUtils.isEmpty(pmPlateSpecYieldBtTras)) {
            return null;
        }
        return pmPlateSpecYieldBtTras.get(0);
    }
}
