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

import com.xisc.pm.domain.entity.PmSlabEstaPlanHis;
import com.xisc.pm.domain.repository.PmSlabEstaPlanHisRepository;
import com.xisc.pm.infra.mapper.PmSlabEstaPlanHisMapper;
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;

/**
 * 组炉编制历史表(PmSlabEstaPlanHis)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2025-01-03 14:11:14
 */
@Component
public class PmSlabEstaPlanHisRepositoryImpl extends BaseRepositoryImpl<PmSlabEstaPlanHis> implements PmSlabEstaPlanHisRepository {
    @Resource
    private PmSlabEstaPlanHisMapper pmSlabEstaPlanHisMapper;

    @Override
    public List<PmSlabEstaPlanHis> selectList(PmSlabEstaPlanHis pmSlabEstaPlanHis) {
        return pmSlabEstaPlanHisMapper.selectList(pmSlabEstaPlanHis);
    }

    @Override
    public PmSlabEstaPlanHis selectByPrimary(Long traId) {
        PmSlabEstaPlanHis pmSlabEstaPlanHis = new PmSlabEstaPlanHis();
        pmSlabEstaPlanHis.setTraId(traId);
        List<PmSlabEstaPlanHis> pmSlabEstaPlanHiss = pmSlabEstaPlanHisMapper.selectList(pmSlabEstaPlanHis);
        if (CollectionUtils.isEmpty(pmSlabEstaPlanHiss)) {
            return null;
        }
        return pmSlabEstaPlanHiss.get(0);
    }
}
