From a31f930fff45db997d25b74182ef4ff37492e9ec Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期一, 01 七月 2024 09:18:31 +0800
Subject: [PATCH] 字典查询去除字典类型判断

---
 controllers/dict_controller.go |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/controllers/dict_controller.go b/controllers/dict_controller.go
index 21df86c..7366885 100644
--- a/controllers/dict_controller.go
+++ b/controllers/dict_controller.go
@@ -84,6 +84,7 @@
 	}
 
 	record := models.MiniDict{
+		Type:      params.Type,
 		Name:      params.Name,
 		Value:     params.Value,
 		IsDefault: params.IsDefault,
@@ -190,12 +191,16 @@
 		return
 	}
 
-	if !params.Type.Valid() {
-		util.ResponseFormat(c, code.RequestParamError, "瀛楀吀绫诲瀷閿欒")
-		return
+	//if !params.Type.Valid() {
+	//	util.ResponseFormat(c, code.RequestParamError, "瀛楀吀绫诲瀷閿欒")
+	//	return
+	//}
+	dictSearch := models.NewMiniDictSearch()
+	if params.Type.Valid() {
+		dictSearch.SetType(params.Type)
 	}
 
-	list, total, err := models.NewMiniDictSearch().SetType(params.Type).Find()
+	list, total, err := dictSearch.Find()
 	if err != nil {
 		util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
 		return

--
Gitblit v1.8.0