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.PmSlabLenConfig;
import com.xisc.pm.domain.repository.PmSlabLenConfigRepository;
import com.xisc.pm.infra.mapper.PmSlabLenConfigMapper;

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

/**
 * 板坯组矩长度配置表(PmSlabLenConfig)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:30:14
 */
@Component
public class PmSlabLenConfigRepositoryImpl extends BaseRepositoryImpl<PmSlabLenConfig> implements PmSlabLenConfigRepository {
    @Resource
    private PmSlabLenConfigMapper pmSlabLenConfigMapper;

    @Override
    public List<PmSlabLenConfig> selectList(PmSlabLenConfig pmSlabLenConfig) {
        return pmSlabLenConfigMapper.selectList(pmSlabLenConfig);
    }

    @Override
    public PmSlabLenConfig selectByPrimary(Long id) {
        PmSlabLenConfig pmSlabLenConfig = new PmSlabLenConfig();
        pmSlabLenConfig.setId(id);
        List<PmSlabLenConfig> pmSlabLenConfigs = pmSlabLenConfigMapper.selectList(pmSlabLenConfig);
        if (CollectionUtils.isEmpty(pmSlabLenConfigs)) {
            return null;
        }
        return pmSlabLenConfigs.get(0);
    }
}
