如何在 JayData 上创建实体之间的关系?
这是我的表架构:
$data.Entity.extend("OrdemServico", {
Status: { type: String },
SafAnoSafra: { type: "int" },
LancObservacao: { type: String },
LancDtPrevIni: { type: Date },
LancDtPrevFim: { type: Date },
LancData: { type: Date },
CodSubprocesso: { type: "int" },
CodProcesso: { type: "int" },
CodOs: { type: "int" },
CodFuncEmpr: { type: "int" },
CodFuncAplic: { type: "int" },
CodFuncApliEmpr: { type: "int" },
CodFunc: { type: "int" },
CodFrente: { type: "int" },
CodEmpr: { type: "int" }
});
$data.Entity.extend("Local", {
SafAnoSafra: { type: "int" },
PerAreaOs: { type: "decimal" },
IdDivi4: { type: "int" },
CodOs: { type: "int" },
CodEmpr: { type: "int" },
CodDivi4: { type: "int" },
CodDivi3: { type: "int" },
CodDivi2: { type: "int" },
CodDivi1: { type: "int" },
AreaOs: { type: "decimal" },
AreaLiquida: { type: "decimal" }
});
关系是:
OrdemServico.SafAnoSafra -> Local.SafAnoSafra
OrdemServico.CodEmpr -> Local.CodEmpr
OrdemServico.CodOs -> Local.CodOs
经过大量搜索后,我在 JayData 官方教程中找到了类似的内容,但在此链接上(至少对我而言)仍然不太清楚。根据它,我必须做的是建立关系是这样的:
Locais: {type: "Array", elementType: "$org.types.Local", navigationProperty: "OrdemServico"}
对于 OrdemServico 实体...
OrdemServico: { type: "Array", elementType: "$org.types.OrdemServico", navigationProperty: "Local"}
对于本地实体。
这破坏了我的代码并且不起作用。不知道怎么走得更远。