😎 优化代码生成相关代码

This commit is contained in:
zuohuaijun 2024-08-20 21:01:15 +08:00
parent de7be3dd64
commit 30082e0084
7 changed files with 29 additions and 29 deletions

View File

@ -39,7 +39,7 @@
<PackageReference Include="SqlSugarCore" Version="5.1.4.167" /> <PackageReference Include="SqlSugarCore" Version="5.1.4.167" />
<PackageReference Include="SSH.NET" Version="2024.1.0" /> <PackageReference Include="SSH.NET" Version="2024.1.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.4" /> <PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.4" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1071" /> <PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1072" />
<PackageReference Include="UAParser" Version="3.1.47" /> <PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" /> <PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup> </ItemGroup>

View File

@ -7,9 +7,9 @@
namespace Admin.NET.Core; namespace Admin.NET.Core;
/// <summary> /// <summary>
/// 代码生成模板配置 /// 代码生成模板配置
/// </summary> /// </summary>
[SugarTable(null, "代码生成模板配置")] [SugarTable(null, "代码生成模板配置")]
[SysTable] [SysTable]
public partial class SysCodeGenTemplate : EntityBase public partial class SysCodeGenTemplate : EntityBase
{ {
@ -21,27 +21,29 @@ public partial class SysCodeGenTemplate : EntityBase
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 是否是内置模板Y-是N-否) /// 代码生成类型
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "是否是内置模板")] [SugarColumn(ColumnDescription = "代码生成类型")]
public CodeGenTypeEnum Type { get; set; } public CodeGenTypeEnum Type { get; set; } = CodeGenTypeEnum.Backend;
/// <summary> /// <summary>
/// 是否是内置模板Y-是N-否) /// 是否是内置模板Y-是N-否)
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "是否是内置模板")] [SugarColumn(ColumnDescription = "是否是内置模板")]
public YesNoEnum SysFlag { get; set; } public YesNoEnum SysFlag { get; set; } = YesNoEnum.Y;
/// <summary> /// <summary>
/// 输出位置 /// 输出位置
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "输出位置", Length = 256)] [SugarColumn(ColumnDescription = "输出位置", Length = 256)]
[Required, MaxLength(256)]
public string OutputFile { get; set; } public string OutputFile { get; set; }
/// <summary> /// <summary>
/// 描述 /// 描述
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "描述", Length = 200)] [SugarColumn(ColumnDescription = "描述", Length = 256)]
[Required, MaxLength(256)]
public string Describe { get; set; } public string Describe { get; set; }
/// <summary> /// <summary>

View File

@ -7,7 +7,7 @@
namespace Admin.NET.Core; namespace Admin.NET.Core;
/// <summary> /// <summary>
/// 系统配置表种子数据 /// 代码生成模板配置表种子数据
/// </summary> /// </summary>
public class SysCodeGenTemplateSeedData : ISqlSugarEntitySeedData<SysCodeGenTemplate> public class SysCodeGenTemplateSeedData : ISqlSugarEntitySeedData<SysCodeGenTemplate>
{ {

View File

@ -4,8 +4,6 @@
// //
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Elastic.Clients.Elasticsearch.MachineLearning;
namespace Admin.NET.Core.Service; namespace Admin.NET.Core.Service;
/// <summary> /// <summary>

View File

@ -383,7 +383,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
{ {
tmpPath = templateList[i].Type == CodeGenTypeEnum.Frontend ? Path.Combine(outputPath, _codeGenOptions.FrontRootPath, "src") : Path.Combine(outputPath, input!.NameSpace!); tmpPath = templateList[i].Type == CodeGenTypeEnum.Frontend ? Path.Combine(outputPath, _codeGenOptions.FrontRootPath, "src") : Path.Combine(outputPath, input!.NameSpace!);
} }
targetFile = Path.Combine( tmpPath, targetFile); targetFile = Path.Combine(tmpPath, targetFile);
var dirPath = new DirectoryInfo(targetFile).Parent!.FullName; var dirPath = new DirectoryInfo(targetFile).Parent!.FullName;
if (!Directory.Exists(dirPath)) if (!Directory.Exists(dirPath))