package com.njcn.oracle.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.oracle.bo.param.JobQueryParam;
import com.njcn.oracle.bo.po.JobDetail;
import com.njcn.oracle.service.JobDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:
 * Date: 2024/1/9  9:13【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/jobDetail")
@Api(tags = "同步任务")
@AllArgsConstructor
public class JobDetailController {

    private final JobDetailService jobDetailService;
    @PostMapping("/jobQuery")
    @ApiOperation("任务查询")
    @ApiImplicitParam(name = "jobQueryParam", value = "任务查询参数", required = true)
    public IPage<JobDetail> jobQuery(@RequestBody JobQueryParam jobQueryParam){
        IPage<JobDetail> jobDetails = jobDetailService.selectByParam(jobQueryParam);
        return jobDetails;//HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, jobDetails, "任务查询");
    }
    @PostMapping("/jobRemove")
    @ApiOperation("任务移除")
    @ApiImplicitParam(name = "jobQueryParam", value = "任务移除参数", required = true)
    public boolean jobRemove(@RequestBody JobDetail jobDetail){
        boolean b = jobDetailService.jobRemove(jobDetail);
        return b;
    }
}
