浏览代码

级联条件根据selectToObj值进行动态判断

lvxianyun 3 年之前
父节点
当前提交
7f0855f8cf
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

+ 7 - 2
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -144,10 +144,15 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         if(CollUtil.isEmpty(relations)) {
             array.add("0");
         } else {
-            List<String> relList = CollUtil.getFieldValues(relations, "objTo", String.class);
+            List<String> relList = CollUtil.getFieldValues(relations, annotationInfo.selectToObj()?"objTo":"objFrom", String.class);
             relList.forEach(id -> array.add(id));
         }
-        return groupMapList(relations, "objFrom", "objTo");
+        if(annotationInfo.selectToObj()){
+            return groupMapList(relations, "objFrom", "objTo");
+        }else{
+            return groupMapList(relations, "objTo", "objFrom");
+        }
+
     }
 
     /**