第九章、接口开发

僤鯓⒐⒋嵵緔 提交于 2020-03-08 04:22:24

注意:在第八章博客的基础上开发

一、查询接口开发

第八章已经写好了查询的接口,启动SpringBoot后,在PostMan中访问如下

若localhost:8080/get/book/novel?id=0  或 localhost:8080/get/book/novel

则返回

二、增加接口开发

//添加接口
@PostMapping("/add/book/novel")
public ResponseEntity add(
		@RequestParam(name = "title") String title,
		@RequestParam(name = "author") String author,
		@RequestParam(name = "word_count") int wordCount,
		@RequestParam(name = "publish_date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date publish_date){
	try {
		XContentBuilder content = XContentFactory.js
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!