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.PmHtolStaticTra;
import com.xisc.pm.domain.repository.PmHtolStaticTraRepository;
import com.xisc.pm.infra.mapper.PmHtolStaticTraMapper;

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

/**
 * 以优充次静态表履历表(PmHtolStaticTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:07:54
 */
@Component
public class PmHtolStaticTraRepositoryImpl extends BaseRepositoryImpl<PmHtolStaticTra> implements PmHtolStaticTraRepository {
    @Resource
    private PmHtolStaticTraMapper pmHtolStaticTraMapper;

    @Override
    public List<PmHtolStaticTra> selectList(PmHtolStaticTra pmHtolStaticTra) {
        return pmHtolStaticTraMapper.selectList(pmHtolStaticTra);
    }

    @Override
    public PmHtolStaticTra selectByPrimary(Long traId) {
        PmHtolStaticTra pmHtolStaticTra = new PmHtolStaticTra();
        pmHtolStaticTra.setTraId(traId);
        List<PmHtolStaticTra> pmHtolStaticTras = pmHtolStaticTraMapper.selectList(pmHtolStaticTra);
        if (CollectionUtils.isEmpty(pmHtolStaticTras)) {
            return null;
        }
        return pmHtolStaticTras.get(0);
    }
}
