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.PmAxisBrdTrimBtTra;
import com.xisc.pm.domain.repository.PmAxisBrdTrimBtTraRepository;
import com.xisc.pm.infra.mapper.PmAxisBrdTrimBtTraMapper;

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

/**
 * 纵轧展宽宽度余量基准表-履历表(PmAxisBrdTrimBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-09-23 09:39:30
 */
@Component
public class PmAxisBrdTrimBtTraRepositoryImpl extends BaseRepositoryImpl<PmAxisBrdTrimBtTra> implements PmAxisBrdTrimBtTraRepository {
    @Resource
    private PmAxisBrdTrimBtTraMapper pmAxisBrdTrimBtTraMapper;

    @Override
    public List<PmAxisBrdTrimBtTra> selectList(PmAxisBrdTrimBtTra pmAxisBrdTrimBtTra) {
        return pmAxisBrdTrimBtTraMapper.selectList(pmAxisBrdTrimBtTra);
    }

    @Override
    public PmAxisBrdTrimBtTra selectByPrimary(Long traId) {
        PmAxisBrdTrimBtTra pmAxisBrdTrimBtTra = new PmAxisBrdTrimBtTra();
        pmAxisBrdTrimBtTra.setTraId(traId);
        List<PmAxisBrdTrimBtTra> pmAxisBrdTrimBtTras = pmAxisBrdTrimBtTraMapper.selectList(pmAxisBrdTrimBtTra);
        if (CollectionUtils.isEmpty(pmAxisBrdTrimBtTras)) {
            return null;
        }
        return pmAxisBrdTrimBtTras.get(0);
    }
}
