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.PmPlateCutLenBtTra;
import com.xisc.pm.domain.repository.PmPlateCutLenBtTraRepository;
import com.xisc.pm.infra.mapper.PmPlateCutLenBtTraMapper;

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

/**
 * 钢板切缝切头尾范围基准表履历表(PmPlateCutLenBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 09:27:02
 */
@Component
public class PmPlateCutLenBtTraRepositoryImpl extends BaseRepositoryImpl<PmPlateCutLenBtTra> implements PmPlateCutLenBtTraRepository {
    @Resource
    private PmPlateCutLenBtTraMapper pmPlateCutLenBtTraMapper;

    @Override
    public List<PmPlateCutLenBtTra> selectList(PmPlateCutLenBtTra pmPlateCutLenBtTra) {
        return pmPlateCutLenBtTraMapper.selectList(pmPlateCutLenBtTra);
    }

    @Override
    public PmPlateCutLenBtTra selectByPrimary(Long traId) {
        PmPlateCutLenBtTra pmPlateCutLenBtTra = new PmPlateCutLenBtTra();
        pmPlateCutLenBtTra.setTraId(traId);
        List<PmPlateCutLenBtTra> pmPlateCutLenBtTras = pmPlateCutLenBtTraMapper.selectList(pmPlateCutLenBtTra);
        if (CollectionUtils.isEmpty(pmPlateCutLenBtTras)) {
            return null;
        }
        return pmPlateCutLenBtTras.get(0);
    }
}
