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.PmPonoWtStaticGdTra;
import com.xisc.pm.domain.repository.PmPonoWtStaticGdTraRepository;
import com.xisc.pm.infra.mapper.PmPonoWtStaticGdTraMapper;

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

/**
 * 炉重静态表_钢锭履历表(PmPonoWtStaticGdTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 09:41:45
 */
@Component
public class PmPonoWtStaticGdTraRepositoryImpl extends BaseRepositoryImpl<PmPonoWtStaticGdTra> implements PmPonoWtStaticGdTraRepository {
    @Resource
    private PmPonoWtStaticGdTraMapper pmPonoWtStaticGdTraMapper;

    @Override
    public List<PmPonoWtStaticGdTra> selectList(PmPonoWtStaticGdTra pmPonoWtStaticGdTra) {
        return pmPonoWtStaticGdTraMapper.selectList(pmPonoWtStaticGdTra);
    }

    @Override
    public PmPonoWtStaticGdTra selectByPrimary(Long traId) {
        PmPonoWtStaticGdTra pmPonoWtStaticGdTra = new PmPonoWtStaticGdTra();
        pmPonoWtStaticGdTra.setTraId(traId);
        List<PmPonoWtStaticGdTra> pmPonoWtStaticGdTras = pmPonoWtStaticGdTraMapper.selectList(pmPonoWtStaticGdTra);
        if (CollectionUtils.isEmpty(pmPonoWtStaticGdTras)) {
            return null;
        }
        return pmPonoWtStaticGdTras.get(0);
    }
}
