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

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

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

/**
 * 钢锭轧制规格及切边量基准表履历表(PmIgnotSpecTrimBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 15:02:15
 */
@Component
public class PmIngotSpecTrimBtTraRepositoryImpl extends BaseRepositoryImpl<PmIngotSpecTrimBtTra> implements PmIngotSpecTrimBtTraRepository {
    @Resource
    private PmIngotSpecTrimBtTraMapper pmIngotSpecTrimBtTraMapper;

    @Override
    public List<PmIngotSpecTrimBtTra> selectList(PmIngotSpecTrimBtTra pmIngotSpecTrimBtTra) {
        return pmIngotSpecTrimBtTraMapper.selectList(pmIngotSpecTrimBtTra);
    }

    @Override
    public PmIngotSpecTrimBtTra selectByPrimary(Long traId) {
        PmIngotSpecTrimBtTra pmIngotSpecTrimBtTra = new PmIngotSpecTrimBtTra();
        pmIngotSpecTrimBtTra.setTraId(traId);
        List<PmIngotSpecTrimBtTra> pmIngotSpecTrimBtTras = pmIngotSpecTrimBtTraMapper.selectList(pmIngotSpecTrimBtTra);
        if (CollectionUtils.isEmpty(pmIngotSpecTrimBtTras)) {
            return null;
        }
        return pmIngotSpecTrimBtTras.get(0);
    }
}
