前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。
1.场景:postman 发送了一个 post 请求,如下:
2. 解析方式为用一个 vo 对象来接收 json。把 json 中的每个 key 和 vo 对象的属性对应,让其自动填充。
@Slf4j
@RestController
@RequestMapping("/lallla")
public class YunxiaoController {@Autowiredprivate YunxiaoApplication yunxiaoApplication;private Logger logger = LoggerFactory.getLogger(this.getClass());@RequestMapping(value = "/forone", method = RequestMethod.POST)public Map<String, Object> createEpic(@RequestBody EpicCreateVo json) {return yunxiaoApplication.createEpic(json);}@RequestMapping(value = "/forEpic", method = RequestMethod.GET)public Map<String, Object> closeEpic(@RequestBody EpicCloseVo vo) {return yunxiaoApplication.closeEpic(vo.getEpicId());}}
import lombok.Data;import java.io.Serializable;/*** * @author silence* @date 2018/8/19 14:23*/
@Data
public class EpicCreateVo implements Serializable {private String creator;private String needTest;private String projectName;private String sourceUrl;private String sourceId;private String sourceName;public EpicCreateVo() {}}