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

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

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

/**
 * 钢锭切缝量基准表履历表(PmIgnotCutLenBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 15:55:25
 */
@Component
public class PmIngotCutLenBtTraRepositoryImpl extends BaseRepositoryImpl<PmIngotCutLenBtTra> implements PmIngotCutLenBtTraRepository {
    @Resource
    private PmIngotCutLenBtTraMapper pmIngotCutLenBtTraMapper;

    @Override
    public List<PmIngotCutLenBtTra> selectList(PmIngotCutLenBtTra pmIngotCutLenBtTra) {
        return pmIngotCutLenBtTraMapper.selectList(pmIngotCutLenBtTra);
    }

    @Override
    public PmIngotCutLenBtTra selectByPrimary(Long traId) {
        PmIngotCutLenBtTra pmIngotCutLenBtTra = new PmIngotCutLenBtTra();
        pmIngotCutLenBtTra.setTraId(traId);
        List<PmIngotCutLenBtTra> pmIngotCutLenBtTras = pmIngotCutLenBtTraMapper.selectList(pmIngotCutLenBtTra);
        if (CollectionUtils.isEmpty(pmIngotCutLenBtTras)) {
            return null;
        }
        return pmIngotCutLenBtTras.get(0);
    }
}
