File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/main/java/org/nebula/contrib/ngbatis/utils Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 2424import javax .persistence .Id ;
2525import javax .persistence .Table ;
2626import javax .persistence .Transient ;
27+ import org .nebula .contrib .ngbatis .annotations .Space ;
2728import org .nebula .contrib .ngbatis .annotations .base .EdgeType ;
2829import org .nebula .contrib .ngbatis .annotations .base .GraphId ;
2930import org .nebula .contrib .ngbatis .annotations .base .Tag ;
@@ -623,4 +624,25 @@ public static boolean isGraphId(Field field) {
623624 }
624625 return false ;
625626 }
627+
628+ /**
629+ * 从实体类获取 space,并解析占位符
630+ */
631+ public static String spaceFromEntity (Class <?> entityType ) {
632+ boolean hasSpace = entityType .isAnnotationPresent (Space .class );
633+ String space = null ;
634+ if (hasSpace ) {
635+ Space spaceAnnotation = entityType .getAnnotation (Space .class );
636+ space = spaceAnnotation .name ();
637+ }
638+
639+ boolean hasTable = entityType .isAnnotationPresent (Table .class );
640+ if (hasTable ) {
641+ Table tableAnnotation = entityType .getAnnotation (Table .class );
642+ space = tableAnnotation .schema ();
643+ }
644+
645+ return space ;
646+ }
647+
626648}
You can’t perform that action at this time.
0 commit comments