package com.docus.server.service.impl;

import com.docus.infrastructure.web.request.SearchRequest;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.convert.SchVirtualLogConvert;
import com.docus.server.dto.scheduling.management.SchVirtualLogDTO;
import com.docus.server.entity.scheduling.management.SchVirtualLog;
import com.docus.server.infrastructure.dao.ISchVirtualLogDao;
import com.docus.server.service.ISchVirtualLogService;
import com.docus.server.vo.scheduling.management.SchVirtualLogVO;
import org.springframework.stereotype.Service;

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

/**
 * 虚拟机使用情况 服务实现类
 *
 * @author AutoGenerator
 * @since 2023-07-14
 */
@Service
public class SchVirtualLogServiceImpl implements ISchVirtualLogService {
    @Resource
    private ISchVirtualLogDao iSchVirtualLogDao;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return 实体
     */
    @Override
    public SchVirtualLogVO findById(String id) {
        return SchVirtualLogConvert.INSTANCE.convertVO(iSchVirtualLogDao.findById(id));
    }

    /**
     * 关键字搜素
     *
     * @param searchRequest 搜索参数
     * @return 分页列表
     */
    @Override
    public PageResult<SchVirtualLogVO> search(SearchRequest searchRequest) {
        return SchVirtualLogConvert.INSTANCE.convertVO(iSchVirtualLogDao.search(searchRequest));
    }

    /**
     * 新增
     *
     * @param schVirtualLogDTO 编辑参数
     * @return 成功或失败
     */
    @Override
    public boolean add(SchVirtualLogDTO schVirtualLogDTO) {
        SchVirtualLog schVirtualLog = SchVirtualLogConvert.INSTANCE.convertDO(schVirtualLogDTO);
        return iSchVirtualLogDao.add(schVirtualLog);
    }

    /**
     * 编辑
     *
     * @param schVirtualLogDTO 编辑参数
     * @return 成功或失败
     */
    @Override
    public boolean edit(SchVirtualLogDTO schVirtualLogDTO) {
        SchVirtualLog schVirtualLog = SchVirtualLogConvert.INSTANCE.convertDO(schVirtualLogDTO);
        return iSchVirtualLogDao.edit(schVirtualLog);
    }

    /**
     * 批量删除
     *
     * @param ids 主键ids
     * @return 成功或失败
     */
    @Override
    public int delete(List<String> ids) {
        return iSchVirtualLogDao.delete(ids);
    }
}

