😎同步升级

This commit is contained in:
zuohuaijun 2024-06-18 01:58:17 +08:00
parent a1b4f39119
commit 24a1c14387
8 changed files with 82 additions and 7 deletions

View File

@ -0,0 +1,45 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace Admin.NET.Core;
/// <summary>
/// 枚举拓展主题样式
/// </summary>
[SuppressSniffer]
[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)]
public class ThemeAttribute : Attribute
{
public string Theme { get; private set; }
public ThemeAttribute(string theme)
{
this.Theme = theme;
}
}
public static class ThemeExtend
{
/// <summary>
/// 扩展方法
/// </summary>
/// <param name="enumValue"></param>
/// <returns></returns>
public static string GetTheme(this Enum enumValue)
{
Type type = enumValue.GetType();
FieldInfo field = type.GetField(enumValue.ToString());
if (field.IsDefined(typeof(ThemeAttribute), true))
{
var themeAttribute = (ThemeAttribute)field.GetCustomAttribute(typeof(ThemeAttribute));
return themeAttribute.Theme;
}
else
{
return string.Empty;
}
}
}

View File

@ -1,4 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
@ -166,6 +166,17 @@ public static class EnumExtension
?.GetCustomAttribute<DescriptionAttribute>()?.Description;
}
/// <summary>
/// 获取枚举的Theme
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string GetTheme(this object value)
{
return value.GetType().GetMember(value.ToString() ?? string.Empty).FirstOrDefault()
?.GetCustomAttribute<ThemeAttribute>()?.Theme;
}
/// <summary>
/// 将枚举转成枚举信息集合
/// </summary>
@ -183,6 +194,7 @@ public static class EnumExtension
{
Name = item.ToString(),
Describe = item.GetDescription() ?? item.ToString(),
Theme = item.GetTheme() ?? string.Empty,
Value = item.GetHashCode()
};
}).ToList();
@ -213,6 +225,11 @@ public class EnumEntity
/// </summary>
public string Describe { set; get; }
/// <summary>
/// 枚举的样式
/// </summary>
public string Theme { set; get; }
/// <summary>
/// 枚举名称
/// </summary>

View File

@ -112,7 +112,7 @@ public class SysCodeGenConfigService : IDynamicApiController, ITransient
codeGenConfig.PropertyName = tableColumn.PropertyName;// 实体属性名
codeGenConfig.ColumnLength = tableColumn.ColumnLength;// 长度
codeGenConfig.ColumnComment = tableColumn.ColumnComment;
codeGenConfig.NetType = tableColumn.DataType;
codeGenConfig.NetType = tableColumn.NetType;
codeGenConfig.WhetherRetract = YesNoEnum.N.ToString();
// 生成代码时,主键并不是必要输入项,故一定要排除主键字段

View File

@ -383,8 +383,10 @@ public static class SqlSugarSetup
db.DbMaintenance.CreateDatabase();
// 初始化租户库表结构-获取所有业务应用表(排除系统表、日志表、特定库表)
var entityTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false) &&
!u.IsDefined(typeof(SysTableAttribute), false) && !u.IsDefined(typeof(LogTableAttribute), false) && !u.IsDefined(typeof(TenantAttribute), false)).ToList();
var entityTypes = App.EffectiveTypes
.Where(u => !u.GetCustomAttributes<IgnoreTableAttribute>().Any())
.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false) &&
!u.IsDefined(typeof(SysTableAttribute), false) && !u.IsDefined(typeof(LogTableAttribute), false) && !u.IsDefined(typeof(TenantAttribute), false)).ToList();
if (!entityTypes.Any()) return;
foreach (var entityType in entityTypes)

View File

@ -242,7 +242,7 @@ public static class CodeGenUtil
"bit" => "bool",
"money" or "smallmoney" or "numeric" or "decimal" => "decimal",
"real" => "Single",
"datetime" or "smalldatetime" => "DateTime",
"datetime" or "datetime2" or "smalldatetime" => "DateTime",
"float" or "double" => "double",
"image" or "binary" or "varbinary" => "byte[]",
"uniqueidentifier" => "Guid",

View File

@ -219,7 +219,7 @@
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
@:import { codeToName, getConstType } from "/@@/utils/constHelper";
}
@if(@Model.TableField.Any(x=>x.EffectType == "Select")){
@if(@Model.TableField.Any(x=>x.EffectType == "Select") || @Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
@:import { getDictDataItem as di, getDictDataList as dl } from '/@@/utils/dict-utils';
}
@if(@Model.TableField.Any(x=>x.EffectType == "EnumSelector")){

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-model="state.dialogVisible" draggable :close-on-click-modal="false" :width="state.width + 8 + 'mm'">
<el-dialog v-model="state.dialogVisible" draggable :close-on-click-modal="false" :width="Number(state.width) + Number(8) + 'mm'">
<div id="preview_content" ref="previewContentRef"></div>
<template #footer>
<el-button :loading="state.waitShowPrinter" type="primary" icon="ele-Printer" @click.stop="print">直接打印</el-button>

11
一键净化项目.bat Normal file
View File

@ -0,0 +1,11 @@
@echo OFF
:begin
REM 删除前端文件及文件夹
DEL /f /s /q ".\Web\node_modules\*.*"
RD /s /q ".\Web\node_modules"
REM 循环删除指定文件夹下的文件夹
FOR /d /r ".\Admin.NET\" %%b in (bin,obj,public) do rd /s /q "%%b"
ECHO 【处理完毕,按任意键退出】
PAUSE>NUL
EXIT
GOTO BEGIN