Browse Source

修改bug

yjp 1 năm trước cách đây
mục cha
commit
3ba29943f1

+ 11 - 3
convenient/domain/configuration/api.go

@@ -49,12 +49,20 @@ func BindConfiguration(binder *binding.Binder, opts ...Option) {
 				}, fserr.New("传递的实体不是该领域的实体")
 			}
 
+			conditions := sql.NewConditions()
+
+			if strutils.IsStringNotEmpty(e.Scope) {
+				conditions.Equal(ColumnScope, e.Scope)
+			}
+
+			if strutils.IsStringNotEmpty(e.Group) {
+				conditions.Equal(ColumnGroup, e.Group)
+			}
+
 			results, _, err := database.Query(dbExecutor, &sql.QueryExecuteParams{
 				TableName:     configurationTableName,
 				SelectColumns: []string{ColumnValue},
-				Conditions: sql.NewConditions().
-					Equal(ColumnScope, e.Scope).
-					Equal(ColumnGroup, e.Group),
+				Conditions:    conditions,
 			})
 			if err != nil {
 				return map[string]any{

+ 1 - 1
examples/examples/configuration/main.go

@@ -11,7 +11,7 @@ import (
 )
 
 // curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test", "value":"test-value"}' "http://localhost:10100/test/v1/configuration/create"
-// curl -X GET "http://localhost:10100/test/v1/configuration/values?group=test&pageNo=1&pageSize=1"
+// curl -X GET "http://localhost:10100/test/v1/configuration/values?scope=global&group=test&pageNo=1&pageSize=1"
 // curl -X POST -H "Content-Type: application/json" -d '{"scope": "global", "group":"test"}' "http://localhost:10100/test/v1/configuration/delete"
 
 func main() {