如何在ActiveAndroid Orm中保存树json?

时间:2018-12-18 07:05:36

标签: android database orm activeandroid

我有一棵有一定水平的树。如何将其保存在ActiveAndroid ORM中? 我想保存它,但只保存了一个空孩子的第一层。所有子对象都具有相同的属性。

[
  {
    "childs": [
      {
        "childs": [
          {
            "childs": [
              {
                "childs": null,
                "id": 35,
                "parentId": 11,
                "listLevel": 3
              },
              {
                "childs": null,
                "id": 36,
                "parentId": 11,
                "listLevel": 3
              }
            ],
            "id": 11,
            "profileId": null,
            "parentId": 5,
            "listLevel": 2
          },
          {
            "childs": [
              {
                "childs": null,
                "id": 40,
                "parentId": 12,
                "listLevel": 3
              }
            ]
          }
        ]
      }
    ]
  }
]

它是json的模型

@Table(name =“ ListItemTable”) 公共类ListItemTable扩展了模型{

@Column(name = "myId")
public Long myId;
@Column(name = "childs")
public List<ListItemTable> childs;
@Column(name = "listLevel")
public int listLevel;
@Column(name = "parentId")
public int parentId;
public ListItemTable() {
    super();
}

}

0 个答案:

没有答案