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.PmPnsortTra;
import com.xisc.pm.domain.repository.PmPnsortTraRepository;
import com.xisc.pm.infra.mapper.PmPnsortTraMapper;

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

/**
 * 组炉规则配置表-履历表(PmPnsortTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-09-11 16:00:12
 */
@Component
public class PmPnsortTraRepositoryImpl extends BaseRepositoryImpl<PmPnsortTra> implements PmPnsortTraRepository {
    @Resource
    private PmPnsortTraMapper pmPnsortTraMapper;

    @Override
    public List<PmPnsortTra> selectList(PmPnsortTra pmPnsortTra) {
        return pmPnsortTraMapper.selectList(pmPnsortTra);
    }

    @Override
    public PmPnsortTra selectByPrimary(Long traId) {
        PmPnsortTra pmPnsortTra = new PmPnsortTra();
        pmPnsortTra.setTraId(traId);
        List<PmPnsortTra> pmPnsortTras = pmPnsortTraMapper.selectList(pmPnsortTra);
        if (CollectionUtils.isEmpty(pmPnsortTras)) {
            return null;
        }
        return pmPnsortTras.get(0);
    }
}
