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.PmHotConfig;
import com.xisc.pm.domain.repository.PmHotConfigRepository;
import com.xisc.pm.infra.mapper.PmHotConfigMapper;

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

/**
 * 组炉默认热处理去向配置表(PmHotConfig)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:19:07
 */
@Component
public class PmHotConfigRepositoryImpl extends BaseRepositoryImpl<PmHotConfig> implements PmHotConfigRepository {
    @Resource
    private PmHotConfigMapper pmHotConfigMapper;

    @Override
    public List<PmHotConfig> selectList(PmHotConfig pmHotConfig) {
        return pmHotConfigMapper.selectList(pmHotConfig);
    }

    @Override
    public PmHotConfig selectByPrimary(Long id) {
        PmHotConfig pmHotConfig = new PmHotConfig();
        pmHotConfig.setId(id);
        List<PmHotConfig> pmHotConfigs = pmHotConfigMapper.selectList(pmHotConfig);
        if (CollectionUtils.isEmpty(pmHotConfigs)) {
            return null;
        }
        return pmHotConfigs.get(0);
    }
}
