xf %!s(int64=2) %!d(string=hai) anos
pai
achega
6c02acea3e

+ 13 - 0
src/Hotline.Api/Controllers/TestController.cs

@@ -98,6 +98,19 @@ public class TestController : BaseController
         _timeLimitApplication = timeLimitApplication;
     }
 
+    [AllowAnonymous]
+    [HttpGet("pgsql")]
+    public async Task<string> Pgsql()
+    {
+        var role = new Role
+        {
+            Name = "test_role",
+            DisplayName = "test_role_display",
+            ClientId = "test"
+        };
+        return await _roleRepository.AddAsync(role, HttpContext.RequestAborted);
+    }
+
     [AllowAnonymous]
     [HttpGet("roles")]
     public async Task<List<Role>> GetRoles()

+ 2 - 1
src/Hotline.Api/appsettings.Development.json

@@ -54,7 +54,8 @@
     "Expired": 86300 //认证过期时间(秒)
   },
   "ConnectionStrings": {
-    "Hotline": "server=192.168.100.121;Database=hotline;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
+    //"Hotline": "server=192.168.100.121;Database=hotline;Uid=dev;Pwd=fengwo11!!;SslMode=none;",
+    "Hotline": " PORT=5432;DATABASE=hotline;HOST=192.168.100.121;PASSWORD=fengwo11!!;USER ID=dev;",
     "Redis": "192.168.100.223:6379",
     "MongoDB": "mongodb://192.168.100.121:27017"
   },

+ 6 - 1
src/Hotline.Repository.SqlSugar/Extensions/SqlSugarStartupExtensions.cs

@@ -26,7 +26,7 @@ namespace Hotline.Repository.SqlSugar.Extensions
 
             SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
             {
-                DbType = DbType.MySql,
+                DbType = DbType.PostgreSQL,
                 ConnectionString = configuration.GetConnectionString(dbName),
                 IsAutoCloseConnection = true,
                 ConfigureExternalServices = new ConfigureExternalServices
@@ -98,6 +98,11 @@ namespace Hotline.Repository.SqlSugar.Extensions
                                 .Description;
                         }
                     }
+                },
+                MoreSettings = new ConnMoreSettings
+                {
+                    PgSqlIsAutoToLower = false,//增删查改支持驼峰表
+                    PgSqlIsAutoToLowerCodeFirst = false, // 建表建驼峰表。5.1.3.30 
                 }
             },
                 SetDbAop

+ 1 - 1
src/Hotline/CallCenter/Ivrs/Ivr.cs

@@ -70,7 +70,7 @@ public class Ivr : CreationEntity
     /// <summary>
     /// IVR策略
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<IvrStrategy> IvrStrategies { get; set; } = new();
 
     [SugarColumn(IsIgnore = true)]

+ 2 - 2
src/Hotline/FlowEngine/Definitions/Definition.cs

@@ -26,10 +26,10 @@ public class Definition : CreationEntity
     [SugarColumn(IsNullable = true)]
     public string? Description { get; set; }
 
-    [SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<StepDefine> Steps { get; set; } = new();
 
-    [SugarColumn(ColumnDataType = "longtext", IsNullable = true)]
+    [SugarColumn(ColumnDataType = "text", IsNullable = true)]
     public string? ExternalData { get; set; }
 
     public EDefinitionStatus Status { get; set; }

+ 3 - 3
src/Hotline/FlowEngine/Workflows/StepBasicEntity.cs

@@ -30,7 +30,7 @@ public class StepBasicEntity : CreationEntity
     /// 根据类型可能为:roles, depLevels, depTypes, depCodes, userIds
     /// </example>
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<IdName> HandlerClassifies { get; set; } = new();
 
     /// <summary>
@@ -46,7 +46,7 @@ public class StepBasicEntity : CreationEntity
     /// 部门等级/分类为:orgCodes, 角色为:userIds
     /// </example>
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<IdName> NextHandlers { get; set; } = new();
 
     /// <summary>
@@ -74,7 +74,7 @@ public class StepBasicEntity : CreationEntity
     /// <summary>
     /// 附件
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> Additions { get; set; } = new();
 
     #endregion

+ 2 - 2
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -78,13 +78,13 @@ public class Workflow : CreationEntity
     /// <summary>
     /// 办理人id
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> HandlerUsers { get; set; } = new();
 
     /// <summary>
     /// 办理部门code
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> HandlerOrgs { get; set; } = new();
 
     /// <summary>

+ 2 - 2
src/Hotline/FlowEngine/Workflows/WorkflowStep.cs

@@ -5,14 +5,14 @@ namespace Hotline.FlowEngine.Workflows;
 
 public class WorkflowStep : StepBasicEntity
 {
-    [SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<NextStep> NextSteps { get; set; }
 
     /// <summary>
     /// 被指派办理对象(依据不同指派方式可能为:depCode或userId),该字段subStep才会存在,stepBox不存在
     /// 改为list,兼容多个办理对象可以办理同一个节点的场景
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> HandlerIds { get; set; } = new();
 
     /// <summary>

+ 1 - 1
src/Hotline/FlowEngine/Workflows/WorkflowSupplement.cs

@@ -20,7 +20,7 @@ public class WorkflowSupplement : CreationEntity
     /// <summary>
     /// 附件
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> Additions { get; set; } = new();
 
     [Navigate(NavigateType.OneToOne, nameof(CreatorId))]

+ 3 - 3
src/Hotline/KnowledgeBase/Knowledge.cs

@@ -41,7 +41,7 @@ public class Knowledge : WorkflowEntity//   WorkflowEntity  FullStateEntity
     /// <summary>
     /// 内容
     /// </summary>
-    [SugarColumn(ColumnDataType = "longtext")]
+    [SugarColumn(ColumnDataType = "text")]
     public string Content { get; set; }
 
     /// <summary>
@@ -94,13 +94,13 @@ public class Knowledge : WorkflowEntity//   WorkflowEntity  FullStateEntity
     /// <summary>
     /// 附件
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true, IsNullable = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
     public List<string> Additions { get; set; }
 
     /// <summary>
     /// 关联知识
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true,IsNullable =true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true,IsNullable =true)]
     public List<string> Knowledges { get; set; }
 
     /// <summary>

+ 1 - 1
src/Hotline/KnowledgeBase/KnowledgeStandard.cs

@@ -16,7 +16,7 @@ namespace Hotline.KnowledgeBase
         /// <summary>
         /// 内容
         /// </summary>
-        [SugarColumn(ColumnDataType = "longtext")]
+        [SugarColumn(ColumnDataType = "text")]
         public string Content { get; set; }
     }
 }

