diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs index c66f988..a48177c 100644 --- a/Infrastructure/OptionsSetting.cs +++ b/Infrastructure/OptionsSetting.cs @@ -6,14 +6,12 @@ namespace Infrastructure /// public class OptionsSetting { - public static string ConnAdmin = "Conn_admin"; - public static string Conn = "ConnDynamic"; - public static string DbType = "DbType"; - public static string CodeGenDbType = "CodeGenDbType"; + public static string ConnAdmin = "conn_zrAdmin"; + public static string DbType = "conn_admin_Type"; public static string DbKey = "DbKey"; public static string Gen_conn = "gen:conn"; public static string Gen_conn_dbType = "gen:dbType"; - + public static string Gen_author = "gen:author"; public string Conn_Admin { get; set; } public string AppName { get; set; } diff --git a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs index 0a90337..ec0b67a 100644 --- a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs +++ b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs @@ -67,12 +67,12 @@ namespace ZR.Admin.WebApi.Controllers return SUCCESS(vm); } - /// - /// 获取表格列 - /// - /// - /// - /// + ///// + ///// 获取表格列 + ///// + ///// + ///// + ///// //[HttpGet("getColumnInfo")] //[ActionPermissionFilter(Permission = "tool:gen:list")] //public IActionResult QueryColumnInfo(string dbName, string tableName) @@ -183,7 +183,7 @@ namespace ZR.Admin.WebApi.Controllers ModuleName = "bus", ClassName = CodeGeneratorTool.GetClassName(tableName), BusinessName = CodeGeneratorTool.GetClassName(tableName), - FunctionAuthor = ConfigUtils.Instance.GetConfig("gen:author"), + FunctionAuthor = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_author), FunctionName = tabInfo.Description, TableName = tableName, TableComment = tabInfo.Description, diff --git a/ZR.Admin.WebApi/appsettings.Development.json b/ZR.Admin.WebApi/appsettings.Development.json deleted file mode 100644 index 0ff3f4c..0000000 --- a/ZR.Admin.WebApi/appsettings.Development.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "ConnectionStrings": { - "Conn_Admin": "server=127.0.0.1;user=zr;pwd=abc;database=admin", - "ConnDynamic": "server=127.0.0.1;user=zr;pwd=abc;database={database}"//ʹ - }, - "urls": "http://localhost:8888", //url - "sysConfig": { - "DBCommandTimeout": 10, - "cors": "http://localhost:8887" //ÿַ - }, - "DemoMode": false, //Ƿʾģʽ - "DbKey": "", - "DbType": 0, //MySql = 0, SqlServer = 1, Sqlite = 2, Oracle = 3, PostgreSQL = 4, - "CodeGenDbType": 0,//ݿ - "Upload": { - "UploadDirectory": "/", - "UploadUrl": "http://localhost:8888" - }, - "ALYUN_OCS": { - "REGIONID": "cn-hangzhou", - "KEY": "XX", - "SECRET": "XX" - }, - "gen": { - "conn": "server=127.0.0.1;user=zr;pwd=abc;database={database}", - "dbType": 1, - "autoPre": true, //Զȥǰ׺ - "author": "zhaorui", - "tablePrefix": "live_,sys_" //"ǰ׺ǰ׺öŷָ", - } -} diff --git a/ZR.Admin.WebApi/appsettings.Production.json b/ZR.Admin.WebApi/appsettings.Production.json deleted file mode 100644 index 8983e0f..0000000 --- a/ZR.Admin.WebApi/appsettings.Production.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 8983e0f..8966330 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -5,5 +5,32 @@ "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } + }, + "ConnectionStrings": { + "conn_zrAdmin": "server=127.0.0.1;user=zr;pwd=abc;database=admin" + }, + "urls": "http://localhost:8888", //Ŀurl + "sysConfig": { + "DBCommandTimeout": 10, + "cors": "http://localhost:8887" //ַ"," + }, + "DemoMode": false, //Ƿʾģʽ + "DbKey": "", //ݿkey + "DbType": 0, //MySql = 0, SqlServer = 1 + "Upload": { + "UploadDirectory": "/", + "UploadUrl": "http://localhost:8888" + }, + "ALYUN_OCS": { + "REGIONID": "cn-hangzhou", + "KEY": "XX", + "SECRET": "XX" + }, + "gen": { + "conn": "server=127.0.0.1;user=zr;pwd=abc;database={database}", + "dbType": 1, + "autoPre": true, //Զȥǰ׺ + "author": "zhaorui", + "tablePrefix": "live_,sys_" //"ǰ׺ǰ׺öŷָ", } } diff --git a/ZR.CodeGenerator/DbProvider.cs b/ZR.CodeGenerator/DbProvider.cs index 3da9e12..28d5291 100644 --- a/ZR.CodeGenerator/DbProvider.cs +++ b/ZR.CodeGenerator/DbProvider.cs @@ -8,6 +8,9 @@ using System.Threading.Tasks; namespace ZR.CodeGenerator { + /// + /// 代码生成数据库连接 + /// public class DbProvider { protected static SqlSugarScope CodeDb; @@ -19,12 +22,13 @@ namespace ZR.CodeGenerator /// public SqlSugarScope GetSugarDbContext(string dbName = "") { - string connStr = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_conn).Replace("{database}", dbName); + string connStr = ConfigUtils.Instance.GetConfig(OptionsSetting.Gen_conn); int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.Gen_conn_dbType, 0); + connStr = connStr.Replace("{database}", dbName); if (string.IsNullOrEmpty(dbName)) { connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin); - dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0); + dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType); } var db = new SqlSugarScope(new List() { diff --git a/ZR.Repository/DbProvider/SugarDbContext.cs b/ZR.Repository/DbProvider/SugarDbContext.cs index 68f7afe..6919f16 100644 --- a/ZR.Repository/DbProvider/SugarDbContext.cs +++ b/ZR.Repository/DbProvider/SugarDbContext.cs @@ -22,7 +22,7 @@ namespace ZR.Repository.DbProvider { string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin); string dbKey = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbKey); - int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0); + string dbType = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.DbType); if (!string.IsNullOrEmpty(dbKey)) { connStr = NETCore.Encrypt.EncryptProvider.DESDecrypt(connStr, dbKey); @@ -32,7 +32,7 @@ namespace ZR.Repository.DbProvider { new ConnectionConfig(){ ConnectionString = connStr, - DbType = (DbType)dbType, + DbType = (DbType)Convert.ToInt32(dbType), IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样 InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息 ConfigId = 0 @@ -52,21 +52,5 @@ namespace ZR.Repository.DbProvider Console.WriteLine(); }; } - - public SqlSugarClient GetSugarDbContext(string dbName) - { - string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.Conn).Replace("{DbName}", dbName); - int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0); - - return new SqlSugarClient(new List() - { - new ConnectionConfig(){ - ConnectionString = connStr, - DbType = (DbType)dbType, - IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样 - InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息 - }, - }); - } } } diff --git a/ZR.Vue/src/router/index.js b/ZR.Vue/src/router/index.js index 17b3536..be3e867 100644 --- a/ZR.Vue/src/router/index.js +++ b/ZR.Vue/src/router/index.js @@ -42,11 +42,11 @@ export const constantRoutes = [ component: (resolve) => require(['@/views/login'], resolve), hidden: true }, - { - path: '/demo', - component: (resolve) => require(['@/views/gift/index'], resolve), - hidden: true - }, + // { + // path: '/demo', + // component: (resolve) => require(['@/views/gift/index'], resolve), + // hidden: true + // }, { path: '/404', component: (resolve) => require(['@/views/error/404'], resolve), diff --git a/ZRAdmin.xml b/ZRAdmin.xml index 869c50f..8c3e75a 100644 --- a/ZRAdmin.xml +++ b/ZRAdmin.xml @@ -27,47 +27,6 @@ - - - 代码自动生成 - - - - - 用户信息接口 - - - - - 查询用户信息列表 - - - - - - 查询用户信息详情 - - - - - - - 添加用户信息 - - - - - - 更新用户信息 - - - - - - 删除用户信息 - - - 代码生成 diff --git a/document/images/15.png b/document/images/15.png new file mode 100644 index 0000000..668cd89 Binary files /dev/null and b/document/images/15.png differ diff --git a/document/images/16.png b/document/images/16.png new file mode 100644 index 0000000..15af2c5 Binary files /dev/null and b/document/images/16.png differ