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

import com.xisc.pm.api.dto.PmSubHisRequestDTO;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;
import com.xisc.pm.domain.entity.PmSubHis;
import com.xisc.pm.domain.repository.PmSubHisRepository;
import com.xisc.pm.infra.mapper.PmSubHisMapper;

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

/**
 * 自动替代履历表(PmSubHis)资源库
 *
 * @author BKGY
 * @since 2024-12-26 09:57:36
 */
@Component
public class PmSubHisRepositoryImpl extends BaseRepositoryImpl<PmSubHis> implements PmSubHisRepository {
    @Resource
    private PmSubHisMapper pmSubHisMapper;

    @Override
    public List<PmSubHis> selectList(PmSubHisRequestDTO pmSubHisRequestDTO) {
        return pmSubHisMapper.selectList(pmSubHisRequestDTO);
    }

    @Override
    public PmSubHis selectByPrimary(Long id) {
        PmSubHisRequestDTO pmSubHis = new PmSubHisRequestDTO();
        pmSubHis.setId(id);
        List<PmSubHis> pmSubHiss = pmSubHisMapper.selectList(pmSubHis);
        if (CollectionUtils.isEmpty(pmSubHiss)) {
            return null;
        }
        return pmSubHiss.get(0);
    }

}

