package com.docus.server.controller;

import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.scheduling.management.SchCollectErrorLogApi;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.AddSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.DeleteSchCollectErrorLogDTO;
import com.docus.server.dto.scheduling.management.schcollecterrorlog.EditSchCollectErrorLogDTO;
import com.docus.server.service.ISchCollectErrorLogService;
import com.docus.server.vo.scheduling.management.schcollecterrorlog.SchCollectErrorLogVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 采集器异常日志 控制器类
 *
 * @author AutoGenerator
 * @since 2023-07-15
 */
@Api(value = "采集器异常日志接口", tags = "采集器异常日志接口")
@RestController
public class SchCollectErrorLogController implements SchCollectErrorLogApi {
    @Resource
    private ISchCollectErrorLogService iSchCollectErrorLogService;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return 实体
     */
    @ApiOperation("按主键查询")
    @Override
    public SchCollectErrorLogVO findById(String id) {
        return iSchCollectErrorLogService.findById(id);
    }

    /**
     * 关键字搜索
     *
     * @param searchDTO 搜索参数
     * @return 分页列表
     */
    @ApiOperation("关键字搜索")
    @Override
    public PageResult<SchCollectErrorLogVO> search(SearchDTO searchDTO) {
        return iSchCollectErrorLogService.search(searchDTO);
    }

    /**
     * 新增
     *
     * @param addSchCollectErrorLogDTO 编辑参数
     * @return 成功或失败
     */
    @ApiOperation("新增")
    @Override
    public boolean add(AddSchCollectErrorLogDTO addSchCollectErrorLogDTO, MultipartFile[] multipartFiles) throws Exception {
        return iSchCollectErrorLogService.add(addSchCollectErrorLogDTO, multipartFiles);
    }

    /**
     * 编辑
     *
     * @param editSchCollectErrorLogDTO 编辑参数
     * @return 成功或失败
     */
    @ApiOperation("编辑")
    @Override
    public boolean edit(EditSchCollectErrorLogDTO editSchCollectErrorLogDTO) {
        return iSchCollectErrorLogService.edit(editSchCollectErrorLogDTO);
    }

    /**
     * 批量删除
     *
     * @param deleteSchCollectErrorLogDTO 删除参数
     * @return 成功或失败
     */
    @ApiOperation("批量删除")
    @Override
    public int delete(DeleteSchCollectErrorLogDTO deleteSchCollectErrorLogDTO) {
        return iSchCollectErrorLogService.delete(deleteSchCollectErrorLogDTO);
    }
}
