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.PmSlabReplBt;
import com.xisc.pm.domain.repository.PmSlabReplBtRepository;
import com.xisc.pm.infra.mapper.PmSlabReplBtMapper;

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

/**
 * 余材组板内部钢种以优充次对照表(PmSlabReplBt)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 11:30:28
 */
@Component
public class PmSlabReplBtRepositoryImpl extends BaseRepositoryImpl<PmSlabReplBt> implements PmSlabReplBtRepository {
    @Resource
    private PmSlabReplBtMapper pmSlabReplBtMapper;

    @Override
    public List<PmSlabReplBt> selectList(PmSlabReplBt pmSlabReplBt) {
        return pmSlabReplBtMapper.selectList(pmSlabReplBt);
    }

    @Override
    public PmSlabReplBt selectByPrimary(Long psrbId) {
        PmSlabReplBt pmSlabReplBt = new PmSlabReplBt();
        pmSlabReplBt.setPsrbId(psrbId);
        List<PmSlabReplBt> pmSlabReplBts = pmSlabReplBtMapper.selectList(pmSlabReplBt);
        if (CollectionUtils.isEmpty(pmSlabReplBts)) {
            return null;
        }
        return pmSlabReplBts.get(0);
    }
}
