Browse Source

修改bug

yjp 11 months ago
parent
commit
528656f242
2 changed files with 8 additions and 6 deletions
  1. 7 5
      sql/parse_table_row.go
  2. 1 1
      sql/sql_tpl/value.go

+ 7 - 5
sql/parse_table_row.go

@@ -142,12 +142,14 @@ func formOutputEntity(tableRow map[string]any, outputEntity any) error {
 
 					strValue = parsedTime.Format(element.ParseTime)
 				} else if strutils.IsStringNotEmpty(element.AESKey) {
-					decryptedValue, err := encoding.AESDecrypt(strValue, element.AESKey)
-					if err != nil {
-						return err
-					}
+					if strutils.IsStringNotEmpty(strValue) {
+						decryptedValue, err := encoding.AESDecrypt(strValue, element.AESKey)
+						if err != nil {
+							return err
+						}
 
-					strValue = decryptedValue
+						strValue = decryptedValue
+					}
 				}
 
 				err = reflectutils.AssignStringValue(strValue, fieldValue)

+ 1 - 1
sql/sql_tpl/value.go

@@ -18,7 +18,7 @@ type AfterParsedStrValueOption func(strValue string) (string, error)
 func WithAESKey(aesKey string) AfterParsedStrValueOption {
 	return func(strValue string) (string, error) {
 		if strutils.IsStringEmpty(strValue) {
-			return strValue, nil
+			return "''", nil
 		}
 
 		encrypted, err := encoding.AESEncrypt(strValue, aesKey)