From 85b0305cbcd474e2d223b472d770a6c8e0bd032f Mon Sep 17 00:00:00 2001 From: izory <791736813@qq.com> Date: Tue, 7 Sep 2021 21:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/OptionsSetting.cs | 1 + .../Controllers/CodeGeneratorController.cs | 19 ++- ZR.Admin.WebApi/appsettings.Development.json | 1 - ZR.Admin.WebApi/appsettings.Production.json | 1 - ZR.CodeGenerator/CodeGeneratorTool.cs | 131 +++++++++--------- ZR.CodeGenerator/DbProvider.cs | 2 +- .../Service/CodeGeneraterService.cs | 19 --- ZR.Model/CodeGenerator/DbFieldInfo.cs | 79 ----------- ZR.Model/CodeGenerator/DbTableInfo.cs | 75 ---------- .../System/CodeGeneratorRepository.cs | 97 ++++++------- ZR.Vue/src/views/tool/index.vue | 18 +-- 11 files changed, 131 insertions(+), 312 deletions(-) delete mode 100644 ZR.Model/CodeGenerator/DbFieldInfo.cs delete mode 100644 ZR.Model/CodeGenerator/DbTableInfo.cs diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs index 91d7963..fb677bb 100644 --- a/Infrastructure/OptionsSetting.cs +++ b/Infrastructure/OptionsSetting.cs @@ -9,6 +9,7 @@ namespace Infrastructure public static string ConnAdmin = "Conn_admin"; public static string Conn = "ConnDynamic"; public static string DbType = "DbType"; + public static string CodeGenDbType = "CodeGenDbType"; public static string DbKey = "DbKey"; public string Conn_Admin { get; set; } diff --git a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs index 7248560..81d751d 100644 --- a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs +++ b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs @@ -3,6 +3,7 @@ using Infrastructure.Attribute; using Infrastructure.Enums; using Infrastructure.Model; using Microsoft.AspNetCore.Mvc; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -74,20 +75,18 @@ namespace ZR.Admin.WebApi.Controllers [Log(Title = "代码生成", BusinessType = BusinessType.OTHER)] public IActionResult Generate(string dbName, string baseSpace, string tables, string replaceTableNameStr) { + if (string.IsNullOrEmpty(tables)) + { + throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空"); + } if (string.IsNullOrEmpty(baseSpace)) { - throw new CustomException(ResultCode.CUSTOM_ERROR, "命名空间不能为空"); - } - string[] tableList = tables.Split(","); - List tableInfos = new List();// CodeGeneratorService.GetAllTables(tables); - foreach (var item in tableList) - { - tableInfos.Add(new DbTableInfo() { TableName = item }); + //baseSpace = "Zr"; } + DbTableInfo dbTableInfo = new() { Name = tables }; + CodeGeneratorTool.Generate(dbName, baseSpace, dbTableInfo, replaceTableNameStr, true); - CodeGeneratorTool.Generate(dbName, baseSpace, tableInfos, replaceTableNameStr, true); - - return SUCCESS(null); + return SUCCESS(1); } } } diff --git a/ZR.Admin.WebApi/appsettings.Development.json b/ZR.Admin.WebApi/appsettings.Development.json index 7bda31a..49a30f6 100644 --- a/ZR.Admin.WebApi/appsettings.Development.json +++ b/ZR.Admin.WebApi/appsettings.Development.json @@ -6,7 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "appName": "ZR Admin System", "ConnectionStrings": { "Conn_Admin": "server=127.0.0.1;database=admin;user=zr;pwd=abc" }, diff --git a/ZR.Admin.WebApi/appsettings.Production.json b/ZR.Admin.WebApi/appsettings.Production.json index e709dfb..4dd2ae0 100644 --- a/ZR.Admin.WebApi/appsettings.Production.json +++ b/ZR.Admin.WebApi/appsettings.Production.json @@ -6,7 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "appName": "ZR Admin system", "ConnectionStrings": { "Conn_Admin": "server=127.0.0.1;database=admin;user=zr;pwd=abc" }, diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index dc84deb..f390fa7 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -32,47 +33,44 @@ namespace ZR.CodeGenerator /// 代码生成器入口方法 /// /// - /// 要生成代码的表 - /// - /// + /// /// 要删除表名称的字符 /// 是否替换现有文件,为true时替换 - public static void Generate(string dbName, string baseNamespace, List listTable, string replaceTableNameStr, bool ifExsitedCovered = false) + public static void Generate(string dbName, string baseNamespace, DbTableInfo dbTableInfo, string replaceTableNameStr, bool ifExsitedCovered = false) { - _option.DtosNamespace = baseNamespace + ".Dtos"; - _option.ModelsNamespace = baseNamespace + ".Model"; - _option.IRepositoriesNamespace = baseNamespace + ".IRepositories"; - _option.RepositoriesNamespace = baseNamespace + ".Repositories"; - _option.IServicsNamespace = baseNamespace + ".IServices"; - _option.ServicesNamespace = baseNamespace + ".Services"; + _option.BaseNamespace = baseNamespace; + _option.DtosNamespace = baseNamespace + "ZR.Model.Dto"; + _option.ModelsNamespace = baseNamespace + "ZR.Model"; + //_option.IRepositoriesNamespace = baseNamespace + ".IRepositorie"; + _option.RepositoriesNamespace = baseNamespace + "ZR.Repository"; + //_option.IServicsNamespace = baseNamespace + ".IService"; + _option.ServicesNamespace = baseNamespace + "ZR.Service"; _option.ApiControllerNamespace = baseNamespace + "Api"; _option.ReplaceTableNameStr = replaceTableNameStr; //_option.TableList = listTable; - _option.BaseNamespace = baseNamespace; CodeGeneraterService codeGeneraterService = new CodeGeneraterService(); - //List listTable = dbExtractor.GetWhereTables(_option.TableList); string profileContent = string.Empty; - foreach (DbTableInfo dbTableInfo in listTable) - { - List listField = codeGeneraterService.GetColumnInfo(dbName, dbTableInfo.TableName); - GenerateSingle(listField, dbTableInfo, ifExsitedCovered); - string tableName = dbTableInfo.TableName; - if (!string.IsNullOrEmpty(_option.ReplaceTableNameStr)) - { - string[] rel = _option.ReplaceTableNameStr.Split(';'); - for (int i = 0; i < rel.Length; i++) - { - if (!string.IsNullOrEmpty(rel[i].ToString())) - { - tableName = tableName.Replace(rel[i].ToString(), ""); - } - } - } - tableName = tableName.Substring(0, 1).ToUpper() + tableName.Substring(1); - profileContent += string.Format(" CreateMap<{0}, {0}OutputDto>();\n", tableName); - profileContent += string.Format(" CreateMap<{0}InputDto, {0}>();\n", tableName); - } + //foreach (DbTableInfo dbTableInfo in listTable) + //{ + List listField = codeGeneraterService.GetColumnInfo(dbName, dbTableInfo.Name); + GenerateSingle(listField, dbTableInfo, ifExsitedCovered); + //string tableName = dbTableInfo.TableName; + //if (!string.IsNullOrEmpty(_option.ReplaceTableNameStr)) + //{ + // string[] rel = _option.ReplaceTableNameStr.Split(';'); + // for (int i = 0; i < rel.Length; i++) + // { + // if (!string.IsNullOrEmpty(rel[i].ToString())) + // { + // tableName = tableName.Replace(rel[i].ToString(), ""); + // } + // } + //} + //tableName = tableName.Substring(0, 1).ToUpper() + tableName.Substring(1); + //profileContent += string.Format(" CreateMap<{0}, {0}OutputDto>();\n", tableName); + //profileContent += string.Format(" CreateMap<{0}InputDto, {0}>();\n", tableName); + //} //GenerateDtoProfile(_option.ModelsNamespace, profileContent, ifExsitedCovered); } @@ -85,23 +83,18 @@ namespace ZR.CodeGenerator /// 表字段集合 /// 表信息 /// 如果目标文件存在,是否覆盖。默认为false - public static void GenerateSingle(List listField, DbTableInfo tableInfo, bool ifExsitedCovered = false) + public static void GenerateSingle(List listField, DbTableInfo tableInfo, bool ifExsitedCovered = false) { var modelsNamespace = _option.ModelsNamespace; - var modelTypeName = tableInfo.TableName;//表名 + var modelTypeName = tableInfo.Name;//表名 var modelTypeDesc = tableInfo.Description;//表描述 if (!string.IsNullOrEmpty(_option.ReplaceTableNameStr)) { - string[] rel = _option.ReplaceTableNameStr.Split(';'); - for (int i = 0; i < rel.Length; i++) - { - if (!string.IsNullOrEmpty(rel[i].ToString())) - { - modelTypeName = modelTypeName.Replace(rel[i].ToString(), ""); - } - } + modelTypeName = modelTypeName.Replace(_option.ReplaceTableNameStr.ToString(), ""); } + modelTypeName = modelTypeName.Replace("_", ""); modelTypeName = modelTypeName.Substring(0, 1).ToUpper() + modelTypeName.Substring(1); + string keyTypeName = "string";//主键数据类型 string modelcontent = "";//数据库模型字段 string InputDtocontent = "";//输入模型 @@ -113,23 +106,25 @@ namespace ZR.CodeGenerator string vueViewSaveBindContent = string.Empty;//Vue保存时输出内容 string vueViewEditFromRuleContent = string.Empty;//Vue数据校验 - foreach (SqlSugar.DbColumnInfo dbFieldInfo in listField) + foreach (DbColumnInfo dbFieldInfo in listField) { string columnName = dbFieldInfo.DbColumnName.Substring(0, 1).ToUpper() + dbFieldInfo.DbColumnName.Substring(1); modelcontent += " /// \n"; - modelcontent += ($" /// {dbFieldInfo.ColumnDescription}\n"); + modelcontent += ($" /// 描述 :{dbFieldInfo.ColumnDescription}\n"); + modelcontent += ($" /// 空值 :{dbFieldInfo.IsNullable}\n"); + modelcontent += ($" /// 默认 :{dbFieldInfo.DefaultValue}\n"); modelcontent += " /// \n"; if (dbFieldInfo.IsIdentity || dbFieldInfo.IsPrimarykey) { - modelcontent += $" [SugarColumn(IsPrimaryKey = {dbFieldInfo.IsPrimarykey}, IsIdentity = {dbFieldInfo.IsIdentity})]\n"; + modelcontent += $" [SqlSugar.SugarColumn(IsPrimaryKey = {dbFieldInfo.IsPrimarykey.ToString().ToLower()}, IsIdentity = {dbFieldInfo.IsIdentity.ToString().ToLower()})]\n"; } modelcontent += $" public {TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType)} {columnName} {{ get; set; }}\n\r"; //主键 - if (dbFieldInfo.IsIdentity) - { - keyTypeName = dbFieldInfo.DataType; + //if (dbFieldInfo.IsIdentity) + //{ + //keyTypeName = dbFieldInfo.DataType; //outputDtocontent += " /// \n"; //outputDtocontent += string.Format(" /// 设置或获取{0}\n", dbFieldInfo.ColumnDescription); //outputDtocontent += " /// \n"; @@ -137,18 +132,18 @@ namespace ZR.CodeGenerator //outputDtocontent += string.Format(" [SqlSugar.SugarColumn(IsIdentity = true, IsPrimaryKey = true)]\n"); //outputDtocontent += string.Format(" public {0} {1}", TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType), columnName); //outputDtocontent += " { get; set; }\n\r"; - } - else //非主键 - { - modelcontent += " /// \n"; - modelcontent += string.Format(" /// 设置或获取{0}\n", dbFieldInfo.ColumnDescription); - modelcontent += " /// \n"; - //if (dbFieldInfo.DataType == "string") - //{ - // modelcontent += string.Format(" [MaxLength({0})]\n", dbFieldInfo.FieldMaxLength); - //} - modelcontent += string.Format(" public {0} {1}", TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType), columnName); - modelcontent += " { get; set; }\n\r"; + //} + // else //非主键 + //{ + //modelcontent += " /// \n"; + //modelcontent += string.Format(" /// 设置或获取{0}\n", dbFieldInfo.ColumnDescription); + //modelcontent += " /// \n"; + ////if (dbFieldInfo.DataType == "string") + ////{ + //// modelcontent += string.Format(" [MaxLength({0})]\n", dbFieldInfo.FieldMaxLength); + ////} + //modelcontent += string.Format(" public {0} {1}", TableMappingHelper.GetPropertyDatatype(dbFieldInfo.DataType), columnName); + //modelcontent += " { get; set; }\n\r"; //outputDtocontent += " /// \n"; @@ -216,8 +211,8 @@ namespace ZR.CodeGenerator // InputDtocontent += " { get; set; }\n\r"; //} // - } - GenerateModels(modelsNamespace, modelTypeName, tableInfo.TableName, modelcontent, modelTypeDesc, keyTypeName, ifExsitedCovered); + //} + GenerateModels(modelsNamespace, modelTypeName, tableInfo.Name, modelcontent, modelTypeDesc, keyTypeName, ifExsitedCovered); //GenerateIRepository(modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered); //GenerateRepository(modelTypeName, modelTypeDesc, tableInfo.TableName, keyTypeName, ifExsitedCovered); //GenerateIService(modelsNamespace, modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered); @@ -243,16 +238,14 @@ namespace ZR.CodeGenerator /// 如果目标文件存在,是否覆盖。默认为false private static void GenerateModels(string modelsNamespace, string modelTypeName, string tableName, string modelContent, string modelTypeDesc, string keyTypeName, bool ifExsitedCovered = false) { - var path = AppDomain.CurrentDomain.BaseDirectory; - //path = path.Substring(0, path.IndexOf("\\bin")); - var parentPath = path.Substring(0, path.LastIndexOf("\\")); - var servicesPath = parentPath + "\\" + _option.BaseNamespace + "\\" + modelsNamespace; + var parentPath = "..\\"; + var servicesPath = parentPath + _option.BaseNamespace + "\\" + modelsNamespace; if (!Directory.Exists(servicesPath)) { - servicesPath = parentPath + "\\" + _option.BaseNamespace + "\\Models"; + servicesPath = parentPath + _option.ModelsNamespace; Directory.CreateDirectory(servicesPath); } - var fullPath = servicesPath + "\\" + modelTypeName + ".cs"; + var fullPath = servicesPath + "\\Models\\" + modelTypeName + ".cs"; if (File.Exists(fullPath) && !ifExsitedCovered) return; var content = ReadTemplate("ModelTemplate.txt"); diff --git a/ZR.CodeGenerator/DbProvider.cs b/ZR.CodeGenerator/DbProvider.cs index c4a5265..ed3757e 100644 --- a/ZR.CodeGenerator/DbProvider.cs +++ b/ZR.CodeGenerator/DbProvider.cs @@ -14,7 +14,7 @@ namespace ZR.CodeGenerator public SqlSugarClient GetSugarDbContext(string dbName) { string connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.Conn).Replace("{DbName}", dbName); - int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType, 0); + int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.CodeGenDbType, 0); return new SqlSugarClient(new List() { diff --git a/ZR.CodeGenerator/Service/CodeGeneraterService.cs b/ZR.CodeGenerator/Service/CodeGeneraterService.cs index 6dc3b1d..a66aa0c 100644 --- a/ZR.CodeGenerator/Service/CodeGeneraterService.cs +++ b/ZR.CodeGenerator/Service/CodeGeneraterService.cs @@ -12,24 +12,6 @@ namespace ZR.CodeGenerator.Service { public class CodeGeneraterService: DbProvider { - ///// - ///// 获取表所有列 - ///// - ///// - ///// - //public List GetAllColumns(string tableName) - //{ - // var dbType = ConfigUtils.Instance.GetConfig("CodeGenDbType"); - // if (tableName == null) - // throw new ArgumentException(nameof(tableName)); - // List list = new List(); - // if (dbType == "1") - // { - // list = CodeGeneratorRepository.GetAllColumns(tableName); - // } - // return list; - //} - /// /// 获取所有数据库名 /// @@ -59,7 +41,6 @@ namespace ZR.CodeGenerator.Service /// /// /// - /// /// /// public List GetAllTables(string dbName, string tableName, PagerInfo pager) diff --git a/ZR.Model/CodeGenerator/DbFieldInfo.cs b/ZR.Model/CodeGenerator/DbFieldInfo.cs deleted file mode 100644 index f5e145e..0000000 --- a/ZR.Model/CodeGenerator/DbFieldInfo.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; - -namespace ZR.Model -{ - /// - /// 表的字段 - /// - public class DbFieldInfo - { - public string TableName { get; set; } - /// - /// 初始化 - /// - public DbFieldInfo() - { - FieldName = string.Empty; - Description = string.Empty; - } - /// - /// 字段名称 - /// - public string FieldName { get; set; } - /// - /// 描述 - /// - public string Description { get; set; } - /// - /// 系统数据类型,如 int - /// - public string DataType - { - get; - set; - } - - /// - /// 数据库里面存放的类型。 - /// - public string FieldType { get; set; } - - /// - /// 代表小数位精度。 - /// - public long? FieldScale { get; set; } - /// - /// 数据精度,仅数字类型有效,总共多少位数字(10进制)。 - /// 在MySql里面代表了字段长度 - /// - public long? FieldPrecision { get; set; } - - /// - /// - /// - public long? FieldMaxLength { get; set; } - - /// - /// 可空 - /// - public bool IsNullable { get; set; } - /// - /// 是否为主键字段 - /// - public bool IsIdentity { get; set; } - /// - /// 【未用上】该字段是否自增 - /// - public bool Increment { get; set; } - - - /// - /// 默认值 - /// - public string FieldDefaultValue { get; set; } - - } -} diff --git a/ZR.Model/CodeGenerator/DbTableInfo.cs b/ZR.Model/CodeGenerator/DbTableInfo.cs deleted file mode 100644 index 0752175..0000000 --- a/ZR.Model/CodeGenerator/DbTableInfo.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ZR.Model -{ - /// - /// 数据表的信息 - /// - public class DbTableInfo - { - /// - /// 表格ID,表的名称。 - /// - public string TableName { get; set; } - - /// - /// 表的别称,或者描述 - /// - public string Description { get; set; } - /// - /// 字段列表 - /// - public List Fileds { get; set; } - /// - /// 初始化 - /// - public DbTableInfo() - { - Fileds = new List(); - } - - /// - /// 获取主键的名称列表。 - /// - /// - public List GetIdentityList() - { - var list = Fileds.Where(x => x.IsIdentity); - if (list == null) return null; - return list.Select(x => x.FieldName).ToList(); - } - /// - /// 获取主键字段列表 - /// - /// - public List GetIdentityFields() - { - var list = Fileds.Where(x => x.IsIdentity); - if (list == null) return null; - return list.ToList(); - } - /// - /// 获取可空字段。 - /// - /// - public List GetIsNullableFields() - { - var list = Fileds.Where(x => x.IsNullable); - if (list == null) return null; - return list.ToList(); - } - /// - /// 获取不可空字段。 - /// - /// - public List GetNotNullableFields() - { - var list = Fileds.Where(x => !x.IsNullable); - if (list == null) return null; - return list.ToList(); - } - } -} diff --git a/ZR.Repository/System/CodeGeneratorRepository.cs b/ZR.Repository/System/CodeGeneratorRepository.cs index b5d5f97..7c1888e 100644 --- a/ZR.Repository/System/CodeGeneratorRepository.cs +++ b/ZR.Repository/System/CodeGeneratorRepository.cs @@ -1,4 +1,5 @@ using Infrastructure.Attribute; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -12,50 +13,50 @@ namespace ZR.Repository.System [AppService(ServiceLifetime = LifeTime.Transient)] public class CodeGeneratorRepository : BaseRepository { - /// - /// 获取数据库 - /// - /// - public List GetAllDb() - { - //return Db.Ado.SqlQuery("select name as DbName from master..sysdatabases "); - var list = Db.DbMaintenance.GetDataBaseList(Db); - List dataBases = new List(); - list.ForEach(item => - { - dataBases.Add(new DataBaseInfo() { DbName = item }); - }); - return dataBases; - } + ///// + ///// 获取数据库 + ///// + ///// + //public List GetAllDb() + //{ + // //return Db.Ado.SqlQuery("select name as DbName from master..sysdatabases "); + // var list = Db.DbMaintenance.GetDataBaseList(Db); + // List dataBases = new List(); + // list.ForEach(item => + // { + // dataBases.Add(new DataBaseInfo() { DbName = item }); + // }); + // return dataBases; + //} - /// - /// 根据数据库名获取所有的表 - /// - /// - /// - /// - /// - public List GetAllTables(string dbName, string tableName, PagerInfo pager) - { - var tableList = GetSugarDbContext(dbName).DbMaintenance.GetTableInfoList(true); - if (!string.IsNullOrEmpty(tableName)) - { - tableList = tableList.Where(f => f.Name.Contains(tableName)).ToList(); - } - pager.TotalNum = tableList.Count; - return tableList.Skip(pager.PageSize * (pager.PageNum - 1)).Take(pager.PageSize).OrderBy(f => f.Name).ToList(); - } + ///// + ///// 根据数据库名获取所有的表 + ///// + ///// + ///// + ///// + ///// + //public List GetAllTables(string dbName, string tableName, PagerInfo pager) + //{ + // var tableList = GetSugarDbContext(dbName).DbMaintenance.GetTableInfoList(true); + // if (!string.IsNullOrEmpty(tableName)) + // { + // tableList = tableList.Where(f => f.Name.Contains(tableName)).ToList(); + // } + // pager.TotalNum = tableList.Count; + // return tableList.Skip(pager.PageSize * (pager.PageNum - 1)).Take(pager.PageSize).OrderBy(f => f.Name).ToList(); + //} - /// - /// 获取表格列信息 - /// - /// - /// - /// - public List GetColumnInfo(string dbName, string tableName) - { - return GetSugarDbContext(dbName).DbMaintenance.GetColumnInfosByTableName(tableName, true); - } + ///// + ///// 获取表格列信息 + ///// + ///// + ///// + ///// + //public List GetColumnInfo(string dbName, string tableName) + //{ + // return GetSugarDbContext(dbName).DbMaintenance.GetColumnInfosByTableName(tableName, true); + //} /// @@ -63,12 +64,12 @@ namespace ZR.Repository.System /// /// /// - public List GetAllTables(string[] tabList) - { - string sql = @"SELECT tbs.name as TableName ,ds.value as Description FROM sys.tables tbs - left join sys.extended_properties ds on ds.major_id=tbs.object_id and ds.minor_id=0"; + //public List GetAllTables(string[] tabList) + //{ + // string sql = @"SELECT tbs.name as TableName ,ds.value as Description FROM sys.tables tbs + // left join sys.extended_properties ds on ds.major_id=tbs.object_id and ds.minor_id=0"; - return Db.SqlQueryable(sql).WhereIF(tabList.Length > 0, x => tabList.Contains(x.TableName)).ToList(); - } + // return Db.SqlQueryable(sql).WhereIF(tabList.Length > 0, x => tabList.Contains(x.TableName)).ToList(); + //} } } diff --git a/ZR.Vue/src/views/tool/index.vue b/ZR.Vue/src/views/tool/index.vue index fefeab2..b291e7c 100644 --- a/ZR.Vue/src/views/tool/index.vue +++ b/ZR.Vue/src/views/tool/index.vue @@ -113,15 +113,15 @@ export default { replaceTableNameStr: "", }, rules: { - baseSpace: [ - { required: true, message: "请输入项目名称", trigger: "blur" }, - { - min: 2, - max: 50, - message: "长度在 2 到 50 个字符", - trigger: "blur", - }, - ], + // baseSpace: [ + // { required: true, message: "请输入项目名称", trigger: "blur" }, + // { + // min: 2, + // max: 50, + // message: "长度在 2 到 50 个字符", + // trigger: "blur", + // }, + // ], replaceTableNameStr: [ { min: 0, max: 50, message: "长度小于50个字符", trigger: "blur" }, ],