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.PmCdContLog;
import com.xisc.pm.domain.repository.PmCdContLogRepository;
import com.xisc.pm.infra.mapper.PmCdContLogMapper;

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

/**
 * 转用充当履历(PmCdContLog)资源库
 *
 * @author 蒋雨航 yuhang.jiang02@hand-china.com
 * @since 2024-08-16 16:43:01
 */
@Component
public class PmCdContLogRepositoryImpl extends BaseRepositoryImpl<PmCdContLog> implements PmCdContLogRepository {
    @Resource
    private PmCdContLogMapper pmCdContLogMapper;

    @Override
    public List<PmCdContLog> selectList(PmCdContLog pmCdContLog) {
        return pmCdContLogMapper.selectList(pmCdContLog);
    }

    @Override
    public PmCdContLog selectByPrimary(Long loadContLogId) {
        PmCdContLog pmCdContLog = new PmCdContLog();
        pmCdContLog.setLoadContLogId(loadContLogId);
        List<PmCdContLog> pmCdContLogs = pmCdContLogMapper.selectList(pmCdContLog);
        if (CollectionUtils.isEmpty(pmCdContLogs)) {
            return null;
        }
        return pmCdContLogs.get(0);
    }

}
