修复关联分页逻辑空指针异常

pull/632/head
DaveBoy1994 5 years ago
parent e770818cee
commit 370dca27ff
  1. 8
      PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java

@ -26,6 +26,7 @@ import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -259,7 +260,9 @@ class DelegateFind extends AbsDelegate {
parents.put(pRowId, createParent(pRowId, parentClazz, pColumn, cursor)); parents.put(pRowId, createParent(pRowId, parentClazz, pColumn, cursor));
} }
if(paged){ if(paged){
childs.get(pRowId).addAll(createChildren(db,childClazz,pColumn,entityColumn,parentColumn,parents.get(pRowId))); List<C> list = createChildren(db, childClazz, pColumn, entityColumn, parentColumn, parents.get(pRowId));
if(list!=null)
childs.get(pRowId).addAll(list);
} }
else { else {
childs.get(pRowId).add(createChild(childClazz, cColumn, cursor)); childs.get(pRowId).add(createChild(childClazz, cColumn, cursor));
@ -304,6 +307,9 @@ class DelegateFind extends AbsDelegate {
field.setAccessible(true); field.setAccessible(true);
if(field.getName().equals(parentColumn)){ if(field.getName().equals(parentColumn)){
Object o = field.get(parents); Object o = field.get(parents);
if(o instanceof String) {
o = URLEncoder.encode((String) o);
}
return findData(db,childClazz,entityColumn+"='"+o+"'"); return findData(db,childClazz,entityColumn+"='"+o+"'");
} }
} }

Loading…
Cancel
Save