package com.njzscloud.common.sichen.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.sichen.pojo.entity.TaskScheduleRecodeEntity;
import com.njzscloud.common.sichen.pojo.param.SearchTaskScheduleRecodeParam;
import com.njzscloud.common.sichen.service.TaskScheduleRecodeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 任务调度记录表
 */
@Slf4j
@RestController
@RequestMapping("/task_schedule_recode")
@RequiredArgsConstructor
public class TaskScheduleRecodeController {
    private final TaskScheduleRecodeService taskScheduleRecodeService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
        taskScheduleRecodeService.add(taskScheduleRecodeEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
        taskScheduleRecodeService.modify(taskScheduleRecodeEntity);
        return R.success();
    }

    /**
     * 删除
     */
    @PostMapping("/del")
    public R<?> del(@RequestBody List<Long> ids) {
        taskScheduleRecodeService.del(ids);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<TaskScheduleRecodeEntity> detail(@RequestParam("id") Long id) {
        return R.success(taskScheduleRecodeService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<TaskScheduleRecodeEntity>> paging(PageParam pageParam, SearchTaskScheduleRecodeParam searchTaskScheduleRecodeParam) {
        return R.success(taskScheduleRecodeService.paging(pageParam, searchTaskScheduleRecodeParam));
    }
}
