openapi.json 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. {
  2. "openapi": "3.1.0",
  3. "info": {
  4. "title": "Serve API",
  5. "description": "Serve应用接口文档",
  6. "contact": {
  7. "name": "杨逸"
  8. },
  9. "version": "0.0.1-SNAPSHOT"
  10. },
  11. "servers": [
  12. {
  13. "url": "http://localhost:8080",
  14. "description": "Generated server url"
  15. }
  16. ],
  17. "tags": [
  18. {
  19. "name": "AuthController",
  20. "description": "用户认证相关接口"
  21. }
  22. ],
  23. "paths": {
  24. "/user": {
  25. "get": {
  26. "tags": [
  27. "user-controller"
  28. ],
  29. "operationId": "queryByPage",
  30. "parameters": [
  31. {
  32. "name": "account",
  33. "in": "query",
  34. "required": true,
  35. "schema": {
  36. "type": "string",
  37. "default": ""
  38. }
  39. },
  40. {
  41. "name": "username",
  42. "in": "query",
  43. "required": true,
  44. "schema": {
  45. "type": "string",
  46. "default": ""
  47. }
  48. },
  49. {
  50. "name": "role",
  51. "in": "query",
  52. "required": true,
  53. "schema": {
  54. "type": "string",
  55. "default": ""
  56. }
  57. },
  58. {
  59. "name": "enable",
  60. "in": "query",
  61. "required": true,
  62. "schema": {
  63. "type": "integer",
  64. "format": "int32",
  65. "default": 1
  66. }
  67. },
  68. {
  69. "name": "pageNum",
  70. "in": "query",
  71. "required": true,
  72. "schema": {
  73. "type": "integer",
  74. "format": "int32",
  75. "default": 1
  76. }
  77. },
  78. {
  79. "name": "pageSize",
  80. "in": "query",
  81. "required": true,
  82. "schema": {
  83. "type": "integer",
  84. "format": "int32",
  85. "default": 10
  86. }
  87. }
  88. ],
  89. "responses": {
  90. "400": {
  91. "description": "Bad Request",
  92. "content": {
  93. "*/*": {
  94. "schema": {
  95. "$ref": "#/components/schemas/ResponseListFieldError"
  96. }
  97. }
  98. }
  99. },
  100. "200": {
  101. "description": "OK",
  102. "content": {
  103. "*/*": {
  104. "schema": {
  105. "$ref": "#/components/schemas/ResponsePageVoListUserVo"
  106. }
  107. }
  108. }
  109. }
  110. }
  111. },
  112. "put": {
  113. "tags": [
  114. "user-controller"
  115. ],
  116. "operationId": "edit",
  117. "requestBody": {
  118. "content": {
  119. "application/json": {
  120. "schema": {
  121. "$ref": "#/components/schemas/UserDto"
  122. }
  123. }
  124. },
  125. "required": true
  126. },
  127. "responses": {
  128. "400": {
  129. "description": "Bad Request",
  130. "content": {
  131. "*/*": {
  132. "schema": {
  133. "$ref": "#/components/schemas/ResponseListFieldError"
  134. }
  135. }
  136. }
  137. },
  138. "200": {
  139. "description": "OK",
  140. "content": {
  141. "*/*": {
  142. "schema": {
  143. "$ref": "#/components/schemas/ResponseBoolean"
  144. }
  145. }
  146. }
  147. }
  148. }
  149. },
  150. "post": {
  151. "tags": [
  152. "user-controller"
  153. ],
  154. "operationId": "add",
  155. "requestBody": {
  156. "content": {
  157. "application/json": {
  158. "schema": {
  159. "$ref": "#/components/schemas/UserDto"
  160. }
  161. }
  162. },
  163. "required": true
  164. },
  165. "responses": {
  166. "400": {
  167. "description": "Bad Request",
  168. "content": {
  169. "*/*": {
  170. "schema": {
  171. "$ref": "#/components/schemas/ResponseListFieldError"
  172. }
  173. }
  174. }
  175. },
  176. "200": {
  177. "description": "OK",
  178. "content": {
  179. "*/*": {
  180. "schema": {
  181. "$ref": "#/components/schemas/ResponseBoolean"
  182. }
  183. }
  184. }
  185. }
  186. }
  187. },
  188. "delete": {
  189. "tags": [
  190. "user-controller"
  191. ],
  192. "operationId": "deleteById",
  193. "parameters": [
  194. {
  195. "name": "ids",
  196. "in": "query",
  197. "required": true,
  198. "schema": {
  199. "type": "array",
  200. "items": {
  201. "type": "string"
  202. }
  203. }
  204. }
  205. ],
  206. "responses": {
  207. "400": {
  208. "description": "Bad Request",
  209. "content": {
  210. "*/*": {
  211. "schema": {
  212. "$ref": "#/components/schemas/ResponseListFieldError"
  213. }
  214. }
  215. }
  216. },
  217. "200": {
  218. "description": "OK",
  219. "content": {
  220. "*/*": {
  221. "schema": {
  222. "$ref": "#/components/schemas/ResponseBoolean"
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. },
  230. "/user/updateStatus": {
  231. "put": {
  232. "tags": [
  233. "user-controller"
  234. ],
  235. "operationId": "updateUserStatus",
  236. "requestBody": {
  237. "content": {
  238. "application/json": {
  239. "schema": {
  240. "$ref": "#/components/schemas/UpdateUserStatusDto"
  241. }
  242. }
  243. },
  244. "required": true
  245. },
  246. "responses": {
  247. "400": {
  248. "description": "Bad Request",
  249. "content": {
  250. "*/*": {
  251. "schema": {
  252. "$ref": "#/components/schemas/ResponseListFieldError"
  253. }
  254. }
  255. }
  256. },
  257. "200": {
  258. "description": "OK",
  259. "content": {
  260. "*/*": {
  261. "schema": {
  262. "$ref": "#/components/schemas/Response"
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. },
  270. "/user/updatePassword": {
  271. "put": {
  272. "tags": [
  273. "user-controller"
  274. ],
  275. "operationId": "updatePassword",
  276. "requestBody": {
  277. "content": {
  278. "application/json": {
  279. "schema": {
  280. "$ref": "#/components/schemas/UpdateUserPasswordDto"
  281. }
  282. }
  283. },
  284. "required": true
  285. },
  286. "responses": {
  287. "400": {
  288. "description": "Bad Request",
  289. "content": {
  290. "*/*": {
  291. "schema": {
  292. "$ref": "#/components/schemas/ResponseListFieldError"
  293. }
  294. }
  295. }
  296. },
  297. "200": {
  298. "description": "OK",
  299. "content": {
  300. "*/*": {
  301. "schema": {
  302. "$ref": "#/components/schemas/Response"
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. },
  310. "/user/updateAvatar": {
  311. "put": {
  312. "tags": [
  313. "user-controller"
  314. ],
  315. "operationId": "updateUserAvatar",
  316. "requestBody": {
  317. "content": {
  318. "application/json": {
  319. "schema": {
  320. "$ref": "#/components/schemas/UpdateUserAvatarDto"
  321. }
  322. }
  323. },
  324. "required": true
  325. },
  326. "responses": {
  327. "400": {
  328. "description": "Bad Request",
  329. "content": {
  330. "*/*": {
  331. "schema": {
  332. "$ref": "#/components/schemas/ResponseListFieldError"
  333. }
  334. }
  335. }
  336. },
  337. "200": {
  338. "description": "OK",
  339. "content": {
  340. "*/*": {
  341. "schema": {
  342. "$ref": "#/components/schemas/Response"
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. },
  350. "/meta/updateWebsiteMeta": {
  351. "post": {
  352. "tags": [
  353. "meta-controller"
  354. ],
  355. "operationId": "updateWebsiteMeta",
  356. "requestBody": {
  357. "content": {
  358. "application/json": {
  359. "schema": {
  360. "$ref": "#/components/schemas/WebsiteMetaDto"
  361. }
  362. }
  363. },
  364. "required": true
  365. },
  366. "responses": {
  367. "400": {
  368. "description": "Bad Request",
  369. "content": {
  370. "*/*": {
  371. "schema": {
  372. "$ref": "#/components/schemas/ResponseListFieldError"
  373. }
  374. }
  375. }
  376. },
  377. "200": {
  378. "description": "OK",
  379. "content": {
  380. "*/*": {
  381. "schema": {
  382. "$ref": "#/components/schemas/Response"
  383. }
  384. }
  385. }
  386. }
  387. }
  388. }
  389. },
  390. "/auth/register": {
  391. "post": {
  392. "tags": [
  393. "AuthController"
  394. ],
  395. "summary": "用户注册",
  396. "operationId": "register",
  397. "requestBody": {
  398. "content": {
  399. "application/json": {
  400. "schema": {
  401. "$ref": "#/components/schemas/RegisterDto"
  402. }
  403. }
  404. },
  405. "required": true
  406. },
  407. "responses": {
  408. "400": {
  409. "description": "Bad Request",
  410. "content": {
  411. "*/*": {
  412. "schema": {
  413. "$ref": "#/components/schemas/ResponseListFieldError"
  414. }
  415. }
  416. }
  417. },
  418. "200": {
  419. "description": "OK",
  420. "content": {
  421. "*/*": {
  422. "schema": {
  423. "$ref": "#/components/schemas/ResponseAuthTokenVo"
  424. }
  425. }
  426. }
  427. }
  428. }
  429. }
  430. },
  431. "/auth/login": {
  432. "post": {
  433. "tags": [
  434. "AuthController"
  435. ],
  436. "summary": "用户登录",
  437. "operationId": "login",
  438. "requestBody": {
  439. "content": {
  440. "application/json": {
  441. "schema": {
  442. "$ref": "#/components/schemas/LoginDto"
  443. }
  444. }
  445. },
  446. "required": true
  447. },
  448. "responses": {
  449. "400": {
  450. "description": "Bad Request",
  451. "content": {
  452. "*/*": {
  453. "schema": {
  454. "$ref": "#/components/schemas/ResponseListFieldError"
  455. }
  456. }
  457. }
  458. },
  459. "200": {
  460. "description": "OK",
  461. "content": {
  462. "*/*": {
  463. "schema": {
  464. "$ref": "#/components/schemas/ResponseAuthTokenVo"
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471. },
  472. "/user/{id}": {
  473. "get": {
  474. "tags": [
  475. "user-controller"
  476. ],
  477. "operationId": "queryById",
  478. "parameters": [
  479. {
  480. "name": "id",
  481. "in": "path",
  482. "required": true,
  483. "schema": {
  484. "type": "string",
  485. "minLength": 1
  486. }
  487. }
  488. ],
  489. "responses": {
  490. "400": {
  491. "description": "Bad Request",
  492. "content": {
  493. "*/*": {
  494. "schema": {
  495. "$ref": "#/components/schemas/ResponseListFieldError"
  496. }
  497. }
  498. }
  499. },
  500. "200": {
  501. "description": "OK",
  502. "content": {
  503. "*/*": {
  504. "schema": {
  505. "$ref": "#/components/schemas/ResponseUserVo"
  506. }
  507. }
  508. }
  509. }
  510. }
  511. }
  512. },
  513. "/meta/getWebsiteMeta": {
  514. "get": {
  515. "tags": [
  516. "meta-controller"
  517. ],
  518. "operationId": "getWebsiteMeta",
  519. "responses": {
  520. "400": {
  521. "description": "Bad Request",
  522. "content": {
  523. "*/*": {
  524. "schema": {
  525. "$ref": "#/components/schemas/ResponseListFieldError"
  526. }
  527. }
  528. }
  529. },
  530. "200": {
  531. "description": "OK",
  532. "content": {
  533. "*/*": {
  534. "schema": {
  535. "$ref": "#/components/schemas/Response"
  536. }
  537. }
  538. }
  539. }
  540. }
  541. }
  542. }
  543. },
  544. "components": {
  545. "schemas": {
  546. "FieldError": {
  547. "type": "object",
  548. "properties": {
  549. "codes": {
  550. "type": "array",
  551. "items": {
  552. "type": "string"
  553. }
  554. },
  555. "arguments": {
  556. "type": "array",
  557. "items": {
  558. }
  559. },
  560. "defaultMessage": {
  561. "type": "string"
  562. },
  563. "objectName": {
  564. "type": "string"
  565. },
  566. "field": {
  567. "type": "string"
  568. },
  569. "rejectedValue": {
  570. },
  571. "bindingFailure": {
  572. "type": "boolean"
  573. },
  574. "code": {
  575. "type": "string"
  576. }
  577. }
  578. },
  579. "ResponseListFieldError": {
  580. "type": "object",
  581. "description": "后端统一的响应实体",
  582. "properties": {
  583. "code": {
  584. "type": "integer",
  585. "format": "int32",
  586. "description": "状态码;200:成功"
  587. },
  588. "message": {
  589. "type": "string",
  590. "description": "响应附加信息"
  591. },
  592. "data": {
  593. "type": "array",
  594. "description": "响应的具体数据",
  595. "items": {
  596. "$ref": "#/components/schemas/FieldError"
  597. }
  598. }
  599. }
  600. },
  601. "UserDto": {
  602. "type": "object",
  603. "description": "用户新增和修改使用的DTO",
  604. "properties": {
  605. "id": {
  606. "type": "string",
  607. "description": "用户ID"
  608. },
  609. "account": {
  610. "type": "string",
  611. "description": "用户账号",
  612. "maxLength": 20,
  613. "minLength": 4
  614. },
  615. "password": {
  616. "type": "string",
  617. "description": "用户密码",
  618. "maxLength": 20,
  619. "minLength": 4
  620. },
  621. "username": {
  622. "type": "string",
  623. "description": "用户名称",
  624. "maxLength": 32,
  625. "minLength": 2
  626. },
  627. "role": {
  628. "type": "string",
  629. "description": "用户角色",
  630. "maxLength": 32,
  631. "minLength": 4
  632. }
  633. },
  634. "required": [
  635. "account",
  636. "password",
  637. "role",
  638. "username"
  639. ]
  640. },
  641. "ResponseBoolean": {
  642. "type": "object",
  643. "description": "后端统一的响应实体",
  644. "properties": {
  645. "code": {
  646. "type": "integer",
  647. "format": "int32",
  648. "description": "状态码;200:成功"
  649. },
  650. "message": {
  651. "type": "string",
  652. "description": "响应附加信息"
  653. },
  654. "data": {
  655. "type": "boolean",
  656. "description": "响应的具体数据"
  657. }
  658. }
  659. },
  660. "UpdateUserStatusDto": {
  661. "type": "object",
  662. "description": "用户状态更新使用的DTO",
  663. "properties": {
  664. "id": {
  665. "type": "string",
  666. "description": "用户ID",
  667. "minLength": 1
  668. },
  669. "enable": {
  670. "type": "integer",
  671. "format": "int32",
  672. "description": "更新后的状态;1:启用,0:禁用",
  673. "maximum": 1,
  674. "minLength": 1,
  675. "minimum": 0
  676. }
  677. },
  678. "required": [
  679. "enable",
  680. "id"
  681. ]
  682. },
  683. "Response": {
  684. "type": "object",
  685. "description": "后端统一的响应实体",
  686. "properties": {
  687. "code": {
  688. "type": "integer",
  689. "format": "int32",
  690. "description": "状态码;200:成功"
  691. },
  692. "message": {
  693. "type": "string",
  694. "description": "响应附加信息"
  695. },
  696. "data": {
  697. "description": "响应的具体数据"
  698. }
  699. }
  700. },
  701. "UpdateUserPasswordDto": {
  702. "type": "object",
  703. "description": "用户密码修改使用的DTO",
  704. "properties": {
  705. "id": {
  706. "type": "string",
  707. "description": "用户ID",
  708. "minLength": 1
  709. },
  710. "password": {
  711. "type": "string",
  712. "description": "用户的当前密码",
  713. "maxLength": 20,
  714. "minLength": 4
  715. },
  716. "oldPassword": {
  717. "type": "string",
  718. "description": "用户的新密码",
  719. "maxLength": 20,
  720. "minLength": 4
  721. }
  722. },
  723. "required": [
  724. "id",
  725. "oldPassword",
  726. "password"
  727. ]
  728. },
  729. "UpdateUserAvatarDto": {
  730. "type": "object",
  731. "description": "更新用户头像的实体DTO",
  732. "properties": {
  733. "id": {
  734. "type": "string",
  735. "description": "用户的ID",
  736. "minLength": 1
  737. },
  738. "avatar": {
  739. "type": "string",
  740. "description": "头像地址的链接",
  741. "minLength": 1,
  742. "pattern": "^(https?)://[^\\s/$.?#].[^\\s]*$"
  743. }
  744. },
  745. "required": [
  746. "avatar",
  747. "id"
  748. ]
  749. },
  750. "WebsiteMetaDto": {
  751. "type": "object",
  752. "description": "网站元数据DTO,用于更新网站配置信息",
  753. "properties": {
  754. "title": {
  755. "type": "string",
  756. "description": "网站标题",
  757. "maxLength": 200,
  758. "minLength": 0
  759. },
  760. "logo": {
  761. "type": "string",
  762. "description": "网站logo URL",
  763. "maxLength": 500,
  764. "minLength": 0
  765. },
  766. "statement": {
  767. "type": "string",
  768. "description": "网站声明",
  769. "maxLength": 500,
  770. "minLength": 0
  771. },
  772. "announcement": {
  773. "type": "string",
  774. "description": "网站公告",
  775. "maxLength": 500,
  776. "minLength": 0
  777. }
  778. }
  779. },
  780. "RegisterDto": {
  781. "type": "object",
  782. "description": "注册请求参数",
  783. "properties": {
  784. "account": {
  785. "type": "string",
  786. "description": "账号",
  787. "maxLength": 20,
  788. "minLength": 4
  789. },
  790. "password": {
  791. "type": "string",
  792. "description": "密码",
  793. "maxLength": 20,
  794. "minLength": 4
  795. },
  796. "username": {
  797. "type": "string",
  798. "description": "用户名",
  799. "maxLength": 32,
  800. "minLength": 2
  801. }
  802. },
  803. "required": [
  804. "account",
  805. "password",
  806. "username"
  807. ]
  808. },
  809. "AuthTokenVo": {
  810. "type": "object",
  811. "description": "登录响应",
  812. "properties": {
  813. "token": {
  814. "type": "string",
  815. "description": "JWT token"
  816. },
  817. "userId": {
  818. "type": "integer",
  819. "format": "int64",
  820. "description": "用户ID"
  821. },
  822. "account": {
  823. "type": "string",
  824. "description": "账号"
  825. },
  826. "username": {
  827. "type": "string",
  828. "description": "用户名"
  829. },
  830. "role": {
  831. "type": "string",
  832. "description": "角色"
  833. }
  834. }
  835. },
  836. "ResponseAuthTokenVo": {
  837. "type": "object",
  838. "description": "后端统一的响应实体",
  839. "properties": {
  840. "code": {
  841. "type": "integer",
  842. "format": "int32",
  843. "description": "状态码;200:成功"
  844. },
  845. "message": {
  846. "type": "string",
  847. "description": "响应附加信息"
  848. },
  849. "data": {
  850. "$ref": "#/components/schemas/AuthTokenVo",
  851. "description": "响应的具体数据"
  852. }
  853. }
  854. },
  855. "LoginDto": {
  856. "type": "object",
  857. "description": "登录请求参数",
  858. "properties": {
  859. "account": {
  860. "type": "string",
  861. "description": "账号",
  862. "minLength": 1
  863. },
  864. "password": {
  865. "type": "string",
  866. "description": "密码",
  867. "minLength": 1
  868. }
  869. },
  870. "required": [
  871. "account",
  872. "password"
  873. ]
  874. },
  875. "PageVoListUserVo": {
  876. "type": "object",
  877. "description": "分页数据对象",
  878. "properties": {
  879. "total": {
  880. "type": "integer",
  881. "format": "int64",
  882. "description": "总数据条数"
  883. },
  884. "data": {
  885. "type": "array",
  886. "description": "当前页的数据",
  887. "items": {
  888. "$ref": "#/components/schemas/UserVo"
  889. }
  890. }
  891. }
  892. },
  893. "ResponsePageVoListUserVo": {
  894. "type": "object",
  895. "description": "后端统一的响应实体",
  896. "properties": {
  897. "code": {
  898. "type": "integer",
  899. "format": "int32",
  900. "description": "状态码;200:成功"
  901. },
  902. "message": {
  903. "type": "string",
  904. "description": "响应附加信息"
  905. },
  906. "data": {
  907. "$ref": "#/components/schemas/PageVoListUserVo",
  908. "description": "响应的具体数据"
  909. }
  910. }
  911. },
  912. "UserVo": {
  913. "type": "object",
  914. "description": "用户响应展示对象",
  915. "properties": {
  916. "id": {
  917. "type": "string",
  918. "description": "用户ID"
  919. },
  920. "account": {
  921. "type": "string",
  922. "description": "用户账号"
  923. },
  924. "username": {
  925. "type": "string",
  926. "description": "用户名称"
  927. },
  928. "role": {
  929. "type": "string",
  930. "description": "用户角色"
  931. },
  932. "avatar": {
  933. "type": "string",
  934. "description": "用户头像地址"
  935. },
  936. "enable": {
  937. "type": "integer",
  938. "format": "int32",
  939. "description": "用户状态;0:禁用,1:启用"
  940. }
  941. }
  942. },
  943. "ResponseUserVo": {
  944. "type": "object",
  945. "description": "后端统一的响应实体",
  946. "properties": {
  947. "code": {
  948. "type": "integer",
  949. "format": "int32",
  950. "description": "状态码;200:成功"
  951. },
  952. "message": {
  953. "type": "string",
  954. "description": "响应附加信息"
  955. },
  956. "data": {
  957. "$ref": "#/components/schemas/UserVo",
  958. "description": "响应的具体数据"
  959. }
  960. }
  961. }
  962. }
  963. }
  964. }