diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index 8e0c2f73..a2e327d7 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -272,7 +272,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers public Result SeedDb() { var rep = _iUserService._repository; - return Result.Success().SetStatus(DbSeedExtend.Invoer(rep._Db)); + return Result.Success().SetStatus(DbSeedExtend.DataInvoer(rep._Db)); } /// diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj index 677bea43..922abba3 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj @@ -43,9 +43,6 @@ Always - - Always - diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json index ec8aa7bb..07cf237d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json @@ -1,5 +1,5 @@ { - "StartUrl": "http://localohost:19001", + "StartUrl": "http://*:19001", "Logging": { "LogLevel": { "Default": "Information", @@ -12,10 +12,13 @@ "SqlLog_Enable": false, "Consul_Enabled": false, + "DbCodeFirst_Enabled": false, + "DbSeed_Enabled": false, "Apollo_Enabled": false, "HealthCheck_Enabled": false, "RabbitMQ_Enabled": false, "Redis_Enabled": false, + "RedisSeed_Enabled": false, "Kafka_Enabled": false, "ElasticSeach_Enabled": false, "MutiDB_Enabled": false, @@ -23,19 +26,16 @@ "CAP_Enabled": false, "CAPDashboard_Enabled": false, - "DbSeed_Enabled": true, - "RedisSeed_Enabled": false, - "Cors_Enabled": true, "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], "DbSelect": "Sqlite", "DbConn": { "WriteUrl": "DataSource=yi-sqlsugar-dev.db", - //"WriteUrl": "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", + //"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "ReadUrl": [ - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020." + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]" ] }, "JwtAuthorize": { @@ -44,39 +44,39 @@ "PolicyName": "permission", "DefaultScheme": "Bearer", "IsHttps": false, - "Expiration": 30, + "Expiration": 300, "ReExpiration": 3000 }, "RedisConnOptions": { - "Host": "118.195.191.41", + "Host": "[xxxx]", "Prot": 6379, "DB": 1, - "Password": "Qz52013142020." + "Password": "[xxxx]" }, "RabbitConn": { - "HostName": "118.195.191.41", - "UserName": "cc", - "Password": "cc", + "HostName": "[xxxx]", + "UserName": "[xxxx]", + "Password": "[xxxx]", "Port": 5672 }, "ElasticSeachConn": { - "Url": "https://es-4zakkyyn.public.tencentelasticsearch.com:9200", - "IndexName": "yies", - "UserName": "elastic", - "PassWord": "Qz52013142020." + "Url": "[xxxx]", + "IndexName": "[xxxx]", + "UserName": "[xxxx]", + "PassWord": "[xxxx]" }, "KafkaOptions": { - "BrokerList": "192.168.3.230:9092", - "TopicName": "kafkalog" + "BrokerList": "[xxxx]", + "TopicName": "[xxxx]" }, "ConsulClientOption": { - "IP": "118.195.191.41", - "Port": "8500", - "Datacenter": "dc1" + "IP": "[xxxx]", + "Port": "[xxxx]", + "Datacenter": "[xxxx]" }, "ConsulRegisterOption": { - "IP": "118.195.191.41", - "Port": "19005", + "IP": "[xxxx]", + "Port": "19001", "GroupName": "ApiMicroservice", "HealthCheckUrl": "/Health", "Interval": 10, @@ -85,10 +85,10 @@ "Tag": "13" }, "SMS": { - "ID": "LTAI5tJvjPaXCyyPMfXLNbVA", - "Secret": "fLQv7jjj57fUKLFK8REeAQPFVDjUYn", - "Sign": "JiftCC", - "Template": "SMS_221640732" + "ID": "[xxxx]", + "Secret": "[xxxx]", + "Sign": "[xxxx]", + "Template": "[xxxx]" }, "IPLibraryServiceUrl": "http://gRPCIPLibraryService" } \ No newline at end of file diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json index fd710b84..07cf237d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json @@ -12,6 +12,7 @@ "SqlLog_Enable": false, "Consul_Enabled": false, + "DbCodeFirst_Enabled": false, "DbSeed_Enabled": false, "Apollo_Enabled": false, "HealthCheck_Enabled": false, @@ -27,23 +28,24 @@ "Cors_Enabled": true, "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], - "DbSelect": "Mysql", - "Pan": { - "ZipPath": "D:/AppWeb/test/zip" - }, - + "DbSelect": "Sqlite", "DbConn": { - "WriteUrl": "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "WriteUrl": "DataSource=yi-sqlsugar-dev.db", + //"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "ReadUrl": [ "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]" ] }, - "JWTTokenOptions": { - "Audience": "http://localhost:7000", - "Issuer": "http://localhost:7000", - "SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB" + "JwtAuthorize": { + "Issuer": "cc", + "Audience": "cc", + "PolicyName": "permission", + "DefaultScheme": "Bearer", + "IsHttps": false, + "Expiration": 300, + "ReExpiration": 3000 }, "RedisConnOptions": { "Host": "[xxxx]", diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json index 0ed84298..07cf237d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json @@ -12,6 +12,7 @@ "SqlLog_Enable": false, "Consul_Enabled": false, + "DbCodeFirst_Enabled": false, "DbSeed_Enabled": false, "Apollo_Enabled": false, "HealthCheck_Enabled": false, diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 7b63d534..ce7018e8 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs index 9f3cbcf4..3d9d7f17 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 文章标题 /// [SugarColumn(ColumnName="Title" )] - public string Title { get; set; } + public string? Title { get; set; } /// /// 文章内容 /// [SugarColumn(ColumnName="Content" )] - public string Content { get; set; } + public string? Content { get; set; } /// /// 用户id /// @@ -72,7 +72,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 图片列表 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs index f41dd6b0..7fd11b35 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs @@ -22,22 +22,22 @@ namespace Yi.Framework.Model.Models /// 配置名称 /// [SugarColumn(ColumnName="ConfigName" )] - public string ConfigName { get; set; } + public string? ConfigName { get; set; } /// /// 配置键 /// [SugarColumn(ColumnName="ConfigKey" )] - public string ConfigKey { get; set; } + public string? ConfigKey { get; set; } /// /// 配置值 /// [SugarColumn(ColumnName="ConfigValue" )] - public string ConfigValue { get; set; } + public string? ConfigValue { get; set; } /// /// 配置类别 /// [SugarColumn(ColumnName="ConfigType" )] - public string ConfigType { get; set; } + public string? ConfigType { get; set; } /// /// 创建者 /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs index c8628796..bfc66554 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs @@ -22,17 +22,17 @@ namespace Yi.Framework.Model.Models /// 部门名称 /// [SugarColumn(ColumnName="DeptName" )] - public string DeptName { get; set; } + public string? DeptName { get; set; } /// /// 部门编码 /// [SugarColumn(ColumnName="DeptCode" )] - public string DeptCode { get; set; } + public string? DeptCode { get; set; } /// /// 负责人 /// [SugarColumn(ColumnName="Leader" )] - public string Leader { get; set; } + public string? Leader { get; set; } /// /// 父级id /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs index c95a26fa..b14c1f02 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 字典名称 /// [SugarColumn(ColumnName="DictName" )] - public string DictName { get; set; } + public string? DictName { get; set; } /// /// 字典类型 /// [SugarColumn(ColumnName="DictType" )] - public string DictType { get; set; } + public string? DictType { get; set; } /// /// 创建者 /// @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs index 57dffa89..c1f7200e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs @@ -22,17 +22,17 @@ namespace Yi.Framework.Model.Models /// 字典类型 /// [SugarColumn(ColumnName="DictType" )] - public string DictType { get; set; } + public string? DictType { get; set; } /// /// 字典标签 /// [SugarColumn(ColumnName="DictLabel" )] - public string DictLabel { get; set; } + public string? DictLabel { get; set; } /// /// 字典值 /// [SugarColumn(ColumnName="DictValue" )] - public string DictValue { get; set; } + public string? DictValue { get; set; } /// /// 是否为该类型的默认值 /// @@ -77,16 +77,16 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// tag类型 /// [SugarColumn(ColumnName="ListClass" )] - public string ListClass { get; set; } + public string? ListClass { get; set; } /// /// tagClass /// [SugarColumn(ColumnName="CssClass" )] - public string CssClass { get; set; } + public string? CssClass { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs index 4f0e5a77..1336abe1 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// 文件类型 /// [SugarColumn(ColumnName="FileType" )] - public string FileType { get; set; } + public string? FileType { get; set; } /// /// 文件大小 /// @@ -32,12 +32,12 @@ namespace Yi.Framework.Model.Models /// 文件名 /// [SugarColumn(ColumnName="FileName" )] - public string FileName { get; set; } + public string? FileName { get; set; } /// /// 文件路径 /// [SugarColumn(ColumnName="FilePath" )] - public string FilePath { get; set; } + public string? FilePath { get; set; } /// /// 创建者 /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs index b7a085b1..e2db6dc9 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs @@ -43,7 +43,7 @@ namespace Yi.Framework.Model.Models /// 消息 /// [SugarColumn(ColumnName="Message" )] - public string Message { get; set; } + public string? Message { get; set; } /// /// 排序字段 /// @@ -53,6 +53,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs index d2165318..9f0dc985 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs @@ -22,32 +22,32 @@ namespace Yi.Framework.Model.Models /// 登录用户 /// [SugarColumn(ColumnName="LoginUser" )] - public string LoginUser { get; set; } + public string? LoginUser { get; set; } /// /// 登录地点 /// [SugarColumn(ColumnName="LoginLocation" )] - public string LoginLocation { get; set; } + public string? LoginLocation { get; set; } /// /// 登录Ip /// [SugarColumn(ColumnName="LoginIp" )] - public string LoginIp { get; set; } + public string? LoginIp { get; set; } /// /// 浏览器 /// [SugarColumn(ColumnName="Browser" )] - public string Browser { get; set; } + public string? Browser { get; set; } /// /// 操作系统 /// [SugarColumn(ColumnName="Os" )] - public string Os { get; set; } + public string? Os { get; set; } /// /// 登录信息 /// [SugarColumn(ColumnName="LogMsg" )] - public string LogMsg { get; set; } + public string? LogMsg { get; set; } /// /// 创建者 /// @@ -82,7 +82,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 是否删除 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs index d10103ad..aeb3c471 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -23,7 +23,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="MenuName" )] - public string MenuName { get; set; } + public string? MenuName { get; set; } /// /// /// @@ -33,7 +33,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="PermissionCode" )] - public string PermissionCode { get; set; } + public string? PermissionCode { get; set; } /// /// /// @@ -73,12 +73,12 @@ namespace Yi.Framework.Model.Models /// 菜单图标 /// [SugarColumn(ColumnName="MenuIcon" )] - public string MenuIcon { get; set; } + public string? MenuIcon { get; set; } /// /// 菜单组件路由 /// [SugarColumn(ColumnName="Router" )] - public string Router { get; set; } + public string? Router { get; set; } /// /// 是否为外部链接 /// @@ -103,16 +103,16 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 组件路径 /// [SugarColumn(ColumnName="Component" )] - public string Component { get; set; } + public string? Component { get; set; } /// /// 路由参数 /// [SugarColumn(ColumnName="Query" )] - public string Query { get; set; } + public string? Query { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs index 183e60a3..3ee911fd 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// 操作模块 /// [SugarColumn(ColumnName="Title" )] - public string Title { get; set; } + public string? Title { get; set; } /// /// 操作类型 /// @@ -32,7 +32,7 @@ namespace Yi.Framework.Model.Models /// 请求方法 /// [SugarColumn(ColumnName="RequestMethod" )] - public string RequestMethod { get; set; } + public string? RequestMethod { get; set; } /// /// 操作人员 /// @@ -42,27 +42,27 @@ namespace Yi.Framework.Model.Models /// 操作Ip /// [SugarColumn(ColumnName="OperIp" )] - public string OperIp { get; set; } + public string? OperIp { get; set; } /// /// 操作地点 /// [SugarColumn(ColumnName="OperLocation" )] - public string OperLocation { get; set; } + public string? OperLocation { get; set; } /// /// 操作方法 /// [SugarColumn(ColumnName="Method" )] - public string Method { get; set; } + public string? Method { get; set; } /// /// 请求参数 /// [SugarColumn(ColumnName="RequestParam" )] - public string RequestParam { get; set; } + public string? RequestParam { get; set; } /// /// 请求结果 /// [SugarColumn(ColumnName="RequestResult" )] - public string RequestResult { get; set; } + public string? RequestResult { get; set; } /// /// 创建者 /// @@ -97,7 +97,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 是否删除 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs index 35e513ca..02564b99 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 岗位编码 /// [SugarColumn(ColumnName="PostCode" )] - public string PostCode { get; set; } + public string? PostCode { get; set; } /// /// 岗位名称 /// [SugarColumn(ColumnName="PostName" )] - public string PostName { get; set; } + public string? PostName { get; set; } /// /// 创建者 /// @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs index a63cc7ab..5a3689c0 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs index 63a36218..e269079b 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs @@ -9,20 +9,20 @@ namespace Yi.Framework.Model.Models /// 角色表 /// [SugarTable("Role")] - public partial class RoleEntity:IBaseModelEntity + public partial class RoleEntity : IBaseModelEntity { public RoleEntity() { this.CreateTime = DateTime.Now; } [JsonConverter(typeof(ValueToStringConverter))] - [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] - public long Id { get; set; } + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] + public long Id { get; set; } /// /// /// - [SugarColumn(ColumnName="RoleName" )] - public string RoleName { get; set; } + [SugarColumn(ColumnName = "RoleName")] + public string? RoleName { get; set; } /// /// 创建者 /// @@ -57,7 +57,7 @@ namespace Yi.Framework.Model.Models /// 角色编码 /// [SugarColumn(ColumnName="RoleCode" )] - public string RoleCode { get; set; } + public string? RoleCode { get; set; } /// /// 排序字段 /// @@ -67,7 +67,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 角色数据范围 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs index 408b15d9..6fe01429 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="TenantName" )] - public string TenantName { get; set; } + public string? TenantName { get; set; } /// /// 创建者 /// @@ -62,6 +62,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs index 70d7731f..ba887c24 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="Name" )] - public string Name { get; set; } + public string? Name { get; set; } /// /// /// @@ -72,42 +72,42 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="Salt" )] - public string Salt { get; set; } + public string? Salt { get; set; } /// /// /// [SugarColumn(ColumnName="Icon" )] - public string Icon { get; set; } + public string? Icon { get; set; } /// /// /// [SugarColumn(ColumnName="Nick" )] - public string Nick { get; set; } + public string? Nick { get; set; } /// /// /// [SugarColumn(ColumnName="Email" )] - public string Email { get; set; } + public string? Email { get; set; } /// /// /// [SugarColumn(ColumnName="Ip" )] - public string Ip { get; set; } + public string? Ip { get; set; } /// /// /// [SugarColumn(ColumnName="Address" )] - public string Address { get; set; } + public string? Address { get; set; } /// /// /// [SugarColumn(ColumnName="Phone" )] - public string Phone { get; set; } + public string? Phone { get; set; } /// /// /// [SugarColumn(ColumnName="Introduction" )] - public string Introduction { get; set; } + public string? Introduction { get; set; } /// /// 排序字段 /// @@ -117,7 +117,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 部门id /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs index ef30ac12..bf737ff6 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj b/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj index 7bc07bb8..03cc9a11 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj +++ b/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj @@ -2,6 +2,7 @@ net6.0 + enable diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs index b1e23a78..8e93a35c 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs @@ -13,7 +13,12 @@ namespace Yi.Framework.WebCore.DbExtend { public static class DbSeedExtend { - public static bool Invoer(ISqlSugarClient _Db) + /// + /// 初始化数据 + /// + /// + /// + public static bool DataInvoer(ISqlSugarClient _Db) { bool res = false; var users = SeedFactory.GetUserSeed(); @@ -87,14 +92,40 @@ namespace Yi.Framework.WebCore.DbExtend return res; } + /// + /// codeFirst初始化表 + /// + /// + /// + public static void TableInvoer(ISqlSugarClient _Db) + { + //创建数据库 + _Db.DbMaintenance.CreateDatabase(); + var typeList = Common.Helper.AssemblyHelper.GetClass("Yi.Framework.Model"); + foreach (var t in typeList) + { + //扫描如果存在SugarTable特性,直接codefirst + if (t.GetCustomAttributes(false).Any(a => a.GetType().Equals(typeof(SugarTable)))) + { + _Db.CodeFirst.SetStringDefaultLength(200).InitTables(t);//这样一个表就能成功创建了 + } + } + + } + public static void UseDbSeedInitService(this IApplicationBuilder app) { + if (Appsettings.appBool("DbCodeFirst_Enabled")) + { + var _Db = app.ApplicationServices.GetRequiredService(); + TableInvoer(_Db); + } if (Appsettings.appBool("DbSeed_Enabled")) { var _Db = app.ApplicationServices.GetRequiredService(); - Invoer(_Db); + DataInvoer(_Db); } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs index b3dd8d1e..42a88bd3 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs @@ -4,6 +4,7 @@ using SqlSugar; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Yi.Framework.Common.Models; @@ -50,9 +51,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend { EntityService = (c, p) => { - // int? decimal?这种 isnullable=true - if (c.PropertyType.IsGenericType && - c.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) + //// int? decimal?这种 isnullable=true + //if (c.PropertyType.IsGenericType && + //c.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) + //{ + // p.IsNullable = true; + //} + + //高版C#写法 支持string?和string + if (new NullabilityInfoContext() + .Create(c).WriteState is NullabilityState.Nullable) { p.IsNullable = true; }