当前位置: 首页 > news >正文

004-按照指定功能模块名称分组

按照指定功能模块名称分组

  • 一、说明
            • 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=北京市, phoneNumber=123456789, birthday=Thu 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=北京市, phoneNumber=123456789, birthday=Thu Oct 10 14:42:20 CST 2024)}}

三、效果展示

在这里插入图片描述

http://www.lryc.cn/news/463711.html

相关文章:

  • ChatGPT写作助手:论文写作必备提示词一览
  • 大数据开发电脑千元配置清单
  • VP9官方手册-帧内预测
  • windows 自定义scheme协议。
  • 什么是SQLite?
  • 域1:安全与风险管理 第2章-人员安全与风险管理
  • php中的错误和异常捕获
  • nextjs项目中,使用postgres的完整案例
  • tsconfig.json 内容解读
  • KClass-关于kotlin中的反射
  • Java集合剖析2】Java集合底层常用数据结构
  • java 第10天 String创建以及各类常用方法
  • VS 解决方案里面.vs文件夹
  • 初试PostgreSQL数据库
  • springboot3导出数据库数据到excel
  • 十四、行为型(观察者模式)
  • 爬取简书1
  • 基于STM32单片机设计的矿山环境作业安全监测系统
  • 大数据linux操作系统
  • MySQL 【日期】函数大全(七)
  • IP报文格式、IPv6概述
  • 学习记录:js算法(六十七):任务调度器
  • 5分钟8图:Cursor如何让编程效率提升5倍?
  • 车载实操:一对一实操学习、CANoe实操学习、推荐就业机会、就业技术支持、协助面试辅导
  • PACT 在微服务架构中的用途
  • LeetCode 3200.三角形的最大高度:枚举
  • ssm基于java的招聘系统设计与开发+vue
  • 【网络原理】TCP/IP五层网络模型之网络层-----IP协议详解,建议收藏!!
  • 三次握手与四次挥手
  • awk命令学习记录