From 6f8074a182c9ee36c9972935b4442ef70711b465 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期二, 12 八月 2025 10:08:36 +0800
Subject: [PATCH] fix:bug

---
 FlexJobApi.CommonServer.Application/Dictionaries/Queries/DictionaryDatasQueryHandler.cs  |   11 +++++++++--
 FlexJobApi.Core/Models/CommonServer/Dictionaries/Queries/GetDictionaryDataSelectQuery.cs |    2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/FlexJobApi.CommonServer.Application/Dictionaries/Queries/DictionaryDatasQueryHandler.cs b/FlexJobApi.CommonServer.Application/Dictionaries/Queries/DictionaryDatasQueryHandler.cs
index 7320af0..002d01e 100644
--- a/FlexJobApi.CommonServer.Application/Dictionaries/Queries/DictionaryDatasQueryHandler.cs
+++ b/FlexJobApi.CommonServer.Application/Dictionaries/Queries/DictionaryDatasQueryHandler.cs
@@ -81,7 +81,14 @@
 WHERE d.IsDisabled = 0";
             if (request.All != true)
             {
-                sql += " AND d.ParentId = @ParentId";
+                if (request.ParentId == null)
+                {
+                    sql += " AND d.ParentId IS NULL";
+                }
+                else
+                {
+                    sql += " AND d.ParentId = @ParentId";
+                }
             }
             if (request.MaxDeep.HasValue)
             {
@@ -120,7 +127,7 @@
                 option.Label = model.Content;
                 options.Add(option);
             }
-            if (request.WithChildren)
+            if (request.WithChildren == true)
             {
                 var parents = options.Where(it => it.Data.ParentId == null).ToList();
                 LoopChildrens(parents, options);
diff --git a/FlexJobApi.Core/Models/CommonServer/Dictionaries/Queries/GetDictionaryDataSelectQuery.cs b/FlexJobApi.Core/Models/CommonServer/Dictionaries/Queries/GetDictionaryDataSelectQuery.cs
index ff318ea..3de0650 100644
--- a/FlexJobApi.Core/Models/CommonServer/Dictionaries/Queries/GetDictionaryDataSelectQuery.cs
+++ b/FlexJobApi.Core/Models/CommonServer/Dictionaries/Queries/GetDictionaryDataSelectQuery.cs
@@ -46,7 +46,7 @@
         /// <summary>
         /// 鎼哄甫涓嬬骇
         /// </summary>
-        public bool WithChildren { get; set; }
+        public bool? WithChildren { get; set; }
     }
 
     public class GetDictionaryDataSelectQueryResultOption

--
Gitblit v1.9.1