yjp 4 ay önce
ebeveyn
işleme
8aafaca277
1 değiştirilmiş dosya ile 12 ekleme ve 0 silme
  1. 12 0
      convenient/entity_crud/service.go

+ 12 - 0
convenient/entity_crud/service.go

@@ -53,6 +53,18 @@ func Create(tableName string, needCreateUserID bool, callbacks *CreateCallbacks)
 			return callbackOnCreateErrorReturn(callbacks, c, e, make(map[string]any), err, i)
 		}
 
+		if domain.HasField(e, entity.FieldCreateUserID) && domain.HasField(e, entity.FieldLastUpdateUserID) {
+			createUserID, err := domain.Field[string](e, entity.FieldCreateUserID)
+			if err != nil {
+				return callbackOnCreateErrorReturn(callbacks, c, e, make(map[string]any), err, i)
+			}
+
+			err = domain.SetField(e, entity.FieldLastUpdateUserID, createUserID)
+			if err != nil {
+				return callbackOnCreateErrorReturn(callbacks, c, e, make(map[string]any), err, i)
+			}
+		}
+
 		err = callbackBeforeCreate(callbacks, c, e, prepared, i, nil)
 		if err != nil {
 			return callbackOnCreateErrorReturn(callbacks, c, e, prepared, err, i)