添加可空标识

This commit is contained in:
2248356998 qq.com
2025-07-19 13:35:55 +08:00
parent 8e35c16edf
commit 048abfae2e
14 changed files with 101 additions and 49 deletions

View File

@@ -170,14 +170,14 @@ public class SysUser : BaseEntity
/// </summary>
[SugarColumn(IsIgnore = true, IsJson = true)]
[AutoGenerateColumn(Ignore = true)]
public List<long> OrgAndPosIdList { get; set; } = new List<long>();
public List<long>? OrgAndPosIdList { get; set; } = new List<long>();
/// <summary>
/// 主管信息
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public UserSelectorOutput DirectorInfo { get; set; }
public UserSelectorOutput? DirectorInfo { get; set; }
#endregion
@@ -188,35 +188,35 @@ public class SysUser : BaseEntity
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public Dictionary<string, List<string>> ButtonCodeList { get; set; } = new();
public Dictionary<string, List<string>>? ButtonCodeList { get; set; } = new();
/// <summary>
/// 权限码集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<string> PermissionCodeList { get; set; } = new();
public HashSet<string>? PermissionCodeList { get; set; } = new();
/// <summary>
/// 角色ID集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<long> RoleIdList { get; set; } = new();
public HashSet<long>? RoleIdList { get; set; } = new();
/// <summary>
/// 机构及以下机构ID集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<long> ScopeOrgChildList { get; set; }
public HashSet<long>? ScopeOrgChildList { get; set; }
/// <summary>
/// 模块集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public List<SysResource> ModuleList { get; set; } = new();
public List<SysResource>? ModuleList { get; set; } = new();
/// <summary>
/// 租户Id

View File

@@ -58,7 +58,7 @@ public class LoginOutput
/// <summary>
/// 模块列表
/// </summary>
public IEnumerable<SysResource> ModuleList { get; set; } = Enumerable.Empty<SysResource>();
public IEnumerable<SysResource>? ModuleList { get; set; } = Enumerable.Empty<SysResource>();
/// <summary>
/// 刷新Token

View File

@@ -15,17 +15,17 @@ public class AppConfig
/// <summary>
/// 登录策略
/// </summary>
public LoginPolicy LoginPolicy { get; set; }
public LoginPolicy? LoginPolicy { get; set; }
/// <summary>
/// 页面策略
/// </summary>
public PagePolicy PagePolicy { get; set; }
public PagePolicy? PagePolicy { get; set; }
/// <summary>
/// 密码策略
/// </summary>
public PasswordPolicy PasswordPolicy { get; set; }
public PasswordPolicy? PasswordPolicy { get; set; }
public WebsitePolicy WebsitePolicy { get; set; }
public WebsitePolicy? WebsitePolicy { get; set; }
}

View File

@@ -15,5 +15,5 @@ public class PagePolicy
/// <summary>
/// 系统默认快捷方式菜单ID列表
/// </summary>
public List<long> Shortcuts { get; set; } = new();
public List<long>? Shortcuts { get; set; } = new();
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<PluginVersion>10.9.44</PluginVersion>
<ProPluginVersion>10.9.44</ProPluginVersion>
<DefaultVersion>10.9.44</DefaultVersion>
<DefaultVersion>10.9.45</DefaultVersion>
<AuthenticationVersion>2.9.20</AuthenticationVersion>
<SourceGeneratorVersion>10.9.20</SourceGeneratorVersion>
<NET8Version>8.0.18</NET8Version>

View File

@@ -43,7 +43,7 @@ public interface IVariable
/// <summary>
/// 数据转换规则
/// </summary>
IThingsGatewayBitConverter ThingsGatewayBitConverter { get; set; }
IThingsGatewayBitConverter? ThingsGatewayBitConverter { get; set; }
/// <summary>
/// 实时值
@@ -53,7 +53,7 @@ public interface IVariable
/// <summary>
/// 打包变量
/// </summary>
IVariableSource VariableSource { get; set; }
IVariableSource? VariableSource { get; set; }
object? RawValue { get; }
void SetNoChangedValue(DateTime dateTime);

View File

