mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-02-21 02:12:50 +08:00
代码生成、优化
This commit is contained in:
parent
43976afbee
commit
178e024cf8
@ -1,99 +0,0 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "6db309d3d6d0461c97419641849a99b4",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "查出所有表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647561263994,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/tables",
|
||||
"method" : "GET",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : null,
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1647561224202,\n \"executeTime\": null\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "402",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "凭证已过期",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1647561224202",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
return db.select("""
|
||||
select table_name, table_comment from information_schema.tables where table_schema = database()
|
||||
""")
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"name" : "后台",
|
||||
"id" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"name" : "系统功能",
|
||||
"type" : "api",
|
||||
"parentId" : "0",
|
||||
"path" : "",
|
||||
"path" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
"id" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "代码生成",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/code/gen",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
40
data/magic-api/api/系统功能/代码生成/保存.ms
Normal file
40
data/magic-api/api/系统功能/代码生成/保存.ms
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "5ce5b7d99dd044a9b837c57df7aa9ca5",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "保存",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1648391254377,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/save",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ {
|
||||
"name" : "wrap_request_parameter",
|
||||
"value" : "data",
|
||||
"description" : "包装请求参数到一个变量中",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
if(data.id){
|
||||
data.updateDate = new Date()
|
||||
}
|
||||
return db.table("sys_gen_info").primary("id").save(data)
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647563302987,
|
||||
"updateTime" : 1648391602307,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -16,7 +16,7 @@
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"list\": [{\n \"tableName\": \"sys_user\",\n \"tableComment\": \"用户表\"\n }],\n \"total\": 1\n },\n \"timestamp\": 1647563302700,\n \"executeTime\": 8\n}",
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"total\": 0,\n \"list\": null\n },\n \"timestamp\": 1648372190810,\n \"executeTime\": 10\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
@ -66,56 +66,8 @@
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "list",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "tableName",
|
||||
"value" : "sys_user",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "tableComment",
|
||||
"value" : "用户表",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "total",
|
||||
"value" : "1",
|
||||
"value" : "0",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
@ -125,10 +77,22 @@
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "list",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1647563302700",
|
||||
"value" : "1648372190810",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
@ -140,7 +104,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "8",
|
||||
"value" : "10",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
@ -154,10 +118,10 @@
|
||||
}
|
||||
}
|
||||
================================
|
||||
return {
|
||||
list: [{
|
||||
tableName: 'sys_user',
|
||||
tableComment: '用户表'
|
||||
}],
|
||||
total: 1
|
||||
}
|
||||
return db.page("""
|
||||
select id,table_name,table_comment,create_date,update_date from sys_gen_info where 1=1
|
||||
?{tableName, and table_name like concat('%',#{tableName},'%')}
|
||||
?{tableComment, and table_comment like concat('%',#{tableComment},'%')}
|
||||
?{createDate && createDate.split(',')[0], and create_date >= #{createDate.split(',')[0]}}
|
||||
?{createDate && createDate.split(',')[1], and create_date <= #{createDate.split(',')[1]}}
|
||||
""")
|
25
data/magic-api/api/系统功能/代码生成/删除.ms
Normal file
25
data/magic-api/api/系统功能/代码生成/删除.ms
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "8062a0e5c99e4bcca316f0a0594a804b",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "删除",
|
||||
"createTime" : 1648390993959,
|
||||
"updateTime" : null,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "delete",
|
||||
"method" : "DELETE",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
return db.table("sys_gen_info").where().eq("id",id).delete()
|
362
data/magic-api/api/系统功能/代码生成/执行生成.ms
Normal file
362
data/magic-api/api/系统功能/代码生成/执行生成.ms
Normal file
File diff suppressed because one or more lines are too long
135
data/magic-api/api/系统功能/代码生成/查出所有表.ms
Normal file
135
data/magic-api/api/系统功能/代码生成/查出所有表.ms
Normal file
@ -0,0 +1,135 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "6db309d3d6d0461c97419641849a99b4",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "查出所有表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1648389273779,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/tables",
|
||||
"method" : "GET",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [{\n \"label\": \"magic_backup_record_v2()\",\n \"value\": \"magic_backup_record_v2\"\n }, {\n \"label\": \"sys_dict(字典表)\",\n \"value\": \"sys_dict\"\n }, {\n \"label\": \"sys_dict_items(字典项表)\",\n \"value\": \"sys_dict_items\"\n }, {\n \"label\": \"sys_file(文件表)\",\n \"value\": \"sys_file\"\n }, {\n \"label\": \"sys_gen_info(生成表信息)\",\n \"value\": \"sys_gen_info\"\n }, {\n \"label\": \"sys_gen_test()\",\n \"value\": \"sys_gen_test\"\n }, {\n \"label\": \"sys_login_log()\",\n \"value\": \"sys_login_log\"\n }, {\n \"label\": \"sys_menu(菜单表)\",\n \"value\": \"sys_menu\"\n }, {\n \"label\": \"sys_office(组织机构表)\",\n \"value\": \"sys_office\"\n }, {\n \"label\": \"sys_oper_log(操作日志)\",\n \"value\": \"sys_oper_log\"\n }, {\n \"label\": \"sys_permission_code(权限code表)\",\n \"value\": \"sys_permission_code\"\n }, {\n \"label\": \"sys_role(角色表)\",\n \"value\": \"sys_role\"\n }, {\n \"label\": \"sys_role_menu(角色和菜单关联表)\",\n \"value\": \"sys_role_menu\"\n }, {\n \"label\": \"sys_role_office(用户组织机构关联表)\",\n \"value\": \"sys_role_office\"\n }, {\n \"label\": \"sys_test_data()\",\n \"value\": \"sys_test_data\"\n }, {\n \"label\": \"sys_user(用户表)\",\n \"value\": \"sys_user\"\n }, {\n \"label\": \"sys_user_code(用户权限code关联表)\",\n \"value\": \"sys_user_code\"\n }, {\n \"label\": \"sys_user_role(用户与角色关联表)\",\n \"value\": \"sys_user_role\"\n }],\n \"timestamp\": 1648372075872,\n \"executeTime\": 24\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "label",
|
||||
"value" : "magic_backup_record_v2()",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "value",
|
||||
"value" : "magic_backup_record_v2",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1648372075872",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "24",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
return db.select("""
|
||||
select table_name, table_comment from information_schema.tables where table_schema = database()
|
||||
""").map(it => { label: it.tableName + `(${it.tableComment})`, value: it.tableName })
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "根据表名查出所有列",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647564370396,
|
||||
"updateTime" : 1648312786910,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -28,7 +28,7 @@
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"columns\": [{\n \"columnName\": \"username\",\n \"columnComment\": \"登录名\",\n \"dataType\": \"varchar\"\n }, {\n \"columnName\": \"name\",\n \"columnComment\": \"姓名/昵称\",\n \"dataType\": \"varchar\"\n }, {\n \"columnName\": \"password\",\n \"columnComment\": \"密码\",\n \"dataType\": \"varchar\"\n }, {\n \"columnName\": \"status\",\n \"columnComment\": \"状态\",\n \"dataType\": \"char\"\n }, {\n \"columnName\": \"phone\",\n \"columnComment\": \"手机号\",\n \"dataType\": \"varchar\"\n }, {\n \"columnName\": \"head_portrait\",\n \"columnComment\": \"头像\",\n \"dataType\": \"varchar\"\n }, {\n \"columnName\": \"is_login\",\n \"columnComment\": \"禁止登录:0未禁用,1已禁用\",\n \"dataType\": \"int\"\n }, {\n \"columnName\": \"sort\",\n \"columnComment\": \"排序\",\n \"dataType\": \"int\"\n }, {\n \"columnName\": \"office_id\",\n \"columnComment\": \"组织机构id\",\n \"dataType\": \"varchar\"\n }],\n \"primary\": {\n \"columnName\": \"id\"\n }\n },\n \"timestamp\": 1647564344902,\n \"executeTime\": 34\n}",
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"columns\": [{\n \"columnName\": \"username\",\n \"columnComment\": \"登录名\",\n \"dataType\": \"varchar\",\n \"required\": 1\n }, {\n \"columnName\": \"name\",\n \"columnComment\": \"姓名/昵称\",\n \"dataType\": \"varchar\",\n \"required\": 0\n }, {\n \"columnName\": \"password\",\n \"columnComment\": \"密码\",\n \"dataType\": \"varchar\",\n \"required\": 0\n }, {\n \"columnName\": \"status\",\n \"columnComment\": \"状态\",\n \"dataType\": \"char\",\n \"required\": 0\n }, {\n \"columnName\": \"phone\",\n \"columnComment\": \"手机号\",\n \"dataType\": \"varchar\",\n \"required\": 0\n }, {\n \"columnName\": \"head_portrait\",\n \"columnComment\": \"头像\",\n \"dataType\": \"varchar\",\n \"required\": 0\n }, {\n \"columnName\": \"is_login\",\n \"columnComment\": \"禁止登录:0未禁用,1已禁用\",\n \"dataType\": \"int\",\n \"required\": 0\n }, {\n \"columnName\": \"sort\",\n \"columnComment\": \"排序\",\n \"dataType\": \"int\",\n \"required\": 0\n }, {\n \"columnName\": \"office_id\",\n \"columnComment\": \"组织机构id\",\n \"dataType\": \"varchar\",\n \"required\": 0\n }],\n \"primary\": \"id\"\n },\n \"timestamp\": 1648312726132,\n \"executeTime\": 12\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
@ -135,36 +135,36 @@
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "required",
|
||||
"value" : "1",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "primary",
|
||||
"value" : "",
|
||||
"value" : "id",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "columnName",
|
||||
"value" : "id",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1647564344902",
|
||||
"value" : "1648312726132",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
@ -176,7 +176,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "34",
|
||||
"value" : "12",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
@ -195,7 +195,8 @@ return {
|
||||
SELECT
|
||||
column_name,
|
||||
column_comment,
|
||||
data_type
|
||||
column_type,
|
||||
case when is_nullable = 'YES' then 0 else 1 end required
|
||||
FROM
|
||||
information_schema.COLUMNS
|
||||
WHERE
|
27
data/magic-api/api/系统功能/代码生成/详情.ms
Normal file
27
data/magic-api/api/系统功能/代码生成/详情.ms
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "2574df3366c24feeb913bea8bd477ec7",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "详情",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1648386086354,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/get",
|
||||
"method" : "GET",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
return db.selectOne("""
|
||||
select * from sys_gen_info where id = #{id}
|
||||
""")
|
@ -3,7 +3,7 @@
|
||||
"id" : "d95a58e77d314370862ffc4cdfdb8283",
|
||||
"name" : "在线用户",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/online",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "1952f25c81084e24b55b11385767dc38",
|
||||
"name" : "安全",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/security",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "1952f25c81084e24b55b11385767dc38",
|
||||
"name" : "登录",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647790320949,
|
||||
"updateTime" : 1648307403240,
|
||||
"lock" : "0",
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
@ -3,7 +3,7 @@
|
||||
"id" : "7eeba36706c24c1484ee4e84ad829f9b",
|
||||
"name" : "富文本",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/ueditor",
|
||||
"paths" : [ ],
|
||||
"options" : [ {
|
@ -3,7 +3,7 @@
|
||||
"id" : "c7ce65f5b3cf4aaa913f6fec7d35d176",
|
||||
"name" : "数据字典",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/dict",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
|
||||
"name" : "文件管理",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/file",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "9ec6f9ec92d24a369952bb13eddc134f",
|
||||
"name" : "日志管理",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/log",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "42d241c0bb18476f8dabf92c2e4e2324",
|
||||
"name" : "测试数据",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/test",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "用户管理",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/user",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "6f106ebdee21489db34b956f7770ff03",
|
||||
"name" : "组件",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/component",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
"id" : "8295fc13678d4144bf7363c465247a50",
|
||||
"name" : "组织机构",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/office",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "67b2ce258e24491194b74992958c74aa",
|
||||
"name" : "菜单管理",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/menu",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "89130d496f6f467c88b22ae4a7f688eb",
|
||||
"name" : "角色管理",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/role",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -3,7 +3,7 @@
|
||||
"id" : "5c36bdc1de454d6e9d1a464d87c96091",
|
||||
"name" : "配置",
|
||||
"type" : "api",
|
||||
"parentId" : "02df51e4d7184780a98b632f43dc5848",
|
||||
"parentId" : "acff5ad7aae64de2acb03e1d16a58ce2",
|
||||
"path" : "/config",
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
@ -178,7 +178,7 @@ function getTemp() {
|
||||
}
|
||||
|
||||
function reloadTable() {
|
||||
table.value.reloadList()
|
||||
table.value.reload()
|
||||
}
|
||||
|
||||
function getSort() {
|
||||
|
@ -44,7 +44,7 @@
|
||||
})
|
||||
|
||||
function reload(){
|
||||
tableRef.value.reloadList()
|
||||
tableRef.value.reload()
|
||||
}
|
||||
|
||||
function selectionChange(columns) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row style="margin-bottom: 6px">
|
||||
<el-row style="margin-bottom: 6px" v-if="toolbar">
|
||||
<el-button type="primary" @click="addRow">添加一行</el-button>
|
||||
</el-row>
|
||||
<mb-table ref="magicTable" v-bind="tableOptions">
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<script setup>
|
||||
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { reactive, ref, watch, nextTick } from 'vue'
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
|
||||
@ -47,6 +47,10 @@ const props = defineProps({
|
||||
page: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
toolbar: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
|
||||
@ -90,7 +94,6 @@ watch(() => props.modelValue, (value) => {
|
||||
|
||||
function addRow(){
|
||||
tableOptions.data.push({})
|
||||
magicTable.value.reloadList()
|
||||
}
|
||||
|
||||
function dataChange() {
|
||||
|
@ -145,14 +145,14 @@ function sortChange(column) {
|
||||
order = null
|
||||
}
|
||||
newWhere.orderBy = order
|
||||
reloadList()
|
||||
reload()
|
||||
}
|
||||
|
||||
function selectionChange(columns) {
|
||||
emit('selection-change', columns)
|
||||
}
|
||||
|
||||
function reloadList() {
|
||||
function reload() {
|
||||
if (props.url) {
|
||||
newWhere.current = 1
|
||||
listCurrent.value = 1
|
||||
@ -207,7 +207,7 @@ function keyup(){
|
||||
watch(() => props.data, () => {
|
||||
listCurrent.value = 1
|
||||
handlerData()
|
||||
})
|
||||
},{ deep: true })
|
||||
|
||||
watch(() => props.where,() => {
|
||||
renderWhere()
|
||||
@ -225,7 +225,7 @@ onMounted(() => {
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({ reloadList })
|
||||
defineExpose({ reload })
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -140,7 +140,7 @@ export default {
|
||||
this.$delete('file/delete', { url: encodeURI(url) })
|
||||
},
|
||||
handlePreview(file) {
|
||||
window.open(this.$global.filePrefix + file.response.data.url)
|
||||
window.open(this.$global.baseApi + file.response.data.url)
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
||||
|
@ -13,8 +13,8 @@
|
||||
:style="{ width: width.replace('px', '') + 'px', height: height.replace('px', '') + 'px' }"
|
||||
>
|
||||
<el-image
|
||||
:src="$global.filePrefix + element"
|
||||
:preview-src-list="[$global.filePrefix + element]"
|
||||
:src="$global.baseApi + element"
|
||||
:preview-src-list="[$global.baseApi + element]"
|
||||
/>
|
||||
<div class="tools">
|
||||
<div class="shadow" @click="handleRemove(element)">
|
||||
@ -227,7 +227,7 @@ export default {
|
||||
})
|
||||
},
|
||||
beforeCropper(url) {
|
||||
this.cropperOption.img = this.$global.filePrefix + url
|
||||
this.cropperOption.img = this.$global.baseApi + url
|
||||
this.cropperOption.relativeImg = url
|
||||
this.$refs.cropperDialog.show()
|
||||
},
|
||||
|
@ -6,7 +6,7 @@
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<div class="avatar">
|
||||
<el-avatar :size="40" fit="contain" :src="$global.filePrefix + $global.user.info.headPortrait">
|
||||
<el-avatar :size="40" fit="contain" :src="$global.baseApi + $global.user.info.headPortrait">
|
||||
{{ !$global.user.info.headPortrait ? $global.user.info.name.substring(0,1) : '' }}
|
||||
</el-avatar>
|
||||
<el-dropdown>
|
||||
|
@ -34,7 +34,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
||||
await getUserInfo()
|
||||
await common.getDictData()
|
||||
await common.loadConfig()
|
||||
// await common.loadConfig()
|
||||
// generate accessible routes map based on roles
|
||||
await generateRoutes().then(accessRoutes => {
|
||||
global.user.permissionRoutes.push(...accessRoutes)
|
||||
|
@ -158,14 +158,14 @@ common.getUrl = (url, data) => {
|
||||
return url
|
||||
}
|
||||
|
||||
common.loadConfig = async() => {
|
||||
await request({
|
||||
url: 'config/list'
|
||||
}).then(res => {
|
||||
const { data } = res
|
||||
global.filePrefix = data.filePrefix
|
||||
})
|
||||
}
|
||||
// common.loadConfig = async() => {
|
||||
// await request({
|
||||
// url: 'config/list'
|
||||
// }).then(res => {
|
||||
// const { data } = res
|
||||
// global.filePrefix = data.filePrefix
|
||||
// })
|
||||
// }
|
||||
|
||||
common.setDefaultValue = (obj, attr, value) => {
|
||||
obj[attr] = obj[attr] === undefined ? value : obj[attr]
|
||||
|
6
magic-boot-ui/src/scripts/gen/gen-magic-api.js
Normal file
6
magic-boot-ui/src/scripts/gen/gen-magic-api.js
Normal file
@ -0,0 +1,6 @@
|
||||
function gen(groupPath, data){
|
||||
var magic = {}
|
||||
|
||||
}
|
||||
|
||||
export default gen
|
@ -26,35 +26,39 @@ function gen(groupPath, data){
|
||||
}],
|
||||
table: {
|
||||
url: '${groupPath}/list',
|
||||
where: {
|
||||
`
|
||||
where: {`
|
||||
for(var i in data){
|
||||
var d = data[i]
|
||||
if(d.query){
|
||||
html += `
|
||||
${d.columnName}: {
|
||||
label: '${d.columnComment}'
|
||||
},
|
||||
`
|
||||
},`
|
||||
}
|
||||
}
|
||||
html = html.substring(0, html.length - 1)
|
||||
html += `
|
||||
},
|
||||
cols: [
|
||||
`
|
||||
cols: [`
|
||||
for(var i in data){
|
||||
var d = data[i]
|
||||
if(d.list){
|
||||
html += `
|
||||
if(d.dictType){
|
||||
html += `
|
||||
{
|
||||
dictType: '${d.dictType}',`
|
||||
}else{
|
||||
html += `
|
||||
{
|
||||
`
|
||||
}
|
||||
html += `
|
||||
field: '${d.columnName}',
|
||||
label: '${d.columnComment}'
|
||||
},
|
||||
`
|
||||
},`
|
||||
}
|
||||
}
|
||||
html += `
|
||||
{
|
||||
html += `{
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 140,
|
||||
@ -85,7 +89,42 @@ function gen(groupPath, data){
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
`
|
||||
html += `
|
||||
const formOptions = reactive({
|
||||
detail: {
|
||||
request: {
|
||||
url: '${groupPath}/get'
|
||||
}
|
||||
},
|
||||
form: {
|
||||
request: {
|
||||
url: "${groupPath}/save",
|
||||
method: "post"
|
||||
},
|
||||
rows: [{
|
||||
gutter: 24,
|
||||
cols: [`
|
||||
for(var i in data){
|
||||
var d = data[i]
|
||||
if(d.save){
|
||||
html += `{
|
||||
span: 12,
|
||||
name: '${d.columnName}',
|
||||
label: '${d.columnComment}',
|
||||
${d.component}
|
||||
},`
|
||||
}
|
||||
}
|
||||
html = html.substring(0, html.length - 1)
|
||||
html += `]
|
||||
}]
|
||||
}
|
||||
})
|
||||
`
|
||||
|
||||
console.log(html)
|
||||
}
|
||||
export default gen
|
||||
|
@ -8,7 +8,7 @@ export default {
|
||||
info: {},
|
||||
permissionRoutes: []
|
||||
},
|
||||
filePrefix: '',
|
||||
baseApi: import.meta.env.VITE_APP_BASE_API,
|
||||
visitedViews: reactive([]),
|
||||
tabValue: ref('')
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user