+ 1 - 1
src/Hotline/Orders/Order.cs

@@ -171,7 +171,7 @@ namespace Hotline.Orders
         /// <summary>
         /// 附件
         /// </summary>
-        [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true)]
         public List<string> Additions { get; set; } = new();
 
         /// <summary>

+ 1 - 1
src/Hotline/Orders/OrderComplain.cs

@@ -45,7 +45,7 @@ public class OrderComplain : OrderExtensionEntity
     /// <summary>
     /// 诉求内容,多选
     /// </summary>
-    [SugarColumn(ColumnDataType = "varchar(600)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<EComplainType> ComplainTypes { get; set; } = new();
 
     #endregion

+ 2 - 2
src/Hotline/Settings/SystemAuthority.cs

@@ -22,13 +22,13 @@ namespace Hotline.Settings
         /// <summary>
         /// 菜单ID
         /// </summary>
-        [SugarColumn(ColumnDataType = "varchar(3000)", IsJson = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true)]
         public List<string> SystemMenuArr { get; set; }
 
         /// <summary>
         /// 功能点
         /// </summary>
-        [SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true)]
         public List<string> SystemButtonArr { get; set; }
 
         public List<string> GetAllPermissions()

+ 3 - 3
src/Hotline/Settings/TimeLimits/TimeLimit.cs

@@ -16,19 +16,19 @@ namespace Hotline.Settings.TimeLimits
 
         public ETimeLimitState TimeLimitState { get; set; }
 
-        [SugarColumn(ColumnDataType = "longtext", IsJson = true, IsNullable = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
         public List<ParamValueModel>? ParamArr { get; set; }
 
         /// <summary>
         /// 排序
         /// </summary>
-        [SugarColumn(ColumnDataType = "longtext", IsJson = true, IsNullable = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
         public List<PriorityModel>? Priority { get; set; }
 
         /// <summary>
         /// 组合
         /// </summary>
-        [SugarColumn(ColumnDataType = "longtext", IsJson = true, IsNullable = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
         public List<CombinationModel>? Combination { get; set; }
 
     }

+ 1 - 1
src/Hotline/Settings/TrunkIvrManager.cs

@@ -38,7 +38,7 @@ namespace Hotline.Settings
         /// <summary>
         /// 工作日
         /// </summary>
-        [SugarColumn(ColumnDataType = "varchar(255)", IsJson = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true)]
         public List<WorkDayModel> WorkDay { get; set; }
 
         /// <summary>

+ 1 - 1
src/Hotline/Settings/UserFastMenu.cs

@@ -17,7 +17,7 @@ namespace Hotline.Settings
         /// <summary>
         /// 快捷菜单集合
         /// </summary>
-        [SugarColumn(ColumnDataType = "varchar(4000)", IsJson = true)]
+        [SugarColumn(ColumnDataType = "json", IsJson = true)]
         public List<string> FastMenuArr { get; set; }
     }
 }

+ 4 - 4
src/XF.Domain.Repository/Entity.cs

@@ -146,10 +146,10 @@ public abstract class WorkflowEntity : FullStateEntity, IWorkflow
     [SugarColumn(IsNullable = true)]
     public string? ExpiredTimeConfigId { get; set; }
 
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> AssignOrgCodes { get; set; } = new();
 
-    [SugarColumn(ColumnDataType = "longtext", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> AssignUserIds { get; set; } = new();
 
     //[SugarColumn(ColumnDataType = "varchar(600)", IsJson = true)]
@@ -241,10 +241,10 @@ public abstract class PositionWorkflowEntity : PositionEntity, IWorkflow
     [SugarColumn(IsNullable = true)]
     public string? ExpiredTimeConfigId { get; set; }
 
-    [SugarColumn(ColumnDataType = "varchar(1000)", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> AssignOrgCodes { get; set; } = new();
 
-    [SugarColumn(ColumnDataType = "longtext", IsJson = true)]
+    [SugarColumn(ColumnDataType = "json", IsJson = true)]
     public List<string> AssignUserIds { get; set; } = new();
 
     //[SugarColumn(ColumnDataType = "varchar(600)", IsJson = true)]