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访问

postman传递对象到spring controller的方式

 

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-10-22
  • 2022-01-21
  • 2022-12-23
  • 2021-04-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-02-18
  • 2021-08-07
  • 2022-02-28
相关资源
相似解决方案