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.PmPonoWtStaticTra;
import com.xisc.pm.domain.repository.PmPonoWtStaticTraRepository;
import com.xisc.pm.infra.mapper.PmPonoWtStaticTraMapper;

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

/**
 * 炉重静态表履历表(PmPonoWtStaticTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 09:12:30
 */
@Component
public class PmPonoWtStaticTraRepositoryImpl extends BaseRepositoryImpl<PmPonoWtStaticTra> implements PmPonoWtStaticTraRepository {
    @Resource
    private PmPonoWtStaticTraMapper pmPonoWtStaticTraMapper;

    @Override
    public List<PmPonoWtStaticTra> selectList(PmPonoWtStaticTra pmPonoWtStaticTra) {
        return pmPonoWtStaticTraMapper.selectList(pmPonoWtStaticTra);
    }

    @Override
    public PmPonoWtStaticTra selectByPrimary(Long traId) {
        PmPonoWtStaticTra pmPonoWtStaticTra = new PmPonoWtStaticTra();
        pmPonoWtStaticTra.setTraId(traId);
        List<PmPonoWtStaticTra> pmPonoWtStaticTras = pmPonoWtStaticTraMapper.selectList(pmPonoWtStaticTra);
        if (CollectionUtils.isEmpty(pmPonoWtStaticTras)) {
            return null;
        }
        return pmPonoWtStaticTras.get(0);
    }
}
