1.spring Controller
@RestController @RequestMapping(value = "/basic/task") public class TaskController { @Autowired private TaskServiceImpl taskService; @PostMapping(value = "/add") public ResponseEntity addTask(@RequestBody TaskEntity taskEntity) { return taskService.addTask(taskEntity) ? new ResponseEntity(HttpStatus.OK) : new ResponseEntity(HttpStatus.BAD_REQUEST); } }
实体类:
@Data public class TaskEntity { private Long id; private String jobName; //任务名称 private String jobGroup; //任务分组 private String jobStatus; //任务状态 private String jobClass;//任务执行方法 private String cronExpression; // cron 表达式 private String jobDescription; //任务描述 private String timeZoneId; // 时区 private Long startTime; private Long endTime; private String state; //状态 }
2.postman访问