Tree-Table Configuration:How to Configure Tree-Tables
I. Left Tree as Model A, Right Table as Model B
Take Model A as Category and Model B as Category Attributes as an example. Model code example:
@Model.model(AriesPlatformCategory.MODEL_MODEL)
@Model(displayName = "Platform Background Category", labelFields = "name")
@Model.Advanced(type = ModelTypeEnum.PROXY)
public class AriesPlatformCategory extends AriesCategory {
public static final String MODEL_MODEL = "aries.item.AriesPlatformCategory";
@Field.many2one
@Field.Relation(relationFields = {"parentCateCode"}, referenceFields = {"code"},store = true)
@Field(displayName = "Platform Parent Category")
private AriesPlatformCategory platformCategory;
@Field.one2many
@Field(displayName = "Category Attributes")
@Field.Relation(relationFields = "code", referenceFields = "categoryCode", store = true)
private List<AriesPlatformCategoryAttr> platformCategoryAttrs;
}
@Model.model(AriesPlatformCategoryAttr.MODEL_MODEL)
@Model(displayName = "Aries_Platform Category Attributes", labelFields = "name")
@Model.Advanced(type = ModelTypeEnum.PROXY)
public class AriesPlatformCategoryAttr extends CategoryAttr {
public static final String MODEL_MODEL = "aries.item.AriesPlatformCategoryAttr";
@Field.many2one
@Field(displayName = "Platform Background Category")
@Field.Relation(relationFields = "categoryCode", referenceFields = "code", store = true)
private AriesPlatformCategory platformCategory;
}
Before designing the left tree-right table in the designer, the association relationships need to be configured in the model. The following code configures the association between categories and parent categories.
@Field.many2one
@Field.Relation(relationFields = {"parentCateCode"}, referenceFields = {"code"},store = true)
@Field(displayName = "Platform Parent Category")
private AriesPlatformCategory platformCategory;
Configure the association between categories and category attributes. One category can have multiple category attributes, a one-to-many (one2many) relationship.
@Field.one2many
@Field(displayName = "Category Attributes")
@Field.Relation(relationFields = "code", referenceFields = "categoryCode", store = true)
private List<AriesPlatformCategoryAttr> platformCategoryAttrs;
In the category attribute model, configure the association between attributes and categories. One category attribute belongs to only one category, while one category can have multiple category attributes. Category attributes have a many-to-one (many2one) relationship with categories.
@Field.many2one
@Field(displayName = "Platform Background Category")
@Field.Relation(relationFields = "categoryCode", referenceFields = "code", store = true)
private AriesPlatformCategory platformCategory;
Designer examples:
- Select Platform Category Attributes as the main model to create a tree-table page Build the association relationship, select Platform Background Category, set the first-level filter condition as empty parent code, and select Platform Category Attributes as the table association relationship field.
- Build the association relationship, select Platform Background Category, set the first-level filter condition as empty parent code, and select Platform Category Attributes as the table association relationship field.
- Drag and drop the required attribute fields in the table
II. Left Tree as Model A, Right Table also as Model A
Take Model A as Organizational Structure Management for both left and right as an example.
(I) Model Code Example:
@Model.model(BasicOrg.MODEL_MODEL)
@Model(displayName = "Organizational Structure Management", summary = "Organizational Structure Management", labelFields = {"orgName"})
@Model.Code(sequence = "ORDERLY_SEQ", prefix = "Org", size = 5, initial = 0)
public class BasicOrg {
public static final String MODEL_MODEL = "basic.BasicOrg";
@Field.String
@Field(displayName = "Name")
private String orgName;
@Field.Enum
@Field(displayName = "Organization Type", summary = "Organization Type")
private OrgTypeEnum deptType;
@Field.Enum
@Field(displayName = "Factory Type", summary = "Visible when organization type is factory")
private FactoryTypeEnum factoryType;
@Field.Enum
@Field(displayName = "Warehouse Type", summary = "Visible when organization type is warehouse")
private WarehouseTypeEnum warehouseType;
@Field.String
@Field(displayName = "Principal", summary = "Principal")
private String principal;
@Field.String
@Field(displayName = "Contact Number", summary = "Contact Number")
private String phone;
@Field(displayName = "Parent Organization")
@Field.many2one
@Field.Relation(relationFields = {"parentCode"}, referenceFields = {"code"})
private BasicOrg parent;
@Field.Text
@Field(displayName = "Remarks")
private String remark;
@Field.Enum
@Field(displayName = "Data Status", required = true, defaultValue = "ENABLED")
private DataStatusEnum dataStatus;
@Field.String
@Field(displayName = "Parent Organization Code")
private String parentCode;
@Field.String(size = 256)
@Field(displayName = "Tree Code", required = true)
private String treeCode;
@Field.one2many
@Field.Relation(relationFields = "id", referenceFields = "orgId")
@Field(displayName = "Basic - Affiliated Organization Employees")
private List<BasicEmployee> basicEmployees;
}
Configure self-association:
@Field(displayName = "Parent Organization")
@Field.many2one
@Field.Relation(relationFields = {"parentCode"}, referenceFields = {"code"})
private BasicOrg parent;
(II) Designer Operations:
- Select the model Organizational Structure Management, create a page, choose Table as the view type, and select Tree-Table as the layout.

- Set the linkage relationship: select Organizational Structure Management as the model; set the first-level filter condition as empty parent code, and select Organizational Structure Management - Parent Organization (field name: parent) as the table association relationship field.
- Drag and drop the required attribute fields in the table.