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.PmPnsort;
import com.xisc.pm.domain.repository.PmPnsortRepository;
import com.xisc.pm.infra.mapper.PmPnsortMapper;

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

/**
 * 组炉规则配置表(PmPnsort)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-09-11 15:59:47
 */
@Component
public class PmPnsortRepositoryImpl extends BaseRepositoryImpl<PmPnsort> implements PmPnsortRepository {
    @Resource
    private PmPnsortMapper pmPnsortMapper;

    @Override
    public List<PmPnsort> selectList(PmPnsort pmPnsort) {
        return pmPnsortMapper.selectList(pmPnsort);
    }

    @Override
    public PmPnsort selectByPrimary(Long id) {
        PmPnsort pmPnsort = new PmPnsort();
        pmPnsort.setId(id);
        List<PmPnsort> pmPnsorts = pmPnsortMapper.selectList(pmPnsort);
        if (CollectionUtils.isEmpty(pmPnsorts)) {
            return null;
        }
        return pmPnsorts.get(0);
    }
}
