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.PmMidSlabAddvBtTra;
import com.xisc.pm.domain.repository.PmMidSlabAddvBtTraRepository;
import com.xisc.pm.infra.mapper.PmMidSlabAddvBtTraMapper;

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

/**
 * 中间坯加量基准表-履历表(PmMidSlabAddvBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-09-18 18:31:44
 */
@Component
public class PmMidSlabAddvBtTraRepositoryImpl extends BaseRepositoryImpl<PmMidSlabAddvBtTra> implements PmMidSlabAddvBtTraRepository {
    @Resource
    private PmMidSlabAddvBtTraMapper pmMidSlabAddvBtTraMapper;

    @Override
    public List<PmMidSlabAddvBtTra> selectList(PmMidSlabAddvBtTra pmMidSlabAddvBtTra) {
        return pmMidSlabAddvBtTraMapper.selectList(pmMidSlabAddvBtTra);
    }

    @Override
    public PmMidSlabAddvBtTra selectByPrimary(Long traId) {
        PmMidSlabAddvBtTra pmMidSlabAddvBtTra = new PmMidSlabAddvBtTra();
        pmMidSlabAddvBtTra.setTraId(traId);
        List<PmMidSlabAddvBtTra> pmMidSlabAddvBtTras = pmMidSlabAddvBtTraMapper.selectList(pmMidSlabAddvBtTra);
        if (CollectionUtils.isEmpty(pmMidSlabAddvBtTras)) {
            return null;
        }
        return pmMidSlabAddvBtTras.get(0);
    }
}
