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.PmHotConfigTra;
import com.xisc.pm.domain.repository.PmHotConfigTraRepository;
import com.xisc.pm.infra.mapper.PmHotConfigTraMapper;

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

/**
 * 组炉默认热处理去向配置表履历表(PmHotConfigTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:19:24
 */
@Component
public class PmHotConfigTraRepositoryImpl extends BaseRepositoryImpl<PmHotConfigTra> implements PmHotConfigTraRepository {
    @Resource
    private PmHotConfigTraMapper pmHotConfigTraMapper;

    @Override
    public List<PmHotConfigTra> selectList(PmHotConfigTra pmHotConfigTra) {
        return pmHotConfigTraMapper.selectList(pmHotConfigTra);
    }

    @Override
    public PmHotConfigTra selectByPrimary(Long traId) {
        PmHotConfigTra pmHotConfigTra = new PmHotConfigTra();
        pmHotConfigTra.setTraId(traId);
        List<PmHotConfigTra> pmHotConfigTras = pmHotConfigTraMapper.selectList(pmHotConfigTra);
        if (CollectionUtils.isEmpty(pmHotConfigTras)) {
            return null;
        }
        return pmHotConfigTras.get(0);
    }
}
