普兆健康管家后端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
4.6 KiB

  1. # 小程序基础查询接口文档
  2. ## 概述
  3. 本文档描述了小程序基础的不需要登录的查询接口,包括产品、Banner、配置信息等模块的查询功能。
  4. ## 接口列表
  5. ### 1. 产品模块 (Product)
  6. #### 1.1 产品列表查询
  7. - **接口地址**: `GET /applet/product/list`
  8. - **接口描述**: 分页查询产品,支持按分类、关键词筛选
  9. - **请求参数**:
  10. - `type` (必填): 产品类型
  11. - `pageNo` (可选): 页码,默认1
  12. - `pageSize` (可选): 每页大小,默认10
  13. - `classId` (可选): 分类ID
  14. - `keyword` (可选): 关键词,支持产品名称、描述、详情模糊搜索
  15. - **响应示例**:
  16. ```json
  17. {
  18. "success": true,
  19. "message": "操作成功!",
  20. "code": 200,
  21. "result": {
  22. "records": [
  23. {
  24. "id": "xxx",
  25. "name": "产品名称",
  26. "info": "产品描述",
  27. "type": "产品类型",
  28. "classId": "分类ID",
  29. "originalPrice": 100.00,
  30. "currentPrice": 80.00,
  31. "unit": "单位",
  32. "detail": "产品详情",
  33. "sold": 100,
  34. "content": "产品内容"
  35. }
  36. ],
  37. "total": 100,
  38. "size": 10,
  39. "current": 1
  40. }
  41. }
  42. ```
  43. #### 1.2 产品详情查询
  44. - **接口地址**: `GET /applet/product/detail`
  45. - **接口描述**: 获取单个产品详细信息
  46. - **请求参数**:
  47. - `id` (必填): 产品ID
  48. - **响应示例**:
  49. ```json
  50. {
  51. "success": true,
  52. "message": "操作成功!",
  53. "code": 200,
  54. "result": {
  55. "id": "xxx",
  56. "name": "产品名称",
  57. "info": "产品描述",
  58. "type": "产品类型",
  59. "classId": "分类ID",
  60. "originalPrice": 100.00,
  61. "currentPrice": 80.00,
  62. "unit": "单位",
  63. "detail": "产品详情",
  64. "sold": 100,
  65. "content": "产品内容"
  66. }
  67. }
  68. ```
  69. #### 1.3 产品分类查询
  70. - **接口地址**: `GET /applet/product/category`
  71. - **接口描述**: 根据类型查询产品分类
  72. - **请求参数**:
  73. - `type` (必填): 产品类型
  74. - **响应示例**:
  75. ```json
  76. {
  77. "success": true,
  78. "message": "操作成功!",
  79. "code": 200,
  80. "result": [
  81. {
  82. "id": "xxx",
  83. "name": "分类名称",
  84. "description": "分类描述",
  85. "sortOrder": 1,
  86. "type": "产品类型"
  87. }
  88. ]
  89. }
  90. ```
  91. ### 2. Banner模块 (Banner)
  92. #### 2.1 Banner列表查询
  93. - **接口地址**: `GET /applet/banner/list`
  94. - **接口描述**: 获取Banner列表,按类型分组,按排序字段排序
  95. - **请求参数**: 无
  96. - **响应示例**:
  97. ```json
  98. {
  99. "success": true,
  100. "message": "操作成功!",
  101. "code": 200,
  102. "result": {
  103. "home": [
  104. {
  105. "id": "xxx",
  106. "imageUrl": "图片地址",
  107. "linkUrl": "跳转链接",
  108. "sortOrder": 1,
  109. "type": "home"
  110. }
  111. ],
  112. "product": [
  113. {
  114. "id": "xxx",
  115. "imageUrl": "图片地址",
  116. "linkUrl": "跳转链接",
  117. "sortOrder": 1,
  118. "type": "product"
  119. }
  120. ]
  121. }
  122. }
  123. ```
  124. ### 3. 配置信息模块 (Config)
  125. #### 3.1 配置列表查询
  126. - **接口地址**: `GET /applet/config/list`
  127. - **接口描述**: 查询所有配置信息
  128. - **请求参数**: 无
  129. - **响应示例**:
  130. ```json
  131. {
  132. "success": true,
  133. "message": "操作成功!",
  134. "code": 200,
  135. "result": [
  136. {
  137. "id": "xxx",
  138. "code": "配置编码",
  139. "info": "配置描述",
  140. "content": "配置内容",
  141. "type": "配置类型"
  142. }
  143. ]
  144. }
  145. ```
  146. ## 技术特点
  147. 1. **Lambda查询**: 所有数据库查询都使用MyBatis-Plus的LambdaQueryWrapper,提供类型安全的查询
  148. 2. **模块化设计**: 按业务模块分类,每个模块独立的Controller和Service
  149. 3. **复用性高**: 数据库操作复用demo模块的Mapper,避免重复代码
  150. 4. **统一响应**: 使用统一的Result响应格式
  151. 5. **参数校验**: 必填参数校验,可选参数支持默认值
  152. 6. **日志记录**: 所有接口都有详细的日志记录
  153. ## 使用示例
  154. ### 查询产品列表
  155. ```bash
  156. curl -X GET "http://localhost:8080/applet/product/list?type=1&pageNo=1&pageSize=10&keyword=测试"
  157. ```
  158. ### 查询产品详情
  159. ```bash
  160. curl -X GET "http://localhost:8080/applet/product/detail?id=xxx"
  161. ```
  162. ### 查询产品分类
  163. ```bash
  164. curl -X GET "http://localhost:8080/applet/product/category?type=1"
  165. ```
  166. ### 查询Banner列表
  167. ```bash
  168. curl -X GET "http://localhost:8080/applet/banner/list"
  169. ```
  170. ### 查询配置列表
  171. ```bash
  172. curl -X GET "http://localhost:8080/applet/config/list"
  173. ```
  174. ## 注意事项
  175. 1. 所有接口都不需要登录认证
  176. 2. 产品列表查询的type参数为必填项
  177. 3. 分页参数pageNo从1开始
  178. 4. 关键词搜索支持产品名称、描述、详情的模糊匹配
  179. 5. Banner按类型分组返回,便于前端按需使用
  180. 6. 配置信息按编码排序返回