package com.docus.server.archivefile.controller;

import com.docus.infrastructure.web.request.SearchRequest;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.archivefile.TaskConfigApi;
import com.docus.server.archivefile.service.ITaskConfigService;
import com.docus.server.entity.TaskConfig;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * Controller
 * Generated on  2023-06-28
 */
@RestController
public class TaskConfigController implements TaskConfigApi {
    @Resource
    private ITaskConfigService taskConfigService;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return 实体
     */
    @Override
    public TaskConfig find(String id) {
        return taskConfigService.getTaskConfigById(id);
    }

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

    /**
     * 新增或编辑
     *
     * @param taskConfig 编辑参数
     * @return 成功或失败
     */
    @Override
    public boolean saveOrUpdate(TaskConfig taskConfig) {
        return taskConfigService.updateTaskConfig(taskConfig);
    }

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

    @Override
    public void searchRetry(SearchRequest searchRequest) throws Exception {
        taskConfigService.searchRetry(searchRequest);
    }

    @Override
    public void findRetry(List<Long> ids) throws Exception {
        taskConfigService.findRetry(ids);
    }

}
