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.PmPdTmpYieldBtTra;
import com.xisc.pm.domain.repository.PmPdTmpYieldBtTraRepository;
import com.xisc.pm.infra.mapper.PmPdTmpYieldBtTraMapper;

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

/**
 * 组板临时收得率基准表履历表(PmPdTmpYieldBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 10:10:18
 */
@Component
public class PmPdTmpYieldBtTraRepositoryImpl extends BaseRepositoryImpl<PmPdTmpYieldBtTra> implements PmPdTmpYieldBtTraRepository {
    @Resource
    private PmPdTmpYieldBtTraMapper pmPdTmpYieldBtTraMapper;

    @Override
    public List<PmPdTmpYieldBtTra> selectList(PmPdTmpYieldBtTra pmPdTmpYieldBtTra) {
        return pmPdTmpYieldBtTraMapper.selectList(pmPdTmpYieldBtTra);
    }

    @Override
    public PmPdTmpYieldBtTra selectByPrimary(Long traId) {
        PmPdTmpYieldBtTra pmPdTmpYieldBtTra = new PmPdTmpYieldBtTra();
        pmPdTmpYieldBtTra.setTraId(traId);
        List<PmPdTmpYieldBtTra> pmPdTmpYieldBtTras = pmPdTmpYieldBtTraMapper.selectList(pmPdTmpYieldBtTra);
        if (CollectionUtils.isEmpty(pmPdTmpYieldBtTras)) {
            return null;
        }
        return pmPdTmpYieldBtTras.get(0);
    }
}
