Record 能转化能Model吗

String strSql = " select  *  from  _tree";

        List<Record> ls = Db.find(strSql);

        TreeBuilder tree = new TreeBuilder();

        renderJson(tree.buildListToTree(ls));


评论区

JFinal

2017-07-27 10:52

使用 Model.put(Record) 方法能将 Record 转成Model

淡定007

2017-07-27 11:38

@JFinal
String strSql = " select * from _tree";
List ls = Db.find(strSql);
List mls = new ArrayList();
for (int i = 0; i < ls.size(); i++) {
TreeNode m = new TreeNode();
mls.add(m.put(ls.get(i)));
}
TreeBuilder tree = new TreeBuilder();
renderJson(tree.buildListToTree(mls));

淡定007

2017-07-27 11:38

@JFinal mls.add(m.put(ls.get(i))); mls的值都是null

JFinal

2017-07-27 11:44

@淡定007 mls 是你 new 出来的一个 ArrayList ,怎么可能是 null 呢?

淡定007

2017-07-27 11:55

@JFinal 没法发图片 我又发了个反馈

热门反馈

扫码入社