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.PmIngotTypeBtTra;
import com.xisc.pm.domain.repository.PmIngotTypeBtTraRepository;
import com.xisc.pm.infra.mapper.PmIngotTypeBtTraMapper;

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

/**
 * 锭坯型基表履历表(PmIngotTypeBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-29 14:54:29
 */
@Component
public class PmIngotTypeBtTraRepositoryImpl extends BaseRepositoryImpl<PmIngotTypeBtTra> implements PmIngotTypeBtTraRepository {
    @Resource
    private PmIngotTypeBtTraMapper pmIngotTypeBtTraMapper;

    @Override
    public List<PmIngotTypeBtTra> selectList(PmIngotTypeBtTra pmIngotTypeBtTra) {
        return pmIngotTypeBtTraMapper.selectList(pmIngotTypeBtTra);
    }

    @Override
    public PmIngotTypeBtTra selectByPrimary(Long traId) {
        PmIngotTypeBtTra pmIngotTypeBtTra = new PmIngotTypeBtTra();
        pmIngotTypeBtTra.setTraId(traId);
        List<PmIngotTypeBtTra> pmIngotTypeBtTras = pmIngotTypeBtTraMapper.selectList(pmIngotTypeBtTra);
        if (CollectionUtils.isEmpty(pmIngotTypeBtTras)) {
            return null;
        }
        return pmIngotTypeBtTras.get(0);
    }
}
