diff --git a/Infrastructure/Extensions/AppServiceExtensions.cs b/Infrastructure/Extensions/AppServiceExtensions.cs
index 98545c7..4f3f5e5 100644
--- a/Infrastructure/Extensions/AppServiceExtensions.cs
+++ b/Infrastructure/Extensions/AppServiceExtensions.cs
@@ -59,7 +59,7 @@ namespace Infrastructure.Extensions
services.AddTransient(serviceType, type);
break;
}
- Console.WriteLine($"注册:{serviceType}");
+ //Console.WriteLine($"注册:{serviceType}");
}
else
{
diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs
index 0d9790bd..6743089 100644
--- a/Infrastructure/OptionsSetting.cs
+++ b/Infrastructure/OptionsSetting.cs
@@ -7,18 +7,10 @@ namespace Infrastructure
public class OptionsSetting
{
public static string ConnAdmin = "conn_zrAdmin";
- public static string DbType = "conn_admin_Type";
+ public static string ConnDbType = "dbType";
public static string DbKey = "DbKey";
- public string Conn_Admin { get; set; }
-
- public string AppName { get; set; }
- ///
- /// 主库
- ///
- public string Master { get; set; }
public string Redis { get; set; }
-
public string Database { get; set; }
///
/// 是否演示模式
diff --git a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
index e4f8d99..ddb766d 100644
--- a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
+++ b/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs
@@ -2,7 +2,9 @@
using Infrastructure.Attribute;
using Infrastructure.Enums;
using Mapster;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Hosting;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -31,10 +33,12 @@ namespace ZR.Admin.WebApi.Controllers
private CodeGeneraterService _CodeGeneraterService = new CodeGeneraterService();
private IGenTableService GenTableService;
private IGenTableColumnService GenTableColumnService;
- public CodeGeneratorController(IGenTableService genTableService, IGenTableColumnService genTableColumnService)
+ private IWebHostEnvironment WebHostEnvironment;
+ public CodeGeneratorController(IGenTableService genTableService, IGenTableColumnService genTableColumnService, IWebHostEnvironment webHostEnvironment)
{
GenTableService = genTableService;
GenTableColumnService = genTableColumnService;
+ WebHostEnvironment = webHostEnvironment;
}
///
@@ -84,10 +88,13 @@ namespace ZR.Admin.WebApi.Controllers
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
var getTableColumn = GenTableColumnService.GenTableColumns(dto.TableId);
genTableInfo.Columns = getTableColumn;
- //DbTableInfo dbTableInfo = new() { Name = dto.tableName };
- CodeGeneratorTool.Generate(genTableInfo, dto);
- return SUCCESS(genTableInfo);
+ dto.ParentPath = WebHostEnvironment.WebRootPath + "\\Generatecode\\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
+
+ CodeGeneratorTool.Generate(genTableInfo, dto);
+ string zipPath = CodeGeneratorTool.ZipGenCode(dto);
+
+ return SUCCESS(new { zipPath });
}
///
@@ -134,8 +141,8 @@ namespace ZR.Admin.WebApi.Controllers
{
long[] tableId = Tools.SpitLongArrary(tableIds);
- GenTableService.DeleteGenTableByIds(tableId);
- return SUCCESS(1);
+ int result = GenTableService.DeleteGenTableByIds(tableId);
+ return SUCCESS(result);
}
///
@@ -173,70 +180,28 @@ namespace ZR.Admin.WebApi.Controllers
TableComment = tabInfo.Description,
Create_by = userName,
};
- int rows = GenTableService.ImportGenTable(genTable);
- if (rows > 0)
+ genTable.TableId = GenTableService.ImportGenTable(genTable);
+
+ if (genTable.TableId > 0)
{
//保存列信息
List dbColumnInfos = _CodeGeneraterService.GetColumnInfo(dbName, tableName);
- List genTableColumns = new();
- foreach (var column in dbColumnInfos)
- {
- GenTableColumn genTableColumn = new()
- {
- ColumnName = CodeGeneratorTool.FirstLowerCase(column.DbColumnName),
- ColumnComment = column.ColumnDescription,
- IsPk = column.IsPrimarykey,
- ColumnType = column.DataType,
- TableId = rows,
- TableName = tableName,
- CsharpType = TableMappingHelper.GetPropertyDatatype(column.DataType),
- CsharpField = column.DbColumnName.Substring(0, 1).ToUpper() + column.DbColumnName[1..],
- IsRequired = !column.IsNullable,
- IsIncrement = column.IsIdentity,
- Create_by = userName,
- Create_time = DateTime.Now,
- IsInsert = !column.IsIdentity && !column.IsPrimarykey,
- IsEdit = !column.IsIdentity && !column.IsPrimarykey,
- IsList = true,
- IsQuery = false,
- HtmlType = GenConstants.HTML_INPUT
- };
-
- if (CodeGeneratorTool.imageFiled.Any(f => column.DbColumnName.ToLower().Contains(f.ToLower())))
- {
- genTableColumn.HtmlType = GenConstants.HTML_IMAGE_UPLOAD;
- }
- else if (genTableColumn.CsharpType.ToLower().Contains("datetime"))
- {
- genTableColumn.HtmlType = GenConstants.HTML_DATETIME;
- }
- else if (CodeGeneratorTool.radioFiled.Any(f => column.DbColumnName.Contains(f)))
- {
- genTableColumn.HtmlType = GenConstants.HTML_RADIO;
- }
- else if (CodeGeneratorTool.selectFiled.Any(f => column.DbColumnName.Contains(f)))
- {
- genTableColumn.HtmlType = GenConstants.HTML_SELECT;
- }
- else if (column.Length > 300)
- {
- genTableColumn.HtmlType = GenConstants.HTML_TEXTAREA;
- }
-
- genTableColumns.Add(genTableColumn);
- }
+ List genTableColumns = CodeGeneratorTool.InitGenTableColumn(genTable, dbColumnInfos);
GenTableColumnService.DeleteGenTableColumnByTableName(tableName);
GenTableColumnService.InsertGenTableColumn(genTableColumns);
+ genTable.Columns = genTableColumns;
+
+ return SUCCESS(genTable);
}
}
}
- return SUCCESS(1);
+ return ToRespose(ResultCode.FAIL);
}
///
- /// 代码生成保存
+ /// 修改保存代码生成业务
///
///
[HttpPut]
diff --git a/ZR.Admin.WebApi/Template/Controller.cs b/ZR.Admin.WebApi/Template/Controller.cs
deleted file mode 100644
index 60fa74c..0000000
--- a/ZR.Admin.WebApi/Template/Controller.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-
-//------------------------------------------------------------------------------
-//
-// 此代码已从模板生成。
-//
-// 手动更改此文件可能导致应用程序出现意外的行为。
-// 如果重新生成代码,将覆盖对此文件的手动更改。
-//
-//------------------------------------------------------------------------------
-using Infrastructure.Attribute;
-using Microsoft.AspNetCore.Mvc;
-using ZR.Admin.WebApi.Filters;
-using ZR.Model.System;
-using ZR.Service.System.IService;
-using Infrastructure.Model;
-using SqlSugar;
-using Mapster;
-using ZR.Model.System.Dto;
-using Infrastructure.Enums;
-using Infrastructure;
-using ZR.Admin.WebApi.Extensions;
-
-namespace ZR.Admin.WebApi.Controllers
-{
- ///
- /// T4代码自动生成
- ///
-
- [Verify]
- [Route("system/SysFile")]
- public class SysFile1Controller: BaseController
- {
- ///
- /// 文件管理接口
- ///
- private readonly ISysFileService _SysFileService;
-
- public SysFile1Controller(ISysFileService SysFileService)
- {
- _SysFileService = SysFileService;
- }
-
- ///
- /// 查询文件管理列表
- ///
- ///
- [HttpGet("list")]
- //[ActionPermissionFilter(Permission = "system:SysFile:list")]
- public IActionResult Query([FromQuery] SysFileQueryDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create();
-
- //TODO 搜索条件
- //predicate = predicate.And(m => m.Name.Contains(parm.Name));
-
- var response = _SysFileService.GetPages(predicate.ToExpression(), parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询文件管理详情
- ///
- ///
- ///
- [HttpGet("{id}")]
- public IActionResult Get(string id)
- {
- var response = _SysFileService.GetId(id);
-
- return SUCCESS(response);
- }
-
- ///
- /// 添加文件管理
- ///
- ///
- [HttpPost]
- //[ActionPermissionFilter(Permission = "system:SysFile:add")]
- [Log(Title = "文件管理添加", BusinessType = BusinessType.INSERT)]
- public IActionResult Create([FromBody] SysFile parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求参数错误");
- }
- //从 Dto 映射到 实体
- var addModel = parm.Adapt().ToCreate();
- //addModel.CreateID = User.Identity.Name;
-
- return SUCCESS(_SysFileService.Add(addModel));
- }
-
- ///
- /// 更新文件管理
- ///
- ///
- [HttpPut("edit")]
- //[ActionPermissionFilter(Permission = "system:SysFile:update")]
- [Log(Title = "文件管理修改", BusinessType = BusinessType.UPDATE)]
- public IActionResult Update([FromBody] SysFile parm)
- {
- //从 Dto 映射到 实体
- var addModel = parm.Adapt().ToCreate();
- //addModel.CreateID = User.Identity.Name;
- //TODO 字段映射
- var response = _SysFileService.Update(addModel);
-
- return SUCCESS(response);
- }
-
- ///
- /// 删除文件管理
- ///
- ///
- [HttpDelete("{id}")]
- //[ActionPermissionFilter(Permission = "system:SysFile:delete")]
- [Log(Title = "文件管理删除", BusinessType = BusinessType.DELETE)]
- public IActionResult Delete(int id = 0)
- {
- if (id <= 0) { return OutputJson(ApiResult.Error($"删除失败Id 不能为空")); }
-
- // 删除文件管理
- var response = _SysFileService.Delete(id);
-
- return SUCCESS(response);
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Template/Controller.tt b/ZR.Admin.WebApi/Template/Controller.tt
deleted file mode 100644
index 3646cc6..0000000
--- a/ZR.Admin.WebApi/Template/Controller.tt
+++ /dev/null
@@ -1,145 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ assembly name="System.Core" #>
-<#@ import namespace="System.Linq" #>
-<#@ import namespace="System.Text" #>
-<#@ import namespace="System.Collections.Generic" #>
-<#@ output extension=".cs" #>
-
-<#
-string ModelName="SysFile";
-string ControllerName="SysFile";
-string ServiceName="SysFileService";
-string FileName="文件管理";
-string ModelNameSpace="ZRAdmin.Controllers";
-#>
-//------------------------------------------------------------------------------
-//
-// 此代码已从模板生成。
-//
-// 手动更改此文件可能导致应用程序出现意外的行为。
-// 如果重新生成代码,将覆盖对此文件的手动更改。
-//
-//------------------------------------------------------------------------------
-using Infrastructure.Attribute;
-using Microsoft.AspNetCore.Mvc;
-using ZRAdmin.Filters;
-using ZR.Model;
-using ZR.Model.System;
-using ZR.Model.Vo;
-using ZR.Service.IService;
-using Infrastructure.Model;
-using SqlSugar;
-using Mapster;
-using ZR.Model.Dto.System;
-using Infrastructure.Enums;
-using Infrastructure;
-using ZRAdmin.Extensions;
-
-namespace <#=ModelNameSpace#>
-{
- ///
- /// T4代码自动生成
- ///
-
- [Verify]
- [Route("system/<#=ModelName#>")]
- public class <#=ControllerName#>1Controller: BaseController
- {
- ///
- /// <#=FileName#>接口
- ///
- private readonly I<#=ServiceName#> _<#=ServiceName#>;
-
- public <#=ControllerName#>1Controller(I<#=ServiceName#> <#=ServiceName#>)
- {
- _<#=ServiceName#> = <#=ServiceName#>;
- }
-
- ///
- /// 查询<#=FileName#>列表
- ///
- ///
- [HttpGet("list")]
- //[ActionPermissionFilter(Permission = "system:<#=ModelName#>:list")]
- public IActionResult Query([FromQuery] <#=ModelName#>QueryDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create<<#=ModelName#>>();
-
- //TODO 搜索条件
- //predicate = predicate.And(m => m.Name.Contains(parm.Name));
-
- var response = _<#=ServiceName#>.GetPages(predicate.ToExpression(), parm);
-
- return SUCCESS(response);
- }
-
- ///
- /// 查询<#=FileName#>详情
- ///
- ///
- ///
- [HttpGet("{id}")]
- public IActionResult Get(string id)
- {
- var response = _<#=ServiceName#>.GetId(id);
-
- return SUCCESS(response);
- }
-
- ///
- /// 添加<#=FileName#>
- ///
- ///
- [HttpPost]
- //[ActionPermissionFilter(Permission = "system:<#=ModelName#>:add")]
- [Log(Title = "<#=FileName#>添加", BusinessType = BusinessType.INSERT)]
- public IActionResult Create([FromBody] <#=ModelName#> parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求参数错误");
- }
- //从 Dto 映射到 实体
- var addModel = parm.Adapt<<#=ModelName#>>().ToCreate();
- //addModel.CreateID = User.Identity.Name;
-
- return SUCCESS(_<#=ServiceName#>.Add(addModel));
- }
-
- ///
- /// 更新<#=FileName#>
- ///
- ///
- [HttpPut("edit")]
- //[ActionPermissionFilter(Permission = "system:<#=ModelName#>:update")]
- [Log(Title = "<#=FileName#>修改", BusinessType = BusinessType.UPDATE)]
- public IActionResult Update([FromBody] <#=ModelName#> parm)
- {
- //从 Dto 映射到 实体
- var addModel = parm.Adapt<<#=ModelName#>>().ToCreate();
- //addModel.CreateID = User.Identity.Name;
- //TODO 字段映射
- var response = _<#=ServiceName#>.Update(addModel);
-
- return SUCCESS(response);
- }
-
- ///
- /// 删除<#=FileName#>
- ///
- ///
- [HttpDelete("{id}")]
- //[ActionPermissionFilter(Permission = "system:<#=ModelName#>:delete")]
- [Log(Title = "<#=FileName#>删除", BusinessType = BusinessType.DELETE)]
- public IActionResult Delete(int id = 0)
- {
- if (id <= 0) { return OutputJson(ApiResult.Error($"删除失败Id 不能为空")); }
-
- // 删除<#=FileName#>
- var response = _<#=ServiceName#>.Delete(id);
-
- return SUCCESS(response);
- }
- }
-}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
index cbbf3ed..b0b4875 100644
--- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
+++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj
@@ -15,6 +15,11 @@
+
+
+
+
+
@@ -53,10 +58,6 @@
Always
-
- TextTemplatingFileGenerator
- Controller.cs
-
Always
@@ -86,6 +87,7 @@
+
@@ -102,12 +104,4 @@
-
-
- True
- True
- Controller.tt
-
-
-
diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json
index 8966330..00c5b4b 100644
--- a/ZR.Admin.WebApi/appsettings.json
+++ b/ZR.Admin.WebApi/appsettings.json
@@ -28,9 +28,9 @@
},
"gen": {
"conn": "server=127.0.0.1;user=zr;pwd=abc;database={database}",
- "dbType": 1,
+ "dbType": 0, //MySql = 0, SqlServer = 1
"autoPre": true, //Զȥǰ
- "author": "zhaorui",
+ "author": "zr",
"tablePrefix": "live_,sys_" //"ǰǰöŷָ",
}
}
diff --git a/ZR.Admin.WebApi/Template/ControllersTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ControllersTemplate.txt
similarity index 90%
rename from ZR.Admin.WebApi/Template/ControllersTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ControllersTemplate.txt
index 9bb86ba..35376b3 100644
--- a/ZR.Admin.WebApi/Template/ControllersTemplate.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ControllersTemplate.txt
@@ -13,6 +13,7 @@ using {ModelsNamespace}.Models;
using {ServicesNamespace}.Business;
using {ApiControllerNamespace}.Extensions;
using {ApiControllerNamespace}.Filters;
+using ZR.Common;
namespace {ApiControllerNamespace}.Controllers
{
@@ -59,7 +60,7 @@ namespace {ApiControllerNamespace}.Controllers
///
[HttpGet("{{PrimaryKey}}")]
[ActionPermissionFilter(Permission = "{Permission}:query")]
- public IActionResult Get{ModelName}({KeyTypeName} {PrimaryKey})
+ public IActionResult Get{ModelName}({PKCsharpType} {PrimaryKey})
{
var response = _{ModelName}Service.GetId({PrimaryKey});
@@ -117,14 +118,15 @@ namespace {ApiControllerNamespace}.Controllers
/// 删除{TableDesc}
///
///
- [HttpDelete("{{PrimaryKey}}")]
+ [HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "{Permission}:delete")]
[Log(Title = "{TableDesc}删除", BusinessType = BusinessType.DELETE)]
- public IActionResult Delete{ModelName}({KeyTypeName} {PrimaryKey} = 0)
+ public IActionResult Delete{ModelName}(string ids)
{
- if ({PrimaryKey} <= 0) { return OutputJson(ApiResult.Error($"删除失败Id 不能为空")); }
+ int[] idsArr = Tools.SpitIntArrary(ids);
+ if (idsArr.Length <= 0) { return OutputJson(ApiResult.Error($"删除失败Id 不能为空")); }
- var response = _{ModelName}Service.Delete({PrimaryKey});
+ var response = _{ModelName}Service.Delete(idsArr);
return SUCCESS(response);
}
diff --git a/ZR.Admin.WebApi/Template/IServiceTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/IServiceTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/IServiceTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/IServiceTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/InputDtoTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/InputDtoTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/InputDtoTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/InputDtoTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/ModelTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ModelTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/ModelTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ModelTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/RepositoryTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/RepositoryTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/RepositoryTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/RepositoryTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/ServiceTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ServiceTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/ServiceTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/ServiceTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/VueJsTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/VueJsTemplate.txt
similarity index 100%
rename from ZR.Admin.WebApi/Template/VueJsTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/VueJsTemplate.txt
diff --git a/ZR.Admin.WebApi/Template/VueTemplate.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/VueTemplate.txt
similarity index 96%
rename from ZR.Admin.WebApi/Template/VueTemplate.txt
rename to ZR.Admin.WebApi/wwwroot/CodeGenTemplate/VueTemplate.txt
index cd4562f..0b16fb0 100644
--- a/ZR.Admin.WebApi/Template/VueTemplate.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/VueTemplate.txt
@@ -107,6 +107,7 @@ export default {
// this.getDicts("sys_normal_disable").then((response) => {
// this.statusOptions = response.data;
// });
+ {MountedMethod}
},
methods: {
// 查询数据
@@ -142,7 +143,7 @@ export default {
//TODO 重置字段
};
},
- // 多选框选中数据
+ // 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.{primaryKey});
this.single = selection.length!=1
@@ -166,10 +167,11 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
- del{ModelTypeName}(row.{primaryKey}).then((res) => {
- this.msgSuccess("删除成功");
- this.handleQuery();
- });
+ const {primaryKey}s = row.{primaryKey} || this.ids;
+ del{ModelTypeName}({primaryKey}s.toString()).then((res) => {
+ this.msgSuccess("删除成功");
+ this.handleQuery();
+ });
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -184,7 +186,6 @@ export default {
});
},
beforeFileUpload(file) { },
- //文件上传成功方法
{vueJsMethod}
/** 提交按钮 */
submitForm: function () {
diff --git a/ZR.CodeGenerator/CodeGenerateTemplate.cs b/ZR.CodeGenerator/CodeGenerateTemplate.cs
index 99f3093..6559693 100644
--- a/ZR.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ZR.CodeGenerator/CodeGenerateTemplate.cs
@@ -15,17 +15,28 @@ namespace ZR.CodeGenerator
///
///
///
- public static string GetVueJsMethod(GenTableColumn dbColumnInfo)
+ public static string GetVueJsMethod(GenTableColumn dbFieldInfo)
{
- string columnName = dbColumnInfo.ColumnName;
+ string columnName = dbFieldInfo.ColumnName;
string js = "";
- if (dbColumnInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
+ if (dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
{
- js += $"handleUpload{columnName}Success(res, file) {{\r\n";
+ js += " //文件上传成功方法\r\n";
+ js += $" handleUpload{columnName}Success(res, file) {{\r\n";
js += $" this.form.{columnName} = URL.createObjectURL(file.raw);\r\n";
js += " // this.$refs.upload.clearFiles();\r\n";
js += " },\r";
}
+ //有下拉框选项初列表查询数据
+ if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
+ {
+ var sb = new System.Text.StringBuilder(500);
+ sb.AppendLine(@$" // {dbFieldInfo.ColumnComment}字典翻译");
+ sb.AppendLine($" {columnName}Format(row, column) {{");
+ sb.AppendLine(@$" return this.selectDictLabel(this.{columnName}Options, row.{columnName});");
+ sb.AppendLine(@" },");
+ js += sb.ToString();
+ }
return js;
}
@@ -79,7 +90,7 @@ namespace ZR.CodeGenerator
public static string GetDtoProperty(GenTableColumn dbFieldInfo)
{
string InputDtoContent = "";
- if (CodeGeneratorTool.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
+ if (GenConstants.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
{
return InputDtoContent;
}
@@ -98,7 +109,7 @@ namespace ZR.CodeGenerator
public static string GetQueryDtoProperty(GenTableColumn dbFieldInfo)
{
string QueryDtoContent = "";
- if (dbFieldInfo.IsQuery && !CodeGeneratorTool.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
+ if (dbFieldInfo.IsQuery && !GenConstants.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
{
QueryDtoContent += $" public {dbFieldInfo.CsharpType} {dbFieldInfo.CsharpField} {{ get; set; }}\r\n";
}
@@ -114,7 +125,7 @@ namespace ZR.CodeGenerator
string vueViewFromContent = "";
string labelDisabled = dbFieldInfo.IsPk ? ":disabled=\"true\"" : "";
string placeHolder = dbFieldInfo.IsIncrement ? "" : $"请输入{labelName}";
- if (CodeGeneratorTool.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
+ if (GenConstants.inputDtoNoField.Any(f => f.Replace("_", "").ToLower().Contains(dbFieldInfo.CsharpField.ToLower().Replace("_", ""))))
{
return vueViewFromContent;
}
@@ -157,16 +168,17 @@ namespace ZR.CodeGenerator
}
else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
+ string value = TableMappingHelper.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
vueViewFromContent += $" \r\n";
- vueViewFromContent += $" ";
- vueViewFromContent += $" \r\n";
- vueViewFromContent += " \r\n";
+ vueViewFromContent += $" \r\n";
+ vueViewFromContent += $" \r\n";
+ vueViewFromContent += " \r\n";
vueViewFromContent += " \r\n";
}
else
{
string inputNumTxt = TableMappingHelper.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
- vueViewFromContent += $" \r\n";
+ vueViewFromContent += $" \r\n";
vueViewFromContent += $" \r\n";
vueViewFromContent += " \r\n";
}
@@ -208,14 +220,12 @@ namespace ZR.CodeGenerator
string columnName = dbFieldInfo.ColumnName;
string label = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, columnName);
string vueViewListContent = "";
- string showToolTip = dbFieldInfo.CsharpType == "string" ? ":show-overflow-tooltip=\"true\"" : "";
- if (!dbFieldInfo.IsList)
+ string showToolTip = dbFieldInfo.ColumnType.Contains("varchar") ? ":show-overflow-tooltip=\"true\"" : "";
+ string formatter = !string.IsNullOrEmpty(dbFieldInfo.DictType) ? $" :formatter=\"{columnName}Format\"" : "";
+
+ if (dbFieldInfo.IsList && dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
{
-
- }
- else if (dbFieldInfo.HtmlType.Equals(GenConstants.HTML_IMAGE_UPLOAD))
- {
- vueViewListContent += $" \r\n";
+ vueViewListContent += $" \r\n";
vueViewListContent += " \r\n";
vueViewListContent += $" \r\n";
vueViewListContent += " \r\n";
@@ -230,9 +240,9 @@ namespace ZR.CodeGenerator
// vueViewListContent += " \r\n";
// vueViewListContent += " \r\n";
//}
- else
+ else if(dbFieldInfo.IsList)
{
- vueViewListContent += $" \r\n";
+ vueViewListContent += $" \r\n";
}
return vueViewListContent;
}
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index c95e7bb..81aa9e6 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -1,8 +1,10 @@
using Infrastructure;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using ZR.CodeGenerator.CodeGenerator;
using ZR.CodeGenerator.Model;
using ZR.Model.System.Generate;
@@ -20,24 +22,15 @@ namespace ZR.CodeGenerator
/// 代码生成器配置
///
private static CodeGenerateOption _option = new CodeGenerateOption();
- ///
- /// InputDto输入实体是不包含字段
- ///
- public static readonly string[] inputDtoNoField = new string[] { "createTime", "updateTime", "addtime" };
- public static readonly string[] imageFiled = new string[] { "icon", "img", "image", "url", "pic", "photo" };
- public static readonly string[] selectFiled = new string[] { "status", "type", "state", "sex", "gender" };
- public static readonly string[] radioFiled = new string[] { "status", "state", "isShow", "isHidden", "ishide" };
///
/// 代码生成器入口方法
///
///
///
- public static void Generate(GenTable dbTableInfo, GenerateDto dto)
+ public static List Generate(GenTable dbTableInfo, GenerateDto dto)
{
- _option.BaseNamespace = "ZR.";
- //_option.TableList = listTable;
- _option.ReplaceTableNameStr = dto.replaceTableNameStr;
+ _option.BaseNamespace = dbTableInfo.BaseNameSpace;
_option.DtosNamespace = _option.BaseNamespace + "Model";
_option.ModelsNamespace = _option.BaseNamespace + "Model";
_option.RepositoriesNamespace = _option.BaseNamespace + "Repository";
@@ -46,7 +39,43 @@ namespace ZR.CodeGenerator
_option.ServicesNamespace = _option.BaseNamespace + "Service";
_option.ApiControllerNamespace = _option.BaseNamespace + "Admin.WebApi";
- GenerateSingle(dbTableInfo?.Columns, dbTableInfo, dto);
+ List list = GenerateSingle(dbTableInfo?.Columns, dbTableInfo, dto);
+
+ return list;
+ }
+
+ ///
+ /// 打包压缩代码
+ ///
+ ///
+ ///
+ public static string ZipGenCode(GenerateDto dto)
+ {
+ try
+ {
+ string zipPath = Environment.CurrentDirectory + "\\wwwroot\\Generatecode\\";
+ //生成压缩包
+ string zipReturnFileName = dto.baseSpace + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip";
+
+ if (!Directory.Exists(zipPath))
+ {
+ Directory.CreateDirectory(zipPath);
+ }
+ string zipFileName = zipPath + "\\" + zipReturnFileName;
+ if (File.Exists(zipFileName))
+ {
+ File.Delete(zipFileName);
+ }
+ Console.WriteLine(zipFileName);
+ FileHelper.ZipFileDirectory(dto.ParentPath, zipFileName, 7, "", "", "*.*");
+ FileHelper.DeleteDirectory(dto.ParentPath);
+ return zipFileName;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ return "";
+ }
}
///
@@ -55,10 +84,11 @@ namespace ZR.CodeGenerator
/// 表字段集合
/// 表信息
///
- public static void GenerateSingle(List listField, GenTable tableInfo, GenerateDto dto)
+ public static List GenerateSingle(List listField, GenTable tableInfo, GenerateDto dto)
{
string PKName = "id";
string PKType = "int";
+ List genPathList = new();
ReplaceDto replaceDto = new();
replaceDto.ModelTypeName = tableInfo.ClassName;//表名对应C# 实体类名
replaceDto.TableName = tableInfo.TableName;
@@ -88,15 +118,19 @@ namespace ZR.CodeGenerator
{
replaceDto.InsertColumn += $"it.{dbFieldInfo.CsharpField}, ";
}
- //查询
+ //TODO 查询
//if (dbFieldInfo.IsQuery)
//{
// replaceDto.Querycondition += $"predicate = predicate.And(m => m.{dbFieldInfo.CsharpField}.Contains(parm.Name));";
//}
- if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT && !string.IsNullOrEmpty(dbFieldInfo.DictType))
+ if ((dbFieldInfo.HtmlType == GenConstants.HTML_SELECT || dbFieldInfo.HtmlType == GenConstants.HTML_RADIO) && !string.IsNullOrEmpty(dbFieldInfo.DictType))
{
replaceDto.VueDataContent += $"// {dbFieldInfo.ColumnComment}选项列表\n";
replaceDto.VueDataContent += $"{FirstLowerCase(dbFieldInfo.CsharpField)}Options: [],";
+
+ replaceDto.MountedMethod += $" this.getDicts(\"{dbFieldInfo.DictType}\").then((response) => {{\n";
+ replaceDto.MountedMethod += $" this.{FirstLowerCase(dbFieldInfo.CsharpField)}Options = response.data;\n";
+ replaceDto.MountedMethod += " })\n";
}
replaceDto.QueryProperty += CodeGenerateTemplate.GetQueryDtoProperty(dbFieldInfo);
@@ -113,29 +147,44 @@ namespace ZR.CodeGenerator
if (dto.genFiles.Contains(1))
{
- GenerateModels(replaceDto, dto);
+ Tuple tuple = GenerateModels(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
}
if (dto.genFiles.Contains(2))
{
- GenerateInputDto(replaceDto, dto);
+ Tuple tuple = GenerateInputDto(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
}
if (dto.genFiles.Contains(3))
{
- GenerateRepository(replaceDto, dto);
+ Tuple tuple = GenerateRepository(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
}
if (dto.genFiles.Contains(4))
{
- GenerateIService(replaceDto, dto);
- GenerateService(replaceDto, dto);
+ Tuple tuple = GenerateIService(replaceDto, dto);
+ Tuple tuple_1 = GenerateService(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ genPathList.Add(tuple_1.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
+ //WriteAndSave(tuple_1.Item1, tuple_1.Item2);
}
if (dto.genFiles.Contains(5))
{
- GenerateControllers(replaceDto, dto);
+ Tuple tuple = GenerateControllers(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
}
if (dto.genFiles.Contains(6))
{
- GenerateVueViews(replaceDto, dto);
+ Tuple tuple = GenerateVueViews(replaceDto, dto);
+ genPathList.Add(tuple.Item1);
+ //WriteAndSave(tuple.Item1, tuple.Item2);
}
+ return genPathList;
//GenerateIRepository(modelTypeName, modelTypeDesc, keyTypeName, ifExsitedCovered);
//GenerateOutputDto(modelTypeName, modelTypeDesc, outputDtocontent, ifExsitedCovered);
}
@@ -150,7 +199,7 @@ namespace ZR.CodeGenerator
/// 替换实体
private static Tuple GenerateModels(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
//../ZR.Model
var servicesPath = parentPath + "\\" + _option.ModelsNamespace + "\\Models\\";
if (!Directory.Exists(servicesPath))
@@ -159,7 +208,7 @@ namespace ZR.CodeGenerator
}
// ../ZR.Model/Models/User.cs
var fullPath = servicesPath + replaceDto.ModelTypeName + ".cs";
- Console.WriteLine(fullPath);
+
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, "");
var content = ReadTemplate("ModelTemplate.txt");
@@ -174,7 +223,6 @@ namespace ZR.CodeGenerator
return Tuple.Create(fullPath, content);
}
-
///
/// 生成InputDto文件
///
@@ -182,7 +230,7 @@ namespace ZR.CodeGenerator
/// 替换实体
private static Tuple GenerateInputDto(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
var servicesPath = parentPath + "\\" + _option.ModelsNamespace + "\\Dto\\";
if (!Directory.Exists(servicesPath))
{
@@ -190,7 +238,7 @@ namespace ZR.CodeGenerator
}
// ../ZR.Model/Dto/User.cs
var fullPath = servicesPath + replaceDto.ModelTypeName + "Dto.cs";
- Console.WriteLine(fullPath);
+
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, ""); ;
var content = ReadTemplate("InputDtoTemplate.txt");
@@ -215,14 +263,14 @@ namespace ZR.CodeGenerator
/// 替换实体
private static Tuple GenerateRepository(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
var repositoryPath = parentPath + "\\" + _option.RepositoriesNamespace + "\\Repositories\\";
if (!Directory.Exists(repositoryPath))
{
Directory.CreateDirectory(repositoryPath);
}
var fullPath = repositoryPath + "\\" + replaceDto.ModelTypeName + "Repository.cs";
- Console.WriteLine(fullPath);
+
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, "");
var content = ReadTemplate("RepositoryTemplate.txt");
@@ -247,7 +295,7 @@ namespace ZR.CodeGenerator
/// 替换实体
private static Tuple GenerateIService(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
var iServicesPath = parentPath + "\\" + _option.IServicsNamespace + "\\Business\\IBusService\\";
if (!Directory.Exists(iServicesPath))
{
@@ -274,7 +322,7 @@ namespace ZR.CodeGenerator
///
private static Tuple GenerateService(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
var servicesPath = parentPath + "\\" + _option.ServicesNamespace + "\\Business\\";
if (!Directory.Exists(servicesPath))
{
@@ -306,14 +354,13 @@ namespace ZR.CodeGenerator
///
private static Tuple GenerateControllers(ReplaceDto replaceDto, GenerateDto generateDto)
{
- var parentPath = "..";
+ var parentPath = generateDto.ParentPath;
var servicesPath = parentPath + "\\" + _option.ApiControllerNamespace + "\\Controllers\\business\\";
if (!Directory.Exists(servicesPath))
{
Directory.CreateDirectory(servicesPath);
}
var fullPath = servicesPath + replaceDto.ModelTypeName + "Controller.cs";
- Console.WriteLine(fullPath);
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, "");
var content = ReadTemplate("ControllersTemplate.txt");
@@ -327,7 +374,7 @@ namespace ZR.CodeGenerator
.Replace("{PrimaryKey}", replaceDto.PKName)
.Replace("{UpdateColumn}", replaceDto.UpdateColumn)
.Replace("{InsertColumn}", replaceDto.InsertColumn)
- .Replace("{KeyTypeName}", replaceDto.PKType);
+ .Replace("{PKCsharpType}", replaceDto.PKType);
WriteAndSave(fullPath, content);
return Tuple.Create(fullPath, content);
}
@@ -339,14 +386,14 @@ namespace ZR.CodeGenerator
private static Tuple GenerateVueViews(ReplaceDto replaceDto, GenerateDto generateDto)
{
//var parentPath = "..\\CodeGenerate";//若要生成到项目中将路径改成 “..\\ZR.Vue\\src”
- var parentPath = "..\\ZR.Vue\\src";
+ var parentPath = $"{generateDto.ParentPath}\\ZR.Vue\\src";
var servicesPath = parentPath + "\\views\\" + FirstLowerCase(replaceDto.ModelTypeName);
if (!Directory.Exists(servicesPath))
{
Directory.CreateDirectory(servicesPath);
}
var fullPath = servicesPath + "\\" + "index.vue";
- Console.WriteLine(fullPath);
+
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, ""); ;
var content = ReadTemplate("VueTemplate.txt");
@@ -360,8 +407,8 @@ namespace ZR.CodeGenerator
.Replace("{vueJsMethod}", replaceDto.VueJsMethod)
.Replace("{vueQueryFormHtml}", replaceDto.VueQueryFormHtml)
.Replace("{VueDataContent}", replaceDto.VueDataContent)
- //.Replace("{VueViewSaveBindContent}", vueViewSaveBindContent)
.Replace("{primaryKey}", FirstLowerCase(replaceDto.PKName))
+ .Replace("{MountedMethod}", replaceDto.MountedMethod)
.Replace("{VueViewEditFormRuleContent}", replaceDto.VueViewEditFormRuleContent);//添加、修改表单验证规则
WriteAndSave(fullPath, content);
@@ -369,14 +416,14 @@ namespace ZR.CodeGenerator
servicesPath = parentPath + "\\api\\";
Directory.CreateDirectory(servicesPath);
fullPath = servicesPath + "\\" + FirstLowerCase(replaceDto.ModelTypeName) + ".js";
- Console.WriteLine(fullPath);
+
if (File.Exists(fullPath) && !generateDto.coverd)
return Tuple.Create(fullPath, "");
content = ReadTemplate("VueJsTemplate.txt");
content = content
.Replace("{ModelTypeName}", replaceDto.ModelTypeName)
.Replace("{ModelTypeDesc}", replaceDto.TableDesc);
- //.Replace("{fileClassName}", fileClassName)
+
WriteAndSave(fullPath, content);
return Tuple.Create(fullPath, content);
}
@@ -437,8 +484,9 @@ namespace ZR.CodeGenerator
///
private static string ReadTemplate(string templateName)
{
- var path = AppDomain.CurrentDomain.BaseDirectory;
- string fullName = $"{path}\\Template\\{templateName}";
+ string path = Environment.CurrentDirectory;
+ //var path = AppDomain.CurrentDomain.BaseDirectory;
+ string fullName = $"{path}\\wwwroot\\CodeGenTemplate\\{templateName}";
string temp = fullName;
string str = "";
if (!File.Exists(temp))
@@ -485,5 +533,74 @@ namespace ZR.CodeGenerator
}
#endregion
+
+
+ ///
+ /// 初始化列属性字段数据
+ ///
+ ///
+ ///
+ public static List InitGenTableColumn(GenTable genTable, List dbColumnInfos)
+ {
+ List genTableColumns = new();
+ foreach (var column in dbColumnInfos)
+ {
+ GenTableColumn genTableColumn = new()
+ {
+ ColumnName = FirstLowerCase(column.DbColumnName),
+ ColumnComment = column.ColumnDescription,
+ IsPk = column.IsPrimarykey,
+ ColumnType = column.DataType,
+ TableId = genTable.TableId,
+ TableName = genTable.TableName,
+ CsharpType = TableMappingHelper.GetCSharpDatatype(column.DataType),
+ CsharpField = column.DbColumnName.Substring(0, 1).ToUpper() + column.DbColumnName[1..],
+ IsRequired = !column.IsNullable,
+ IsIncrement = column.IsIdentity,
+ Create_by = genTable.Create_by,
+ Create_time = DateTime.Now,
+ IsInsert = !column.IsIdentity,//非自增字段都需要插入
+ IsQuery = false,
+ HtmlType = GenConstants.HTML_INPUT
+ };
+
+ if (GenConstants.imageFiled.Any(f => column.DbColumnName.ToLower().Contains(f.ToLower())))
+ {
+ genTableColumn.HtmlType = GenConstants.HTML_IMAGE_UPLOAD;
+ }
+ else if (GenConstants.COLUMNTYPE_TIME.Any(f => genTableColumn.CsharpType.ToLower().Contains(f.ToLower())))
+ {
+ genTableColumn.HtmlType = GenConstants.HTML_DATETIME;
+ }
+ else if (GenConstants.radioFiled.Any(f => column.DbColumnName.EndsWith(f, StringComparison.OrdinalIgnoreCase)) ||
+ GenConstants.radioFiled.Any(f => column.DbColumnName.StartsWith(f, StringComparison.OrdinalIgnoreCase)))
+ {
+ genTableColumn.HtmlType = GenConstants.HTML_RADIO;
+ }
+ else if (GenConstants.selectFiled.Any(f => column.DbColumnName == f) ||
+ GenConstants.selectFiled.Any(f => column.DbColumnName.EndsWith(f, StringComparison.OrdinalIgnoreCase)))
+ {
+ genTableColumn.HtmlType = GenConstants.HTML_SELECT;
+ }
+ else if (column.Length > 500)
+ {
+ genTableColumn.HtmlType = GenConstants.HTML_TEXTAREA;
+ }
+ //编辑字段
+ if (GenConstants.COLUMNNAME_NOT_EDIT.Any(f => column.DbColumnName.Contains(f)) && !column.IsIdentity && !column.IsPrimarykey)
+ {
+ genTableColumn.IsEdit = true;
+ }
+ //列表字段
+ if (GenConstants.COLUMNNAME_NOT_LIST.Any(f => column.DbColumnName.Contains(f) && !column.IsPrimarykey))
+ {
+ genTableColumn.IsList = true;
+ }
+
+ genTableColumns.Add(genTableColumn);
+ }
+ return genTableColumns;
+ }
+
}
}
diff --git a/ZR.CodeGenerator/DbProvider.cs b/ZR.CodeGenerator/DbProvider.cs
index db30380..71982e1 100644
--- a/ZR.CodeGenerator/DbProvider.cs
+++ b/ZR.CodeGenerator/DbProvider.cs
@@ -28,7 +28,7 @@ namespace ZR.CodeGenerator
if (string.IsNullOrEmpty(dbName))
{
connStr = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.ConnAdmin);
- dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.DbType);
+ dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.ConnDbType);
}
var db = new SqlSugarScope(new List()
{
diff --git a/ZR.CodeGenerator/FileHelper.cs b/ZR.CodeGenerator/FileHelper.cs
new file mode 100644
index 0000000..5e55e29
--- /dev/null
+++ b/ZR.CodeGenerator/FileHelper.cs
@@ -0,0 +1,182 @@
+using ICSharpCode.SharpZipLib.Checksum;
+using ICSharpCode.SharpZipLib.Zip;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZR.CodeGenerator
+{
+ public class FileHelper
+ {
+ ///
+ /// 制作压缩包(多个文件压缩到一个压缩包,支持加密、注释)
+ ///
+ /// 要压缩的文件
+ /// 压缩文件目录
+ /// 压缩包文件名
+ /// 压缩级别 1-9
+ /// 密码
+ /// 注释
+ public static void ZipFiles(string[] fileNames, string topDirectoryName, string zipedFileName, int? compresssionLevel, string password = "", string comment = "")
+ {
+ using (ZipOutputStream zos = new ZipOutputStream(File.Open(zipedFileName, FileMode.OpenOrCreate)))
+ {
+ if (compresssionLevel.HasValue)
+ {
+ zos.SetLevel(compresssionLevel.Value);//设置压缩级别
+ }
+
+ if (!string.IsNullOrEmpty(password))
+ {
+ zos.Password = password;//设置zip包加密密码
+ }
+
+ if (!string.IsNullOrEmpty(comment))
+ {
+ zos.SetComment(comment);//设置zip包的注释
+ }
+
+ foreach (string file in fileNames)
+ {
+ //string fileName = string.Format("{0}/{1}", topDirectoryName, file);
+ string fileName = file;
+
+ if (File.Exists(fileName))
+ {
+ FileInfo item = new FileInfo(fileName);
+ FileStream fs = File.OpenRead(item.FullName);
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+
+ ZipEntry entry = new ZipEntry(item.Name);
+ zos.PutNextEntry(entry);
+ zos.Write(buffer, 0, buffer.Length);
+ }
+ }
+ }
+ }
+
+ ///
+ /// 压缩多层目录
+ ///
+ /// 压缩文件目录
+ /// 压缩包文件名
+ /// 压缩级别 1-9
+ /// 密码
+ /// 注释
+ /// 文件类型
+ public static void ZipFileDirectory(string topDirectoryName, string zipedFileName, int compresssionLevel, string password, string comment, string filetype)
+ {
+ using (System.IO.FileStream ZipFile = File.Open(zipedFileName, FileMode.OpenOrCreate))
+ {
+ using (ZipOutputStream zos = new ZipOutputStream(ZipFile))
+ {
+ if (compresssionLevel != 0)
+ {
+ zos.SetLevel(compresssionLevel);//设置压缩级别
+ }
+ if (!string.IsNullOrEmpty(password))
+ {
+ zos.Password = password;//设置zip包加密密码
+ }
+ if (!string.IsNullOrEmpty(comment))
+ {
+ zos.SetComment(comment);//设置zip包的注释
+ }
+ ZipSetp(topDirectoryName, zos, "", filetype);
+ }
+ }
+ }
+
+ ///
+ /// 递归遍历目录
+ ///
+ /// The directory.
+ /// The ZipOutputStream Object.
+ /// The parent path.
+ private static void ZipSetp(string strDirectory, ZipOutputStream s, string parentPath, string filetype)
+ {
+ if (strDirectory[^1] != Path.DirectorySeparatorChar)
+ {
+ strDirectory += Path.DirectorySeparatorChar;
+ }
+
+ Crc32 crc = new Crc32();
+
+ string[] filenames = Directory.GetFileSystemEntries(strDirectory, filetype);
+ foreach (string file in filenames)// 遍历所有的文件和目录
+ {
+ if (Directory.Exists(file))// 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件
+ {
+ string pPath = parentPath;
+ pPath += file.Substring(file.LastIndexOf("\\") + 1);
+ pPath += "\\";
+ ZipSetp(file, s, pPath, filetype);
+ }
+ else // 否则直接压缩文件
+ {
+ //打开压缩文件
+ using (FileStream fs = File.OpenRead(file))
+ {
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+ string fileName = parentPath + file[(file.LastIndexOf("\\") + 1)..];
+ ZipEntry entry = new ZipEntry(fileName);
+ entry.DateTime = DateTime.Now;
+ entry.Size = fs.Length;
+ fs.Close();
+ crc.Reset();
+ crc.Update(buffer);
+ entry.Crc = crc.Value;
+ s.PutNextEntry(entry);
+ s.Write(buffer, 0, buffer.Length);
+ }
+ }
+ }
+ }
+
+ ///
+ /// 删除指定目录下的所有文件及文件夹(保留目录)
+ ///
+ /// 文件目录
+ public static void DeleteDirectory(string file)
+ {
+ try
+ {
+ //判断文件夹是否还存在
+ if (Directory.Exists(file))
+ {
+ DirectoryInfo fileInfo = new DirectoryInfo(file);
+ //去除文件夹的只读属性
+ fileInfo.Attributes = FileAttributes.Normal & FileAttributes.Directory;
+ foreach (string f in Directory.GetFileSystemEntries(file))
+ {
+ if (File.Exists(f))
+ {
+ //去除文件的只读属性
+ File.SetAttributes(file, FileAttributes.Normal);
+ //如果有子文件删除文件
+ File.Delete(f);
+ }
+ else
+ {
+ //循环递归删除子文件夹
+ DeleteDirectory(f);
+ }
+ }
+ //删除空文件夹
+ Directory.Delete(file);
+ }
+
+ }
+ catch (Exception ex) // 异常处理
+ {
+ //Log4NetHelper.Error("代码生成异常", ex);
+ }
+ }
+
+ }
+}
diff --git a/ZR.CodeGenerator/GenConstants.cs b/ZR.CodeGenerator/GenConstants.cs
index 237a61e..71aecaf 100644
--- a/ZR.CodeGenerator/GenConstants.cs
+++ b/ZR.CodeGenerator/GenConstants.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
namespace ZR.CodeGenerator
{
@@ -17,6 +13,24 @@ namespace ZR.CodeGenerator
public static string Gen_autoPre = "gen:autoPre";
public static string Gen_tablePrefix = "gen:tablePrefix";
+ ///
+ /// InputDto输入实体是不包含字段
+ ///
+ public static readonly string[] inputDtoNoField = new string[] { "createTime", "updateTime", "addtime" };
+ ///
+ /// 图片字段
+ ///
+ public static readonly string[] imageFiled = new string[] { "icon", "img", "image", "url", "pic", "photo", "avatar" };
+ ///
+ /// 下拉框字段
+ ///
+ public static readonly string[] selectFiled = new string[] { "status", "type", "state", "sex", "gender" };
+ ///
+ /// 单选按钮字段
+ ///
+ public static readonly string[] radioFiled = new string[] { "status", "state", "is"};
+
+
/** 单表(增删改查) */
public static string TPL_CRUD = "crud";
@@ -55,14 +69,14 @@ namespace ZR.CodeGenerator
"bit", "bigint", "float", "double", "decimal" };
/** 页面不需要编辑字段 */
- public static string[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
+ public static string[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "delFlag" };
/** 页面不需要显示的列表字段 */
- public static string[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
- "update_time" };
+ public static string[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "delFlag", "update_by",
+ "update_time" , "password"};
/** 页面不需要查询字段 */
- public static string[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
+ public static string[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "delFlag", "update_by",
"update_time", "remark" };
/** Entity基类字段 */
@@ -102,17 +116,14 @@ namespace ZR.CodeGenerator
public static string TYPE_STRING = "string";
/** 整型 */
- public static string TYPE_INTEGER = "Integer";
+ public static string TYPE_INT = "int";
/** 长整型 */
- public static string TYPE_LONG = "Long";
+ public static string TYPE_LONG = "long";
/** 浮点型 */
public static string TYPE_DOUBLE = "Double";
- /** 高精度计算类型 */
- public static string TYPE_BIGDECIMAL = "BigDecimal";
-
/** 时间类型 */
public static string TYPE_DATE = "Date";
diff --git a/ZR.CodeGenerator/Model/GenerateDto.cs b/ZR.CodeGenerator/Model/GenerateDto.cs
index 15bb219..8f8c36e 100644
--- a/ZR.CodeGenerator/Model/GenerateDto.cs
+++ b/ZR.CodeGenerator/Model/GenerateDto.cs
@@ -25,7 +25,7 @@ namespace ZR.CodeGenerator.Model
///
/// 要删除表名的字符串用
///
- public string replaceTableNameStr { get; set; }
+ //public string replaceTableNameStr { get; set; }
///
/// 要生成的文件
///
@@ -34,5 +34,16 @@ namespace ZR.CodeGenerator.Model
/// 如果目标文件存在,是否覆盖。默认为false
///
public bool coverd { get; set; } = true;
+
+ #region 存储路径
+ //public string ModelPath { get; set; }
+ //public string ServicePath { get; set; }
+ //public string RepositoryPath { get; set; }
+ //public string ApiPath { get; set; }
+ //public string VuePath { get; set; }
+ //public string VueApiPath { get; set; }
+
+ public string ParentPath { get; set; } = "..";
+ #endregion
}
}
diff --git a/ZR.CodeGenerator/Model/ReplaceDto.cs b/ZR.CodeGenerator/Model/ReplaceDto.cs
index e95dc01..dc76c3d 100644
--- a/ZR.CodeGenerator/Model/ReplaceDto.cs
+++ b/ZR.CodeGenerator/Model/ReplaceDto.cs
@@ -92,5 +92,9 @@ namespace ZR.CodeGenerator.Model
/// vue data内容
///
public string VueDataContent { get; set; }
+ ///
+ /// vue mounted 方法
+ ///
+ public string MountedMethod { get; set; }
}
}
diff --git a/ZR.CodeGenerator/TableMappingHelper.cs b/ZR.CodeGenerator/TableMappingHelper.cs
index 2f6c1cd..7a0a938 100644
--- a/ZR.CodeGenerator/TableMappingHelper.cs
+++ b/ZR.CodeGenerator/TableMappingHelper.cs
@@ -45,75 +45,33 @@ namespace ZR.CodeGenerator.CodeGenerator
return sb.ToString();
}
- public static string GetPropertyDatatype(string sDatatype)
+ ///
+ /// 获取C# 类型
+ ///
+ ///
+ ///
+ public static string GetCSharpDatatype(string sDatatype)
{
- string sTempDatatype = string.Empty;
sDatatype = sDatatype.ToLower();
- switch (sDatatype)
+ string sTempDatatype = sDatatype switch
{
- case "int":
- case "number":
- case "integer":
- case "smallint":
- sTempDatatype = "int";
- break;
-
- case "bigint":
- sTempDatatype = "long";
- break;
-
- case "tinyint":
- sTempDatatype = "byte";
- break;
-
- case "numeric":
- case "real":
- sTempDatatype = "Single";
- break;
-
- case "float":
- sTempDatatype = "float";
- break;
-
- case "decimal":
- case "numer(8,2)":
- sTempDatatype = "decimal";
- break;
-
- case "bit":
- sTempDatatype = "bool";
- break;
-
- case "date":
- case "datetime":
- case "datetime2":
- case "smalldatetime":
- sTempDatatype = "DateTime";
- break;
-
- case "money":
- case "smallmoney":
- sTempDatatype = "double";
- break;
-
- case "char":
- case "varchar":
- case "nvarchar2":
- case "text":
- case "nchar":
- case "nvarchar":
- case "ntext":
- default:
- sTempDatatype = "string";
- break;
- }
+ "int" or "number" or "integer" or "smallint" => "int",
+ "bigint" => "long",
+ "tinyint" => "byte",
+ "numeric" or "real" or "float" => "float",
+ "decimal" or "numer(8,2)" => "decimal",
+ "bit" => "bool",
+ "date" or "datetime" or "datetime2" or "smalldatetime" => "DateTime",
+ "money" or "smallmoney" => "double",
+ _ => "string",
+ };
return sTempDatatype;
}
public static bool IsNumber(string tableDataType)
{
string[] arr = new string[] { "int", "long" };
- return arr.Any(f => f.Contains(GetPropertyDatatype(tableDataType)));
+ return arr.Any(f => f.Contains(GetCSharpDatatype(tableDataType)));
}
}
}
diff --git a/ZR.Repository/DbProvider/SugarDbContext.cs b/ZR.Repository/DbProvider/SugarDbContext.cs
index 6919f16..69fee4e 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);
- string dbType = ConfigUtils.Instance.GetConnectionStrings(OptionsSetting.DbType);
+ int dbType = ConfigUtils.Instance.GetAppConfig(OptionsSetting.ConnDbType);
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)Convert.ToInt32(dbType),
+ DbType = (DbType)dbType,
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
ConfigId = 0
diff --git a/ZR.Vue/src/api/gendemo.js b/ZR.Vue/src/api/gendemo.js
index a7c6c3d..4b11f92 100644
--- a/ZR.Vue/src/api/gendemo.js
+++ b/ZR.Vue/src/api/gendemo.js
@@ -1,19 +1,19 @@
import request from '@/utils/request'
/**
- * 分页查询
+ * 测试分页查询
* @param {查询条件} data
*/
-export function listGendemo(data) {
+export function listGendemo(query) {
return request({
- url: '/bus/Gendemo/list',
+ url: 'bus/Gendemo/list',
method: 'get',
- params: data,
+ params: query,
})
}
/**
- * 新增
+ * 新增测试
* @param data
*/
export function addGendemo(data) {
@@ -25,7 +25,7 @@ export function addGendemo(data) {
}
/**
- * 修改
+ * 修改测试
* @param data
*/
export function updateGendemo(data) {
@@ -37,8 +37,8 @@ export function updateGendemo(data) {
}
/**
- * 获取详情
- * @param {Id} Id
+ * 获取测试详情
+ * @param {Id} 测试Id
*/
export function getGendemo(id) {
return request({
diff --git a/ZR.Vue/src/router/index.js b/ZR.Vue/src/router/index.js
index be3e867..cd682e2 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/userInfo/index'], resolve),
+ hidden: true
+ },
{
path: '/404',
component: (resolve) => require(['@/views/error/404'], resolve),
diff --git a/ZR.Vue/src/views/gendemo/index.vue b/ZR.Vue/src/views/gendemo/index.vue
index 8bb4ec9..62b2748 100644
--- a/ZR.Vue/src/views/gendemo/index.vue
+++ b/ZR.Vue/src/views/gendemo/index.vue
@@ -1,279 +1,271 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
-
- 新增
-
-
- 修改
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 编辑
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZRAdmin.xml b/ZRAdmin.xml
index 0ab974f..0c37c99 100644
--- a/ZRAdmin.xml
+++ b/ZRAdmin.xml
@@ -27,44 +27,44 @@
-
+
代码自动生成
-
+
- 测试接口
+ 用户信息接口
-
+
- 查询测试列表
+ 查询用户信息列表
-
+
- 查询测试详情
+ 查询用户信息详情
-
+
-
+
- 添加测试
+ 添加用户信息
-
+
- 更新测试
+ 更新用户信息
-
+
- 删除测试
+ 删除用户信息
@@ -127,7 +127,7 @@
- 代码生成保存
+ 修改保存代码生成业务
@@ -792,47 +792,6 @@
-
-
- T4代码自动生成
-
-
-
-
- 文件管理接口
-
-
-
-
- 查询文件管理列表
-
-
-
-
-
- 查询文件管理详情
-
-
-
-
-
-
- 添加文件管理
-
-
-
-
-
- 更新文件管理
-
-
-
-
-
- 删除文件管理
-
-
-
HttpContext扩展类
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index e8f5ea5..720e652 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -253,13 +253,15 @@ INSERT INTO sys_menu VALUES (108, '日志管理', 1, 9, 'log', '', 0, 0, 'M', '0
INSERT INTO sys_menu VALUES (105, '字典管理', 1, 5, 'dict', 'system/dict/index', 0, 0, 'C', '0', '0', 'system:dict:list', 'dict', '', SYSDATE(), '', NULL, '');
INSERT INTO sys_menu VALUES (106, '分配用户', 1, 3, 'roleusers', 'system/roleusers/index', 0, 0, 'C', '0', '0', 'system:role:list', 'people', '', SYSDATE(), '', NULL, NULL);
+-- 一级菜单 缓存监控
+INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 0, 0, 'C', '1', '1', 'monitor:cache:list', 'redis', '', SYSDATE(), '', NULL, '缓存监控菜单');
+
-- 一级菜单 系统工具
INSERT INTO sys_menu VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', 0, 0, 'C', '0', '0', 'tool:build:list', 'build', '', SYSDATE(), '', NULL, '表单构建菜单');
INSERT INTO sys_menu VALUES (115, '代码生成', 3, 1, 'gen', 'tool/gen/index', 0, 0, 'C', '0', '0', 'tool:gen:list', 'code', '', SYSDATE(), '', NULL, '代码生成菜单');
INSERT INTO sys_menu VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', '', SYSDATE(), '', NULL, '系统接口菜单');
+INSERT INTO sys_menu VALUES (117, '编辑表格', 3, 3, 'editTable', 'tool/gen/editTable', 0, 0, 'C', '1', '0', 'tool:gen:edittable', '', '', SYSDATE(), '', NULL, '代码生成编辑表格菜单');
--- 一级菜单 缓存监控
-INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 0, 0, 'C', '1', '1', 'monitor:cache:list', 'redis', '', SYSDATE(), '', NULL, '缓存监控菜单');
-- 日志管理
INSERT INTO sys_menu VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', 0, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', '', SYSDATE(), '', NULL, '操作日志菜单');
@@ -633,30 +635,32 @@ create table gen_table (
-- 19、代码生成业务表字段
-- ----------------------------
drop table if exists gen_table_column;
-create table gen_table_column (
- columnId bigint(20) not null auto_increment comment '编号',
- tableId varchar(64) comment '归属表编号',
- tableName varchar(20) comment '表名',
- columnName varchar(200) comment '列名称',
- columnComment varchar(500) comment '列描述',
- columnType varchar(100) comment '列类型',
- csharpType varchar(500) comment 'JAVA类型',
- csharpField varchar(200) comment 'JAVA字段名',
- isPk char(1) comment '是否主键(1是)',
- isIncrement char(1) comment '是否自增(1是)',
- isRequired char(1) comment '是否必填(1是)',
- isInsert char(1) comment '是否为插入字段(1是)',
- isEdit char(1) comment '是否编辑字段(1是)',
- isList char(1) comment '是否列表字段(1是)',
- isQuery char(1) comment '是否查询字段(1是)',
- queryType varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
- htmlType varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
- dictType varchar(200) default '' comment '字典类型',
- sort int comment '排序',
- create_by varchar(64) default '' comment '创建者',
- create_time datetime comment '创建时间',
- update_by varchar(64) default '' comment '更新者',
- update_time datetime comment '更新时间',
- remark varchar(200),
- primary key (column_id)
-) engine=innodb auto_increment=1 comment = '代码生成业务表字段';
\ No newline at end of file
+CREATE TABLE `gen_table_column` (
+ `columnId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
+ `tableName` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表名',
+ `tableId` bigint(20) NULL DEFAULT NULL COMMENT '归属表编号',
+ `columnName` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '列名称',
+ `columnComment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '列描述',
+ `columnType` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '列类型',
+ `csharpType` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'C#类型',
+ `csharpField` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'C#字段名',
+ `isPk` tinyint(1) NULL DEFAULT NULL COMMENT '是否主键(1是)',
+ `isIncrement` tinyint(1) NULL DEFAULT NULL COMMENT '是否自增(1是)',
+ `isRequired` tinyint(1) NULL DEFAULT NULL COMMENT '是否必填(1是)',
+ `isInsert` tinyint(1) NULL DEFAULT NULL COMMENT '是否为插入字段(1是)',
+ `isEdit` tinyint(1) NULL DEFAULT NULL COMMENT '是否编辑字段(1是)',
+ `isList` tinyint(1) NULL DEFAULT NULL COMMENT '是否列表字段(1是)',
+ `isQuery` tinyint(4) NULL DEFAULT NULL COMMENT '是否查询字段(1是)',
+ `queryType` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)',
+ `htmlType` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
+ `dictType` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型',
+ `sort` int(11) NULL DEFAULT NULL COMMENT '排序',
+ `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
+ `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
+ `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`columnId`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 63 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index 30a7332..28ac3d6 100644
Binary files a/document/admin-sqlserver.sql and b/document/admin-sqlserver.sql differ