package com.xisc.pm.infra.repository.impl;

import com.xisc.pm.domain.entity.PmSlabPoolInHis;
import com.xisc.pm.domain.repository.PmSlabPoolInHisRepository;
import com.xisc.pm.infra.mapper.PmSlabPoolInHisMapper;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

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

/**
 * 组炉收池历史表(PmSlabPoolInHis)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2025-01-03 14:12:22
 */
@Component
public class PmSlabPoolInHisRepositoryImpl extends BaseRepositoryImpl<PmSlabPoolInHis> implements PmSlabPoolInHisRepository {
    @Resource
    private PmSlabPoolInHisMapper pmSlabPoolInHisMapper;

    @Override
    public List<PmSlabPoolInHis> selectList(PmSlabPoolInHis pmSlabPoolInHis) {
        return pmSlabPoolInHisMapper.selectList(pmSlabPoolInHis);
    }

    @Override
    public PmSlabPoolInHis selectByPrimary(Long traId) {
        PmSlabPoolInHis pmSlabPoolInHis = new PmSlabPoolInHis();
        pmSlabPoolInHis.setTraId(traId);
        List<PmSlabPoolInHis> pmSlabPoolInHiss = pmSlabPoolInHisMapper.selectList(pmSlabPoolInHis);
        if (CollectionUtils.isEmpty(pmSlabPoolInHiss)) {
            return null;
        }
        return pmSlabPoolInHiss.get(0);
    }

}

