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.PmRetainStack;
import com.xisc.pm.domain.repository.PmRetainStackRepository;
import com.xisc.pm.infra.mapper.PmRetainStackMapper;

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

/**
 * 仓库交货配置表(PmRetainStack)资源库
 *
 * @author BKGY
 * @since 2024-12-25 08:45:27
 */
@Component
public class PmRetainStackRepositoryImpl extends BaseRepositoryImpl<PmRetainStack> implements PmRetainStackRepository {
    @Resource
    private PmRetainStackMapper pmRetainStackMapper;

    @Override
    public List<PmRetainStack> selectList(PmRetainStack pmRetainStack) {
        return pmRetainStackMapper.selectList(pmRetainStack);
    }

    @Override
    public PmRetainStack selectByPrimary(Long id) {
        PmRetainStack pmRetainStack = new PmRetainStack();
        pmRetainStack.setId(id);
        List<PmRetainStack> pmRetainStacks = pmRetainStackMapper.selectList(pmRetainStack);
        if (CollectionUtils.isEmpty(pmRetainStacks)) {
            return null;
        }
        return pmRetainStacks.get(0);
    }

}

