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.PmSlabLenConfigTra;
import com.xisc.pm.domain.repository.PmSlabLenConfigTraRepository;
import com.xisc.pm.infra.mapper.PmSlabLenConfigTraMapper;

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

/**
 * 板坯组矩长度配置表履历表(PmSlabLenConfigTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:30:36
 */
@Component
public class PmSlabLenConfigTraRepositoryImpl extends BaseRepositoryImpl<PmSlabLenConfigTra> implements PmSlabLenConfigTraRepository {
    @Resource
    private PmSlabLenConfigTraMapper pmSlabLenConfigTraMapper;

    @Override
    public List<PmSlabLenConfigTra> selectList(PmSlabLenConfigTra pmSlabLenConfigTra) {
        return pmSlabLenConfigTraMapper.selectList(pmSlabLenConfigTra);
    }

    @Override
    public PmSlabLenConfigTra selectByPrimary(Long traId) {
        PmSlabLenConfigTra pmSlabLenConfigTra = new PmSlabLenConfigTra();
        pmSlabLenConfigTra.setTraId(traId);
        List<PmSlabLenConfigTra> pmSlabLenConfigTras = pmSlabLenConfigTraMapper.selectList(pmSlabLenConfigTra);
        if (CollectionUtils.isEmpty(pmSlabLenConfigTras)) {
            return null;
        }
        return pmSlabLenConfigTras.get(0);
    }
}
