提交 e5d52ef5 作者: 方治民

refactor: 更新 API 自动生成可选参数

上级 9b9d1dda
...@@ -397,6 +397,32 @@ ...@@ -397,6 +397,32 @@
} }
} }
] ]
},
{
"description": "测试 MyBatis Plus 查询",
"name": "test",
"method": "get",
"path": "/api/hello/test",
"response": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Result",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": []
} }
], ],
"name": "hello" "name": "hello"
...@@ -605,6 +631,21 @@ ...@@ -605,6 +631,21 @@
}, },
{ {
"in": "query", "in": "query",
"description": "重定向",
"name": "redirect",
"required": false,
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"in": "query",
"description": "序号", "description": "序号",
"name": "serial", "name": "serial",
"required": false, "required": false,
...@@ -906,6 +947,21 @@ ...@@ -906,6 +947,21 @@
}, },
{ {
"in": "query", "in": "query",
"description": "重定向",
"name": "redirect",
"required": false,
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"in": "query",
"description": "序号", "description": "序号",
"name": "serial", "name": "serial",
"required": false, "required": false,
...@@ -1541,7 +1597,7 @@ ...@@ -1541,7 +1597,7 @@
"description": "", "description": "",
"interfaces": [ "interfaces": [
{ {
"description": "获取用户权限", "description": "获取用户菜单",
"name": "getMenuList", "name": "getMenuList",
"method": "get", "method": "get",
"path": "/api/user/getMenuList", "path": "/api/user/getMenuList",
...@@ -1577,6 +1633,42 @@ ...@@ -1577,6 +1633,42 @@
"parameters": [] "parameters": []
}, },
{ {
"description": "获取用户权限",
"name": "getPermCode",
"method": "get",
"path": "/api/user/getPermCode",
"response": {
"typeArgs": [
{
"typeArgs": [
{
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Result",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": []
},
{
"description": "获取登录用户信息", "description": "获取登录用户信息",
"name": "getUserInfo", "name": "getUserInfo",
"method": "get", "method": "get",
...@@ -1886,7 +1978,7 @@ ...@@ -1886,7 +1978,7 @@
"typeProperties": [] "typeProperties": []
}, },
"name": "name", "name": "name",
"description": "标识", "description": "名称",
"required": false "required": false
}, },
{ {
...@@ -1906,19 +1998,15 @@ ...@@ -1906,19 +1998,15 @@
{ {
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "", "typeName": "string",
"isDefsType": false, "isDefsType": false,
"templateIndex": -1, "templateIndex": -1,
"compileTemplateKeyword": "#/definitions/", "compileTemplateKeyword": "#/definitions/",
"enum": [ "enum": [],
"'DIR'",
"'MENU'",
"'BUTTON'"
],
"typeProperties": [] "typeProperties": []
}, },
"name": "type", "name": "redirect",
"description": "权限类型", "description": "重定向",
"required": false "required": false
} }
], ],
......
...@@ -21,14 +21,14 @@ declare namespace defs { ...@@ -21,14 +21,14 @@ declare namespace defs {
/** 元数据 */ /** 元数据 */
meta?: ObjectMap<any, object> meta?: ObjectMap<any, object>
/** 标识 */ /** 名称 */
name?: string name?: string
/** 路径 */ /** 路径 */
path?: string path?: string
/** 权限类型 */ /** 重定向 */
type?: 'DIR' | 'MENU' | 'BUTTON' redirect?: string
} }
export class PageVo<T0 = any> { export class PageVo<T0 = any> {
...@@ -225,7 +225,7 @@ declare namespace API { ...@@ -225,7 +225,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
...@@ -283,7 +283,7 @@ declare namespace API { ...@@ -283,7 +283,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
...@@ -301,7 +301,7 @@ declare namespace API { ...@@ -301,7 +301,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
...@@ -333,6 +333,24 @@ declare namespace API { ...@@ -333,6 +333,24 @@ declare namespace API {
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
} }
/**
* 测试 MyBatis Plus 查询
* /api/hello/test
*/
export namespace test {
export class Params {}
export type Response = string
export const init: Response
export function request(
params?: Params,
config?: http.RequestConfig<Params>,
options?: http.RequestOptions,
): Promise<Response>
}
} }
/** /**
...@@ -351,7 +369,7 @@ declare namespace API { ...@@ -351,7 +369,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
form: FormData, form: FormData,
config?: http.RequestConfig<Params | FormData>, config?: http.RequestConfig<Params | FormData>,
options?: http.RequestOptions, options?: http.RequestOptions,
...@@ -385,6 +403,8 @@ declare namespace API { ...@@ -385,6 +403,8 @@ declare namespace API {
path?: string path?: string
/** 父级ID */ /** 父级ID */
pid?: number pid?: number
/** 重定向 */
redirect?: string
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
...@@ -470,6 +490,8 @@ declare namespace API { ...@@ -470,6 +490,8 @@ declare namespace API {
path?: string path?: string
/** 父级ID */ /** 父级ID */
pid?: number pid?: number
/** 重定向 */
redirect?: string
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
...@@ -694,7 +716,7 @@ declare namespace API { ...@@ -694,7 +716,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
...@@ -706,7 +728,7 @@ declare namespace API { ...@@ -706,7 +728,7 @@ declare namespace API {
*/ */
export namespace user { export namespace user {
/** /**
* 获取用户权限 * 获取用户菜单
* /api/user/getMenuList * /api/user/getMenuList
*/ */
export namespace getMenuList { export namespace getMenuList {
...@@ -717,7 +739,25 @@ declare namespace API { ...@@ -717,7 +739,25 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>,
options?: http.RequestOptions,
): Promise<Response>
}
/**
* 获取用户权限
* /api/user/getPermCode
*/
export namespace getPermCode {
export class Params {}
export type Response = Array<string>
export const init: Response
export function request(
params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
...@@ -735,7 +775,7 @@ declare namespace API { ...@@ -735,7 +775,7 @@ declare namespace API {
export const init: Response export const init: Response
export function request( export function request(
params: Params, params?: Params,
config?: http.RequestConfig<Params>, config?: http.RequestConfig<Params>,
options?: http.RequestOptions, options?: http.RequestOptions,
): Promise<Response> ): Promise<Response>
......
...@@ -16,14 +16,14 @@ export class MenuVo { ...@@ -16,14 +16,14 @@ export class MenuVo {
/** 元数据 */ /** 元数据 */
meta = undefined meta = undefined
/** 标识 */ /** 名称 */
name = '' name = ''
/** 路径 */ /** 路径 */
path = '' path = ''
/** 权限类型 */ /** 重定向 */
type = 'DIR' redirect = ''
} }
export class PageVo { export class PageVo {
......
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/auth/logout', url: '/auth/logout',
......
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/hello/fail', url: '/hello/fail',
......
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/hello/', url: '/hello/',
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
import * as hello from './hello' import * as hello from './hello'
import * as fail from './fail' import * as fail from './fail'
import * as page from './page' import * as page from './page'
import * as test from './test'
export { hello, fail, page } export { hello, fail, page, test }
/**
* @desc 测试 MyBatis Plus 查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/hello/test',
method: 'GET',
params,
...config,
},
options,
)
}
...@@ -10,7 +10,7 @@ export class Params {} ...@@ -10,7 +10,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request( export function request(
params: Params, params?: Params,
form: FormData, form: FormData,
config?: http.RequestConfig<Params | FormData>, config?: http.RequestConfig<Params | FormData>,
options?: http.RequestOptions, options?: http.RequestOptions,
......
...@@ -22,6 +22,8 @@ export class Params { ...@@ -22,6 +22,8 @@ export class Params {
path?: string path?: string
/** 父级ID */ /** 父级ID */
pid?: number pid?: number
/** 重定向 */
redirect?: string
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
......
...@@ -24,6 +24,8 @@ export class Params { ...@@ -24,6 +24,8 @@ export class Params {
path?: string path?: string
/** 父级ID */ /** 父级ID */
pid?: number pid?: number
/** 重定向 */
redirect?: string
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
......
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/manage/role/selector', url: '/manage/role/selector',
......
/** /**
* @desc 获取用户权限 * @desc 获取用户菜单
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/user/getMenuList', url: '/user/getMenuList',
......
/**
* @desc 获取用户权限
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/user/getPermCode',
method: 'GET',
params,
...config,
},
options,
)
}
...@@ -9,7 +9,7 @@ export class Params {} ...@@ -9,7 +9,7 @@ export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/user/getUserInfo', url: '/user/getUserInfo',
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
* @description * @description
*/ */
import * as getMenuList from './getMenuList' import * as getMenuList from './getMenuList'
import * as getPermCode from './getPermCode'
import * as getUserInfo from './getUserInfo' import * as getUserInfo from './getUserInfo'
import * as assign from './assign' import * as assign from './assign'
import * as page from './page' import * as page from './page'
export { getMenuList, getUserInfo, assign, page } export { getMenuList, getPermCode, getUserInfo, assign, page }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论