@@ -50,7 +50,7 @@ public class VariableClass : IVariable
/// <summary>
/// 数据转换规则
/// </summary>
public virtual IThingsGatewayBitConverter ThingsGatewayBitConverter { get; set; }
public virtual IThingsGatewayBitConverter? ThingsGatewayBitConverter { get; set; }
/// <summary>
/// 实时值
@@ -60,7 +60,7 @@ public class VariableClass : IVariable
/// <summary>
/// IVariableSource
/// </summary>
public IVariableSource VariableSource { get; set; }
public IVariableSource? VariableSource { get; set; }
public object? RawValue { get; private set; }
public void SetNoChangedValue(DateTime dateTime)

View File

@@ -21,7 +21,7 @@ public class PluginInfo
/// 插件文件名称.插件类型名称
/// </summary>
[AutoGenerateColumn(Ignore = true)]
public List<PluginInfo> Children { get; set; } = new();
public List<PluginInfo>? Children { get; set; } = new();
/// <summary>
/// 插件文件名称.插件类型名称

View File

@@ -44,10 +44,10 @@ public partial class VariableRuntime : Variable, IVariable, IDisposable
private object _value;
private object lastSetValue;
private object rawValue;
private DeviceRuntime deviceRuntime;
private IVariableSource variableSource;
private VariableMethod variableMethod;
private IThingsGatewayBitConverter thingsGatewayBitConverter;
private DeviceRuntime? deviceRuntime;
private IVariableSource? variableSource;
private VariableMethod? variableMethod;
private IThingsGatewayBitConverter? thingsGatewayBitConverter;
/// <summary>
/// 设置变量值与时间/质量戳

View File

@@ -114,7 +114,7 @@ public partial class VariableRuntime : Variable, IVariable, IDisposable
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[AutoGenerateColumn(Ignore = true)]
public DeviceRuntime DeviceRuntime { get => deviceRuntime; set => deviceRuntime = value; }
public DeviceRuntime? DeviceRuntime { get => deviceRuntime; set => deviceRuntime = value; }
/// <summary>
/// VariableSource
@@ -123,7 +123,7 @@ public partial class VariableRuntime : Variable, IVariable, IDisposable
[System.Text.Json.Serialization.JsonIgnore]
[MapperIgnore]
[AutoGenerateColumn(Ignore = true)]
public IVariableSource VariableSource { get => variableSource; set => variableSource = value; }
public IVariableSource? VariableSource { get => variableSource; set => variableSource = value; }
/// <summary>
/// VariableMethod
@@ -132,7 +132,7 @@ public partial class VariableRuntime : Variable, IVariable, IDisposable
[System.Text.Json.Serialization.JsonIgnore]
[MapperIgnore]
[AutoGenerateColumn(Ignore = true)]
public VariableMethod VariableMethod { get => variableMethod; set => variableMethod = value; }
public VariableMethod? VariableMethod { get => variableMethod; set => variableMethod = value; }
@@ -142,7 +142,7 @@ public partial class VariableRuntime : Variable, IVariable, IDisposable
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[AutoGenerateColumn(Ignore = true)]
public IThingsGatewayBitConverter ThingsGatewayBitConverter { get => thingsGatewayBitConverter; set => thingsGatewayBitConverter = value; }
public IThingsGatewayBitConverter? ThingsGatewayBitConverter { get => thingsGatewayBitConverter; set => thingsGatewayBitConverter = value; }

View File

@@ -3,7 +3,6 @@
@using Microsoft.Extensions.Localization
@using ThingsGateway.Razor
@inject IHostEnvironment Env
@inject IStringLocalizer<BlazorApp> Localizer
@namespace ThingsGateway.Server
<!DOCTYPE html>
<html lang="en" data-bs-theme='light'>
@@ -22,31 +21,16 @@
<base href="/" />
<title>ThingsGateway</title>
@{
#if !NET8_0
}
<link rel="stylesheet" href=@(Assets[$"_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css"]) />
<link rel="stylesheet" href=@(Assets[$"_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css"]) />
<link rel="stylesheet" href=@(Assets[$"_content/BootstrapBlazor/css/motronic.min.css"]) />
<link rel="stylesheet" href=@(Assets[$"ThingsGateway.Server.styles.css"]) />
<link rel="stylesheet" href=@(Assets[$"{WebsiteConst.DefaultResourceUrl}css/site.css"]) />
<link rel="stylesheet" href=@(Assets[$"{WebsiteConst.DefaultResourceUrl}css/devui.css"]) />
<ImportMap />
@{
#else
}
<link rel="stylesheet" href=@($"_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"_content/BootstrapBlazor/css/motronic.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"ThingsGateway.Server.styles.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"{WebsiteConst.DefaultResourceUrl}css/site.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"{WebsiteConst.DefaultResourceUrl}css/devui.css?v={this.GetType().Assembly.GetName().Version}") />
@{
#endif
}
<Microsoft.AspNetCore.Components.ImportMap />
@* <script src=@($"{WebsiteConst.DefaultResourceUrl}js/theme.js") type="module"></script><!-- 初始主题 --> *@
<!-- PWA Manifest -->
@@ -58,7 +42,7 @@
<body>
<Routes @rendermode="new InteractiveServerRenderMode(false)" />
<ReconnectorOutlet ReconnectInterval="5000" @rendermode="new InteractiveServerRenderMode(false)" />
<ReconnectorOutlet ReconnectInterval="5000" @rendermode="new InteractiveServerRenderMode(false)" />
<BlazorReconnector @rendermode="new InteractiveServerRenderMode(false)" />

