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.PmStCodeBt;
import com.xisc.pm.domain.repository.PmStCodeBtRepository;
import com.xisc.pm.infra.mapper.PmStCodeBtMapper;

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

/**
 * 强度级别对照基准表(PmStCodeBt)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-26 14:15:14
 */
@Component
public class PmStCodeBtRepositoryImpl extends BaseRepositoryImpl<PmStCodeBt> implements PmStCodeBtRepository {
    @Resource
    private PmStCodeBtMapper pmStCodeBtMapper;

    @Override
    public List<PmStCodeBt> selectList(PmStCodeBt pmStCodeBt) {
        return pmStCodeBtMapper.selectList(pmStCodeBt);
    }

    @Override
    public PmStCodeBt selectByPrimary(Long pscbId) {
        PmStCodeBt pmStCodeBt = new PmStCodeBt();
        pmStCodeBt.setPscbId(pscbId);
        List<PmStCodeBt> pmStCodeBts = pmStCodeBtMapper.selectList(pmStCodeBt);
        if (CollectionUtils.isEmpty(pmStCodeBts)) {
            return null;
        }
        return pmStCodeBts.get(0);
    }
}
