Bläddra i källkod

feature(权限): 权限优化

ZZH-wl 2 år sedan
förälder
incheckning
02629ea135

+ 10 - 8
opms_parent/app/dao/base/internal/base_distributor.go

@@ -872,15 +872,17 @@ func (d *BaseDistributorDao) checkColumnsName(dataScope map[string]interface{},
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	for k, v := range dataScope {
-		if data, ok := colsContrast[k]; ok {
-			dataScope[data.(string)] = v
+	if specialFlag && len(args) == 1 {
+		for k, v := range dataScope {
+			if data, ok := colsContrast[k]; ok {
+				dataScope[data.(string)] = v
+			}
+			delete(dataScope, k)
+			delete(colsContrast, k)
+		}
+		for k, v := range colsContrast {
+			dataScope[k] = v
 		}
-		delete(dataScope, k)
-		delete(colsContrast, k)
-	}
-	for k, v := range colsContrast {
-		dataScope[k] = v
 	}
 	return specialFlag, userCols, orColsMap
 }

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_contact.go

@@ -820,7 +820,7 @@ func (d *BaseDistributorContactDao) checkColumnsName(dataScope map[string]interf
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_dynamics.go

@@ -814,7 +814,7 @@ func (d *BaseDistributorDynamicsDao) checkColumnsName(dataScope map[string]inter
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_record.go

@@ -829,7 +829,7 @@ func (d *BaseDistributorRecordDao) checkColumnsName(dataScope map[string]interfa
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_target.go

@@ -817,7 +817,7 @@ func (d *BaseDistributorTargetDao) checkColumnsName(dataScope map[string]interfa
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 12 - 0
opms_parent/app/dao/contract/internal/ctr_contract.go

@@ -8,6 +8,7 @@ import (
 	"context"
 	"database/sql"
 	"fmt"
+	"github.com/gogf/gf/text/gstr"
 	"strings"
 	"time"
 
@@ -905,5 +906,16 @@ func (d *CtrContractDao) checkColumnsName(dataScope map[string]interface{}, args
 			dataScope[k] = v
 		}
 	}
+	if tableAs != "" && len(dataScope) > 0 {
+		specialFlag = true
+		for k, v := range dataScope {
+			if gstr.HasPrefix(k, tableAs) {
+				continue
+			}
+			dataScope[tableAs+k] = v
+			delete(dataScope, k)
+		}
+	}
+
 	return specialFlag, userCols, orColsMap
 }

+ 8 - 6
opms_parent/app/dao/work/internal/work_order.go

@@ -839,13 +839,15 @@ func (d *WorkOrderDao) checkColumnsName(dataScope map[string]interface{}, args .
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
 	if specialFlag && len(args) == 1 {
-		for k, v := range colsContrast {
-			if data, ok := dataScope[k]; ok {
-				dataScope[v.(string)] = data
-				delete(dataScope, k)
-			} else {
-				dataScope[k] = v
+		for k, v := range dataScope {
+			if data, ok := colsContrast[k]; ok {
+				dataScope[data.(string)] = v
 			}
+			delete(dataScope, k)
+			delete(colsContrast, k)
+		}
+		for k, v := range colsContrast {
+			dataScope[k] = v
 		}
 	}
 	return specialFlag, userCols, orColsMap