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

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

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

/**
 * 预留试样基表-履历表(PmSampleReserveBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-12-18 16:02:16
 */
@Component
public class PmSampleReserveBtTraRepositoryImpl extends BaseRepositoryImpl<PmSampleReserveBtTra> implements PmSampleReserveBtTraRepository {
    @Resource
    private PmSampleReserveBtTraMapper pmSampleReserveBtTraMapper;

    @Override
    public List<PmSampleReserveBtTra> selectList(PmSampleReserveBtTra pmSampleReserveBtTra) {
        return pmSampleReserveBtTraMapper.selectList(pmSampleReserveBtTra);
    }

    @Override
    public PmSampleReserveBtTra selectByPrimary(Long traId) {
        PmSampleReserveBtTra pmSampleReserveBtTra = new PmSampleReserveBtTra();
        pmSampleReserveBtTra.setTraId(traId);
        List<PmSampleReserveBtTra> pmSampleReserveBtTras = pmSampleReserveBtTraMapper.selectList(pmSampleReserveBtTra);
        if (CollectionUtils.isEmpty(pmSampleReserveBtTras)) {
            return null;
        }
        return pmSampleReserveBtTras.get(0);
    }

}

