TANG JIANG 1 vuosi sitten
vanhempi
commit
fb37e1054d

+ 1 - 0
src/Sharing.Api/Controllers/HotlineMessageReceiveController.cs

@@ -465,6 +465,7 @@ namespace Sharing.Api.Controllers
         [CapSubscribe(Hotline.Share.Mq.EventNames.HotlineOrderVisited)]
         public async Task SubmitVisitInfo(PublishVisitDto dto)
         {
+          //  dto.Order.ProvinceNo = dto.Order.No;
             //如果不是省上派下来的工单,走服务工单评价接口,是省上下来的工单走服务工单交办评价接口
             if (dto.Order.Source != ESource.ProvinceStraight && dto.Order.IsProvince == false)
                 await _provinceService.SubmitVisitInfo(dto);

+ 12 - 5
src/Sharing.Repository/Extensions/SqlSugarStartupExtensions.cs

@@ -3,6 +3,7 @@ using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
 using System.Linq.Dynamic.Core;
 using System.Linq.Expressions;
+using System.Reflection;
 using Microsoft.EntityFrameworkCore.Metadata;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
@@ -60,11 +61,11 @@ namespace Sharing.Repository.Extensions
                         //{
                         //    column.IsIgnore = true;
                         //}
-                        if (property.PropertyType.IsGenericType &&
-                            property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
-                        {
-                            column.IsNullable = true;
-                        }
+                        //if (property.PropertyType.IsGenericType &&
+                        //    property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
+                        //{
+                        //    column.IsNullable = true;
+                        //}
 
                         if (column.PropertyName.ToLower() == "id" ||
                             attributes.Any(it => it is KeyAttribute)) //是id的设为主键
@@ -77,6 +78,12 @@ namespace Sharing.Repository.Extensions
                         //    column.DbColumnName = UtilMethods.ToUnderLine(column.DbColumnName);//ToUnderLine驼峰转下划线
 
                         //column.ColumnDescription = (attributes.FirstOrDefault(d => d is DescriptionAttribute) as DescriptionAttribute)?.Description ?? string.Empty;
+
+                        //统一设置 nullable等于isnullable=true
+                        if (!column.IsPrimarykey && new NullabilityInfoContext().Create(property).WriteState is NullabilityState.Nullable)
+                        {
+                            column.IsNullable = true;
+                        }
                     },
                     EntityNameService = (type, entity) =>
                     {