0

I trying to create multiple menu category using JDL. In one CategoryItem have parentID.

I already created JDL like:

microservice * with Category

entity CategoryItem{
    name String required
}

relationship ManyToOne{
    CategoryItem{parrent} to CategoryItem
} 

service * with serviceClass
paginate CategoryItem with pagination

If the client calls a method findAll. Can I return JSON format like that:

[
  {
    "id": 1,
    "name": "car",
    "CategoryItem": [
      {
        "id": 2,
        "name": "red car"
      },
      {
        "id": 3,
        "name": "blue car"
      }
    ]
  },
  {
    "id": 4,
    "name": "bike",
    "CategoryItem": []
  }
]
Tài Bùi
  • 3
  • 6

0 Answers0