package com.xisc.pm.infra.repository.impl;

import com.xisc.pm.infra.mapper.PmIngotYieldBtTraMapper;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;
import com.xisc.pm.domain.entity.PmIngotYieldBtTra;
import com.xisc.pm.domain.repository.PmIngotYieldBtTraRepository;

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

/**
 * 钢锭收得率基准表履历表(PmIgnotYieldBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 18:56:33
 */
@Component
public class PmIngotYieldBtTraRepositoryImpl extends BaseRepositoryImpl<PmIngotYieldBtTra> implements PmIngotYieldBtTraRepository {
    @Resource
    private PmIngotYieldBtTraMapper pmIngotYieldBtTraMapper;

    @Override
    public List<PmIngotYieldBtTra> selectList(PmIngotYieldBtTra pmIngotYieldBtTra) {
        return pmIngotYieldBtTraMapper.selectList(pmIngotYieldBtTra);
    }

    @Override
    public PmIngotYieldBtTra selectByPrimary(Long traId) {
        PmIngotYieldBtTra pmIngotYieldBtTra = new PmIngotYieldBtTra();
        pmIngotYieldBtTra.setTraId(traId);
        List<PmIngotYieldBtTra> pmIngotYieldBtTras = pmIngotYieldBtTraMapper.selectList(pmIngotYieldBtTra);
        if (CollectionUtils.isEmpty(pmIngotYieldBtTras)) {
            return null;
        }
        return pmIngotYieldBtTras.get(0);
    }
}
