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.PmAutoSubSetting;
import com.xisc.pm.domain.repository.PmAutoSubSettingRepository;
import com.xisc.pm.infra.mapper.PmAutoSubSettingMapper;

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

/**
 * 自动替代配置表(PmAutoSubSetting)资源库
 *
 * @author BKGY
 * @since 2024-12-27 08:56:23
 */
@Component
public class PmAutoSubSettingRepositoryImpl extends BaseRepositoryImpl<PmAutoSubSetting> implements PmAutoSubSettingRepository {
    @Resource
    private PmAutoSubSettingMapper pmAutoSubSettingMapper;

    @Override
    public List<PmAutoSubSetting> selectList(PmAutoSubSetting pmAutoSubSetting) {
        return pmAutoSubSettingMapper.selectList(pmAutoSubSetting);
    }

    @Override
    public PmAutoSubSetting selectByPrimary(Long id) {
        PmAutoSubSetting pmAutoSubSetting = new PmAutoSubSetting();
        pmAutoSubSetting.setId(id);
        List<PmAutoSubSetting> pmAutoSubSettings = pmAutoSubSettingMapper.selectList(pmAutoSubSetting);
        if (CollectionUtils.isEmpty(pmAutoSubSettings)) {
            return null;
        }
        return pmAutoSubSettings.get(0);
    }

    @Override
    public PmAutoSubSetting selectPmAutoSubSetting() {
        return pmAutoSubSettingMapper.selectPmAutoSubSetting();
    }

}

