swagger2api-v3 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/dist/cli/index.js +51 -39
- package/dist/index.js +9 -5
- package/package.json +68 -68
- package/dist/api/authcontroller/index.d.ts +0 -11
- package/dist/api/authcontroller/index.js +0 -21
- package/dist/api/index.d.ts +0 -8
- package/dist/api/index.js +0 -24
- package/dist/api/menucontroller/index.d.ts +0 -9
- package/dist/api/menucontroller/index.js +0 -18
- package/dist/api/types.d.ts +0 -65
- package/dist/api/types.js +0 -2
- package/dist/api/usercontroller/index.d.ts +0 -41
- package/dist/api/usercontroller/index.js +0 -73
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Swagger2API
|
|
1
|
+
# Swagger2API-v3
|
|
2
2
|
|
|
3
3
|
一个强大的 npm 工具包,用于从 Swagger JSON 文档生成前端接口代码。支持 TypeScript,按标签分组,详细注释生成等功能。
|
|
4
4
|
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
# 使用 pnpm(推荐)
|
|
18
|
-
pnpm add swagger2api
|
|
18
|
+
pnpm add swagger2api-v3
|
|
19
19
|
|
|
20
20
|
# 使用 npm
|
|
21
|
-
npm install swagger2api
|
|
21
|
+
npm install swagger2api-v3
|
|
22
22
|
|
|
23
23
|
# 使用 yarn
|
|
24
|
-
yarn add swagger2api
|
|
24
|
+
yarn add swagger2api-v3
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## 快速开始
|
|
@@ -30,7 +30,7 @@ yarn add swagger2api
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# 创建基础配置文件
|
|
33
|
-
npx swagger2api init
|
|
33
|
+
npx swagger2api-v3 init
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### 2. 配置 `.swagger.config.ts`
|
|
@@ -62,14 +62,14 @@ const config = {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
export default config;
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
### 3. 生成接口代码
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
# 使用配置文件生成
|
|
72
|
-
npx swagger2api generate
|
|
72
|
+
npx swagger2api-v3 generate
|
|
73
73
|
|
|
74
74
|
# 或者通过 npm script
|
|
75
75
|
npm run swagger:generate
|
|
@@ -82,29 +82,29 @@ npm run swagger:generate
|
|
|
82
82
|
```json
|
|
83
83
|
{
|
|
84
84
|
"scripts": {
|
|
85
|
-
"swagger:generate": "npx swagger2api generate",
|
|
86
|
-
"swagger:run": "npx swagger2api run",
|
|
87
|
-
"swagger:init": "npx swagger2api init",
|
|
88
|
-
"swagger:validate": "npx swagger2api validate"
|
|
85
|
+
"swagger:generate": "npx swagger2api-v3 generate",
|
|
86
|
+
"swagger:run": "npx swagger2api-v3 run",
|
|
87
|
+
"swagger:init": "npx swagger2api-v3 init",
|
|
88
|
+
"swagger:validate": "npx swagger2api-v3 validate"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
## CLI 命令
|
|
94
94
|
|
|
95
|
-
### `swagger2api run`
|
|
95
|
+
### `swagger2api-v3 run`
|
|
96
96
|
|
|
97
97
|
运行 `.swagger.config.ts` 配置文件生成接口代码:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
# 使用默认配置文件
|
|
101
|
-
swagger2api run
|
|
101
|
+
swagger2api-v3 run
|
|
102
102
|
|
|
103
103
|
# 指定配置文件
|
|
104
|
-
swagger2api run -c ./custom.swagger.config.ts
|
|
104
|
+
swagger2api-v3 run -c ./custom.swagger.config.ts
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
### `swagger2api generate`
|
|
107
|
+
### `swagger2api-v3 generate`
|
|
108
108
|
|
|
109
109
|
使用配置文件生成接口代码:
|
|
110
110
|
|
|
@@ -116,31 +116,31 @@ swagger2api generate
|
|
|
116
116
|
npm run swagger:generate
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
### `swagger2api init`
|
|
119
|
+
### `swagger2api-v3 init`
|
|
120
120
|
|
|
121
121
|
初始化配置文件:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
124
|
# 创建基础配置
|
|
125
|
-
swagger2api init
|
|
125
|
+
swagger2api-v3 init
|
|
126
126
|
|
|
127
127
|
# 创建示例配置
|
|
128
|
-
swagger2api init --example
|
|
128
|
+
swagger2api-v3 init --example
|
|
129
129
|
|
|
130
130
|
# 指定输出路径
|
|
131
|
-
swagger2api init -o ./config/swagger.config.ts
|
|
131
|
+
swagger2api-v3 init -o ./config/swagger.config.ts
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
### `swagger2api validate`
|
|
134
|
+
### `swagger2api-v3 validate`
|
|
135
135
|
|
|
136
136
|
验证 Swagger 文档:
|
|
137
137
|
|
|
138
138
|
```bash
|
|
139
139
|
# 验证文件
|
|
140
|
-
swagger2api validate -i ./swagger.json
|
|
140
|
+
swagger2api-v3 validate -i ./swagger.json
|
|
141
141
|
|
|
142
142
|
# 使用配置文件验证
|
|
143
|
-
swagger2api validate -c ./.swagger.config.ts
|
|
143
|
+
swagger2api-v3 validate -c ./.swagger.config.ts
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
## 配置选项
|
|
@@ -341,7 +341,7 @@ const config = {
|
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
export default config;
|
|
345
345
|
```
|
|
346
346
|
|
|
347
347
|
### 完整配置示例
|
|
@@ -362,7 +362,7 @@ const config = {
|
|
|
362
362
|
}
|
|
363
363
|
};
|
|
364
364
|
|
|
365
|
-
|
|
365
|
+
export default config;
|
|
366
366
|
```
|
|
367
367
|
|
|
368
368
|
## 技术栈
|
|
@@ -418,7 +418,7 @@ test/
|
|
|
418
418
|
```bash
|
|
419
419
|
# 克隆项目
|
|
420
420
|
git clone <repository-url>
|
|
421
|
-
cd swagger2api
|
|
421
|
+
cd swagger2api-v3
|
|
422
422
|
|
|
423
423
|
# 安装依赖
|
|
424
424
|
npm install
|
package/dist/cli/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const program = new commander_1.Command();
|
|
|
42
42
|
// 版本信息
|
|
43
43
|
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));
|
|
44
44
|
program
|
|
45
|
-
.name('swagger2api')
|
|
45
|
+
.name('swagger2api-v3')
|
|
46
46
|
.description('从 Swagger/OpenAPI 文档生成 TypeScript API 接口')
|
|
47
47
|
.version(packageJson.version);
|
|
48
48
|
// generate 命令
|
|
@@ -97,46 +97,58 @@ program
|
|
|
97
97
|
console.error('❌ 配置文件已存在,使用 --force 参数强制覆盖');
|
|
98
98
|
process.exit(1);
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
100
|
+
// 检测当前项目的模块类型
|
|
101
|
+
let isESModule = false;
|
|
102
|
+
const packageJsonPath = path.resolve(process.cwd(), 'package.json');
|
|
103
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
104
|
+
try {
|
|
105
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
106
|
+
isESModule = packageJson.type === 'module';
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.warn('⚠️ 无法读取package.json,使用默认CommonJS格式');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const configContent = `/**
|
|
113
|
+
* Swagger2API 配置文件
|
|
114
|
+
* 用于配置从 Swagger JSON 生成前端接口的参数
|
|
115
|
+
*/
|
|
116
|
+
const config = {
|
|
117
|
+
// Swagger JSON 文件路径或 URL
|
|
118
|
+
input: 'https://petstore.swagger.io/v2/swagger.json',
|
|
119
|
+
|
|
120
|
+
// 输出目录
|
|
121
|
+
output: './src/api',
|
|
122
|
+
|
|
123
|
+
// request 导入路径模板
|
|
124
|
+
importTemplate: "import { request } from '@/utils/request';",
|
|
125
|
+
|
|
126
|
+
// 生成器类型
|
|
127
|
+
generator: 'typescript',
|
|
128
|
+
|
|
129
|
+
// 按标签分组生成文件
|
|
130
|
+
groupByTags: true,
|
|
131
|
+
|
|
132
|
+
// 是否覆盖更新,默认为true。为true时会先删除输出目录下的所有文件
|
|
133
|
+
overwrite: true,
|
|
134
|
+
|
|
135
|
+
// 接口路径公共前缀,默认为空字符串
|
|
136
|
+
prefix: '',
|
|
137
|
+
|
|
138
|
+
// 代码格式化命令(可选)
|
|
139
|
+
lint: 'prettier --write',
|
|
140
|
+
|
|
141
|
+
// 生成选项
|
|
142
|
+
options: {
|
|
143
|
+
// 是否添加注释
|
|
144
|
+
addComments: true
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
${isESModule ? 'export default config;' : 'module.exports = config;'}
|
|
137
149
|
`;
|
|
138
150
|
try {
|
|
139
|
-
fs.writeFileSync(configPath,
|
|
151
|
+
fs.writeFileSync(configPath, configContent, 'utf-8');
|
|
140
152
|
console.log('✅ 配置文件已创建:', configPath);
|
|
141
153
|
console.log('💡 请根据需要修改配置文件,然后运行 swagger2api generate');
|
|
142
154
|
}
|
package/dist/index.js
CHANGED
|
@@ -100,7 +100,7 @@ class Swagger2API {
|
|
|
100
100
|
}
|
|
101
101
|
if (errors.length > 0) {
|
|
102
102
|
console.error('❌ 配置验证失败:');
|
|
103
|
-
errors.forEach(error => console.error(` - ${error}`));
|
|
103
|
+
errors.forEach((error) => console.error(` - ${error}`));
|
|
104
104
|
return false;
|
|
105
105
|
}
|
|
106
106
|
return true;
|
|
@@ -115,9 +115,12 @@ async function generateFromConfig(configPath) {
|
|
|
115
115
|
const configFile = configPath || '.swagger.config.ts';
|
|
116
116
|
const fullPath = path.resolve(process.cwd(), configFile);
|
|
117
117
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
118
|
+
let config;
|
|
119
|
+
// 使用动态import加载配置文件以支持ES模块语法
|
|
120
|
+
const fileUrl = `file:///${fullPath.replace(/\\/g, '/')}?t=${Date.now()}`;
|
|
121
|
+
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
122
|
+
const configModule = await dynamicImport(fileUrl);
|
|
123
|
+
config = configModule.default || configModule;
|
|
121
124
|
const swagger2api = new Swagger2API(config);
|
|
122
125
|
if (!swagger2api.validateConfig()) {
|
|
123
126
|
process.exit(1);
|
|
@@ -125,7 +128,8 @@ async function generateFromConfig(configPath) {
|
|
|
125
128
|
await swagger2api.generate();
|
|
126
129
|
}
|
|
127
130
|
catch (error) {
|
|
128
|
-
if (error instanceof Error &&
|
|
131
|
+
if (error instanceof Error &&
|
|
132
|
+
error.message.includes('Cannot resolve module')) {
|
|
129
133
|
console.error(`❌ 找不到配置文件: ${fullPath}`);
|
|
130
134
|
console.error('请确保配置文件存在并且路径正确');
|
|
131
135
|
}
|
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "swagger2api-v3",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "从 Swagger/OpenAPI 文档生成 TypeScript API 接口的命令行工具",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"test
|
|
18
|
-
"test:
|
|
19
|
-
"test:
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"swagger:
|
|
31
|
-
"swagger:
|
|
32
|
-
"swagger:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@types/jest": "^29.5.0",
|
|
57
|
-
"@types/node": "^24.3.1",
|
|
58
|
-
"jest": "^29.5.0",
|
|
59
|
-
"prettier": "^3.6.2",
|
|
60
|
-
"rimraf": "^6.0.1",
|
|
61
|
-
"ts-jest": "^29.1.0",
|
|
62
|
-
"typescript": "^5.9.2"
|
|
63
|
-
},
|
|
64
|
-
"dependencies": {
|
|
65
|
-
"axios": "^1.11.0",
|
|
66
|
-
"commander": "^12.0.0"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "swagger2api-v3",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "从 Swagger/OpenAPI 文档生成 TypeScript API 接口的命令行工具",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"bin": {
|
|
9
|
+
"swagger2api-v3": "dist/cli/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"package.json"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"test:watch": "jest --watch",
|
|
19
|
+
"test:coverage": "jest --coverage",
|
|
20
|
+
"test:ci": "jest --ci --coverage --watchAll=false",
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"clean": "rimraf dist",
|
|
23
|
+
"prebuild": "npm run clean",
|
|
24
|
+
"start": "node dist/cli/index.js",
|
|
25
|
+
"dev": "npm run build && npm start",
|
|
26
|
+
"lint": "prettier --write",
|
|
27
|
+
"generate": "npm run build && node dist/cli/index.js generate",
|
|
28
|
+
"init": "npm run build && node dist/cli/index.js init",
|
|
29
|
+
"validate": "npm run build && node dist/cli/index.js validate",
|
|
30
|
+
"swagger:generate": "npm run generate",
|
|
31
|
+
"swagger:run": "npm run generate",
|
|
32
|
+
"swagger:init": "npm run init",
|
|
33
|
+
"swagger:validate": "npm run validate"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"swagger",
|
|
37
|
+
"openapi",
|
|
38
|
+
"typescript",
|
|
39
|
+
"api",
|
|
40
|
+
"generator",
|
|
41
|
+
"cli",
|
|
42
|
+
"code-generation"
|
|
43
|
+
],
|
|
44
|
+
"author": "xiaoyang",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"homepage": "https://github.com/xiaoyang33/swagger2api-v3#readme",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/xiaoyang33/swagger2api-v3.git"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/xiaoyang33/swagger2api-v3/issues"
|
|
53
|
+
},
|
|
54
|
+
"packageManager": "pnpm@10.11.0",
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/jest": "^29.5.0",
|
|
57
|
+
"@types/node": "^24.3.1",
|
|
58
|
+
"jest": "^29.5.0",
|
|
59
|
+
"prettier": "^3.6.2",
|
|
60
|
+
"rimraf": "^6.0.1",
|
|
61
|
+
"ts-jest": "^29.1.0",
|
|
62
|
+
"typescript": "^5.9.2"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"axios": "^1.11.0",
|
|
66
|
+
"commander": "^12.0.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AuthController API 接口
|
|
3
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
4
|
-
*/
|
|
5
|
-
import type { LoginDto, LoginRespDto } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* 登录
|
|
8
|
-
*
|
|
9
|
-
* @param body
|
|
10
|
-
*/
|
|
11
|
-
export declare const authControllerLogin: (data: LoginDto, config?: any) => Promise<import("../../utils/request").IReqBoay<LoginRespDto>>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* AuthController API 接口
|
|
4
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.authControllerLogin = void 0;
|
|
8
|
-
const request_1 = require("../../utils/request");
|
|
9
|
-
/**
|
|
10
|
-
* 登录
|
|
11
|
-
*
|
|
12
|
-
* @param body
|
|
13
|
-
*/
|
|
14
|
-
const authControllerLogin = (data, config) => {
|
|
15
|
-
return request_1.request.post({
|
|
16
|
-
url: '/admin/auth/login',
|
|
17
|
-
data,
|
|
18
|
-
...config
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.authControllerLogin = authControllerLogin;
|
package/dist/api/index.d.ts
DELETED
package/dist/api/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* API 入口文件
|
|
4
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
__exportStar(require("./types"), exports);
|
|
22
|
-
__exportStar(require("./authcontroller"), exports);
|
|
23
|
-
__exportStar(require("./usercontroller"), exports);
|
|
24
|
-
__exportStar(require("./menucontroller"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MenuController API 接口
|
|
3
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
4
|
-
*/
|
|
5
|
-
import type { MenuListRespDto } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* 菜单列表
|
|
8
|
-
*/
|
|
9
|
-
export declare const menuControllerList: (config?: any) => Promise<import("../../utils/request").IReqBoay<MenuListRespDto>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MenuController API 接口
|
|
4
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.menuControllerList = void 0;
|
|
8
|
-
const request_1 = require("../../utils/request");
|
|
9
|
-
/**
|
|
10
|
-
* 菜单列表
|
|
11
|
-
*/
|
|
12
|
-
const menuControllerList = (config) => {
|
|
13
|
-
return request_1.request.post({
|
|
14
|
-
url: '/admin/system/menus/list',
|
|
15
|
-
...config
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.menuControllerList = menuControllerList;
|
package/dist/api/types.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API 类型定义
|
|
3
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
4
|
-
*/
|
|
5
|
-
export interface LoginDto {
|
|
6
|
-
/** 账号 */
|
|
7
|
-
account: string;
|
|
8
|
-
/** 密码 */
|
|
9
|
-
password: string;
|
|
10
|
-
}
|
|
11
|
-
export interface UserInfoRespDto {
|
|
12
|
-
/** 用户ID */
|
|
13
|
-
id: string;
|
|
14
|
-
/** 用户名 */
|
|
15
|
-
username: string;
|
|
16
|
-
/** 角色 */
|
|
17
|
-
roles: string[];
|
|
18
|
-
}
|
|
19
|
-
export interface LoginRespDto {
|
|
20
|
-
/** 用户信息 */
|
|
21
|
-
user: any;
|
|
22
|
-
/** token */
|
|
23
|
-
token: string;
|
|
24
|
-
}
|
|
25
|
-
export interface UserListDto {
|
|
26
|
-
/** 页码 */
|
|
27
|
-
pageNum?: number;
|
|
28
|
-
/** 每页数量 */
|
|
29
|
-
pageSize?: number;
|
|
30
|
-
/** 用户名 */
|
|
31
|
-
username: string;
|
|
32
|
-
}
|
|
33
|
-
export interface UserListRespDto {
|
|
34
|
-
/** 列表 */
|
|
35
|
-
list: UserInfoRespDto[];
|
|
36
|
-
/** 总条数 */
|
|
37
|
-
total: number;
|
|
38
|
-
}
|
|
39
|
-
export interface CreateUserDto {
|
|
40
|
-
/** 用户名 */
|
|
41
|
-
username: string;
|
|
42
|
-
/** 密码 */
|
|
43
|
-
password: string;
|
|
44
|
-
role: {
|
|
45
|
-
id?: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export interface UpdateUserDto {
|
|
49
|
-
/** 用户名 */
|
|
50
|
-
username: string;
|
|
51
|
-
}
|
|
52
|
-
export interface MenuInfoRespDto {
|
|
53
|
-
/** 菜单ID */
|
|
54
|
-
id: string;
|
|
55
|
-
/** 菜单名称 */
|
|
56
|
-
name: string;
|
|
57
|
-
/** 角色 */
|
|
58
|
-
roles: string[];
|
|
59
|
-
}
|
|
60
|
-
export interface MenuListRespDto {
|
|
61
|
-
/** 列表 */
|
|
62
|
-
list: MenuInfoRespDto[];
|
|
63
|
-
/** 总条数 */
|
|
64
|
-
total: number;
|
|
65
|
-
}
|
package/dist/api/types.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UserController API 接口
|
|
3
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
4
|
-
*/
|
|
5
|
-
import type { CreateUserDto, UpdateUserDto, UserListDto, UserListRespDto } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* 用户列表
|
|
8
|
-
*
|
|
9
|
-
* @param body
|
|
10
|
-
*/
|
|
11
|
-
export declare const userControllerList: (data: UserListDto, config?: any) => Promise<import("../../utils/request").IReqBoay<UserListRespDto>>;
|
|
12
|
-
/**
|
|
13
|
-
* 创建用户
|
|
14
|
-
*
|
|
15
|
-
* @param body
|
|
16
|
-
*/
|
|
17
|
-
export declare const userControllerCreate: (data: CreateUserDto, config?: any) => Promise<import("../../utils/request").IReqBoay<any>>;
|
|
18
|
-
/**
|
|
19
|
-
* 更新用户
|
|
20
|
-
*
|
|
21
|
-
* @param body
|
|
22
|
-
*/
|
|
23
|
-
export declare const userControllerUpdate: (data: UpdateUserDto, config?: any) => Promise<import("../../utils/request").IReqBoay<any>>;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param pageNum 页码
|
|
27
|
-
* @param pageSize 每页数量
|
|
28
|
-
* @param username 用户名
|
|
29
|
-
*/
|
|
30
|
-
export declare const userControllerDetail: (params: {
|
|
31
|
-
pageNum?: number;
|
|
32
|
-
pageSize?: number;
|
|
33
|
-
username: string;
|
|
34
|
-
}, config?: any) => Promise<import("../../utils/request").IReqBoay<any>>;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param id
|
|
38
|
-
*/
|
|
39
|
-
export declare const userControllerDetail1: (params: {
|
|
40
|
-
id: string;
|
|
41
|
-
}, config?: any) => Promise<import("../../utils/request").IReqBoay<any>>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* UserController API 接口
|
|
4
|
-
* 此文件由 swagger2api 自动生成,请勿手动修改
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.userControllerDetail1 = exports.userControllerDetail = exports.userControllerUpdate = exports.userControllerCreate = exports.userControllerList = void 0;
|
|
8
|
-
const request_1 = require("../../utils/request");
|
|
9
|
-
/**
|
|
10
|
-
* 用户列表
|
|
11
|
-
*
|
|
12
|
-
* @param body
|
|
13
|
-
*/
|
|
14
|
-
const userControllerList = (data, config) => {
|
|
15
|
-
return request_1.request.post({
|
|
16
|
-
url: '/admin/system/user/list',
|
|
17
|
-
data,
|
|
18
|
-
...config
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.userControllerList = userControllerList;
|
|
22
|
-
/**
|
|
23
|
-
* 创建用户
|
|
24
|
-
*
|
|
25
|
-
* @param body
|
|
26
|
-
*/
|
|
27
|
-
const userControllerCreate = (data, config) => {
|
|
28
|
-
return request_1.request.post({
|
|
29
|
-
url: '/admin/system/user/create',
|
|
30
|
-
data,
|
|
31
|
-
...config
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
exports.userControllerCreate = userControllerCreate;
|
|
35
|
-
/**
|
|
36
|
-
* 更新用户
|
|
37
|
-
*
|
|
38
|
-
* @param body
|
|
39
|
-
*/
|
|
40
|
-
const userControllerUpdate = (data, config) => {
|
|
41
|
-
return request_1.request.post({
|
|
42
|
-
url: '/admin/system/user/update',
|
|
43
|
-
data,
|
|
44
|
-
...config
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
exports.userControllerUpdate = userControllerUpdate;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param pageNum 页码
|
|
51
|
-
* @param pageSize 每页数量
|
|
52
|
-
* @param username 用户名
|
|
53
|
-
*/
|
|
54
|
-
const userControllerDetail = (params, config) => {
|
|
55
|
-
return request_1.request.get({
|
|
56
|
-
url: '/admin/system/user/detail',
|
|
57
|
-
params,
|
|
58
|
-
...config
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
exports.userControllerDetail = userControllerDetail;
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @param id
|
|
65
|
-
*/
|
|
66
|
-
const userControllerDetail1 = (params, config) => {
|
|
67
|
-
return request_1.request.get({
|
|
68
|
-
url: '/admin/system/user/detail1',
|
|
69
|
-
params,
|
|
70
|
-
...config
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
exports.userControllerDetail1 = userControllerDetail1;
|