健康养生网站源码,义乌设计工作室,wordpress页面怎么使用方法,网站设计一般用什么软件按照指定功能模块名称分组 一、说明1.现在有一个需求#xff1a;2.具体做法 二、代码案例三、效果展示 一、说明
1.现在有一个需求#xff1a;
需要把一个功能模块的几个功能点放在同一个文档目录下#xff0c;这几个功能点分布在不同的 Controller
2.具体做法
需要把他… 按照指定功能模块名称分组 一、说明1.现在有一个需求2.具体做法 二、代码案例三、效果展示 一、说明
1.现在有一个需求
需要把一个功能模块的几个功能点放在同一个文档目录下这几个功能点分布在不同的 Controller
2.具体做法
需要把他们单独分组方便前端对接。在ApiOperation 里面增加属性 tags 赋值
注意接口可以在同一个Controller也可以不在同一个Controller
二、代码案例
Api(tags 测试日期格式化)
Slf4j
RequestMapping(/test8Controller)
RestController
public class Test8Controller {ApiOperation(value 查询8实体信息,tags {查询API})GetMapping(/test1)public TestDateTimeFormat test1(){TestDateTimeFormat testDateTimeFormat new TestDateTimeFormat();testDateTimeFormat.setName(xiaogang);testDateTimeFormat.setPhoneNumber(111111111111);testDateTimeFormat.setAddress(beijing);testDateTimeFormat.setBirthday(new Date());return testDateTimeFormat;}ApiOperation(value 新增实体信息)PostMapping(/test2)public void test2(RequestBody TestDateTimeFormat testDateTimeFormat){log.info(实体类{},testDateTimeFormat);// 实体类TestJsonFormat(name小明, address北京市, phoneNumber123456789, birthdayThu Oct 10 14:42:20 CST 2024)}}Api(tags 测试TestJsonFormat日期格式化)
Slf4j
RequestMapping(/test7Controller)
RestController
public class Test7Controller {ApiOperation(value 查询7实体信息,tags {查询API})GetMapping(/test1)public TestJsonFormat test1(){TestJsonFormat testJsonFiled new TestJsonFormat();testJsonFiled.setName(xiaogang);testJsonFiled.setPhoneNumber(111111111111);testJsonFiled.setAddress(beijing);testJsonFiled.setBirthday(new Date());return testJsonFiled;}RequestMapping(/test2)public void test2(RequestBody TestJsonFormat testJsonFormat){log.info(实体类{},testJsonFormat);// 实体类TestJsonFormat(name小明, address北京市, phoneNumber123456789, birthdayThu Oct 10 14:42:20 CST 2024)}}三、效果展示