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

import com.xisc.pm.domain.entity.PmCmdRecord;
import com.xisc.pm.domain.repository.PmCmdRecordRepository;
import com.xisc.pm.infra.mapper.PmCmdRecordMapper;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

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

/**
 * 四大命令履历表(PmCmdRecord)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-12-11 10:33:07
 */
@Component
public class PmCmdRecordRepositoryImpl extends BaseRepositoryImpl<PmCmdRecord> implements PmCmdRecordRepository {
    @Resource
    private PmCmdRecordMapper pmCmdRecordMapper;

    @Override
    public List<PmCmdRecord> selectList(PmCmdRecord pmCmdRecord) {
        return pmCmdRecordMapper.selectList(pmCmdRecord);
    }

    @Override
    public PmCmdRecord selectByPrimary(Long pmCmdRecordId) {
        PmCmdRecord pmCmdRecord = new PmCmdRecord();
        pmCmdRecord.setPmCmdRecordId(pmCmdRecordId);
        List<PmCmdRecord> pmCmdRecords = pmCmdRecordMapper.selectList(pmCmdRecord);
        if (CollectionUtils.isEmpty(pmCmdRecords)) {
            return null;
        }
        return pmCmdRecords.get(0);
    }

}

