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.PmStCodeBtTra;
import com.xisc.pm.domain.repository.PmStCodeBtTraRepository;
import com.xisc.pm.infra.mapper.PmStCodeBtTraMapper;

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

/**
 * 强度级别对照基准表履历表(PmStCodeBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-26 14:15:34
 */
@Component
public class PmStCodeBtTraRepositoryImpl extends BaseRepositoryImpl<PmStCodeBtTra> implements PmStCodeBtTraRepository {
    @Resource
    private PmStCodeBtTraMapper pmStCodeBtTraMapper;

    @Override
    public List<PmStCodeBtTra> selectList(PmStCodeBtTra pmStCodeBtTra) {
        return pmStCodeBtTraMapper.selectList(pmStCodeBtTra);
    }

    @Override
    public PmStCodeBtTra selectByPrimary(Long traId) {
        PmStCodeBtTra pmStCodeBtTra = new PmStCodeBtTra();
        pmStCodeBtTra.setTraId(traId);
        List<PmStCodeBtTra> pmStCodeBtTras = pmStCodeBtTraMapper.selectList(pmStCodeBtTra);
        if (CollectionUtils.isEmpty(pmStCodeBtTras)) {
            return null;
        }
        return pmStCodeBtTras.get(0);
    }
}