View File

@@ -0,0 +1,55 @@
@using BootstrapBlazor.Components
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.Extensions.Localization
@using ThingsGateway.Razor
@inject IHostEnvironment Env
@namespace ThingsGateway.Server
<!DOCTYPE html>
<html lang="en" data-bs-theme='light'>
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="keywords" content="thingsgateway,iot,netcore,blazor">
<meta name="description" content="ThingsGateway边缘采集网关">
<meta name="author" content="Diego">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="favicon.png">
<base href="/" />
<title>ThingsGateway</title>
<link rel="stylesheet" href=@($"_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"_content/BootstrapBlazor/css/motronic.min.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"ThingsGateway.Server.styles.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"{WebsiteConst.DefaultResourceUrl}css/site.css?v={this.GetType().Assembly.GetName().Version}") />
<link rel="stylesheet" href=@($"{WebsiteConst.DefaultResourceUrl}css/devui.css?v={this.GetType().Assembly.GetName().Version}") />
@* <script src=@($"{WebsiteConst.DefaultResourceUrl}js/theme.js") type="module"></script><!-- 初始主题 --> *@
<!-- PWA Manifest -->
<link rel="manifest" href="./manifest.json" />
<HeadOutlet @rendermode="new InteractiveServerRenderMode(false)" />
</head>
<body>
<Routes @rendermode="new InteractiveServerRenderMode(false)" />
<ReconnectorOutlet ReconnectInterval="5000" @rendermode="new InteractiveServerRenderMode(false)" />
<BlazorReconnector @rendermode="new InteractiveServerRenderMode(false)" />
<script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"></script>
<script src=@($"{WebsiteConst.DefaultResourceUrl}js/culture.js")></script>
<script src="_framework/blazor.web.js"></script>
<!-- PWA Service Worker -->
<script type="text/javascript">'serviceWorker' in navigator && navigator.serviceWorker.register('./service-worker.js')</script>
<script src="pwa-install.js"></script>
</body>
</html>

View File

@@ -94,10 +94,14 @@ public class Program
})
.Configure(app =>
{
#if NET8_0_OR_GREATER
#if NET9_0_OR_GREATER
app.MapRazorComponents<BlazorApp>()
.AddAdditionalAssemblies(App.RazorAssemblies.Distinct().Where(a => a != typeof(Program).Assembly).ToArray())
.AddInteractiveServerRenderMode();
#elif NET8_0_OR_GREATER
app.MapRazorComponents<BlazorAppNet8>()
.AddAdditionalAssemblies(App.RazorAssemblies.Distinct().Where(a => a != typeof(Program).Assembly).ToArray())
.AddInteractiveServerRenderMode();
#else
app.MapBlazorHub();

View File

@@ -80,17 +80,27 @@
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Layout\BlazorApp.razor" />
<None Include="Layout\BlazorAppNet8.razor" />
</ItemGroup>
<!--安装服务守护-->
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<Content Remove="Layout\BlazorApp.razor" />
<Content Update="Layout\BlazorAppNet8.razor" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="$(NET9Version)" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="$(NET9Version)" />
<Content Remove="Layout\BlazorAppNet8.razor" />
<Content Update="Layout\BlazorApp.razor" />
</ItemGroup>
@@ -143,5 +153,4 @@
</Project>