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.PmPdConstBtTra;
import com.xisc.pm.domain.repository.PmPdConstBtTraRepository;
import com.xisc.pm.infra.mapper.PmPdConstBtTraMapper;

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

/**
 * 组板常数基准表履历表(PmPdConstBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 09:08:43
 */
@Component
public class PmPdConstBtTraRepositoryImpl extends BaseRepositoryImpl<PmPdConstBtTra> implements PmPdConstBtTraRepository {
    @Resource
    private PmPdConstBtTraMapper pmPdConstBtTraMapper;

    @Override
    public List<PmPdConstBtTra> selectList(PmPdConstBtTra pmPdConstBtTra) {
        return pmPdConstBtTraMapper.selectList(pmPdConstBtTra);
    }

    @Override
    public PmPdConstBtTra selectByPrimary(Long traId) {
        PmPdConstBtTra pmPdConstBtTra = new PmPdConstBtTra();
        pmPdConstBtTra.setTraId(traId);
        List<PmPdConstBtTra> pmPdConstBtTras = pmPdConstBtTraMapper.selectList(pmPdConstBtTra);
        if (CollectionUtils.isEmpty(pmPdConstBtTras)) {
            return null;
        }
        return pmPdConstBtTras.get(0);
    }
}
