我已经使用Moqui Framework实现了一个应用程序。如果是这样的话
<resource name="userstores">
<id name="parentId">
<method type="get"><entity name="UserRoleMaps" operation="list"/></method>
<resource name="child_Id">
<method type="get"><entity name="users" operation="one"/></method>
</resource>
</id>
</resource>
UserRoleMaps 中有 child_Id 列 实体,我需要从 UserRolemaps 获取 child_Id ,我需要传递给用户实体作为获取数据的条件。我该如何迭代呢。
我正在尝试的网址是:http://localhost:8080/moqui/rest/s1/moqui/userstores/100
答案 0 :(得分:0)
我在这样的实体中维持了关系
<entity entity-name="UserRoleMap" package-name="moqui.security" short-alias="UserRoleMaps" allow-user-field="false" allow-remote="true">
<field name="gropMapId" type="id-long" is-pk="true" />
<field name="persontId" type="text-medium" />
<field name="child_Id" type="text-medium" />
// the below relationship parentId mean userId so it maps the childId and get the respective data related to parentId.
<relationship type="one" title="UserType" related-entity-name="moqui.security.UserAccount" short-alias="childUserDetails">
<key-map field-name="child_Id" related-field-name="userId"/>
</relationship>
<master>
<detail relationship="childUserDetails"/>
</master>
</entity>
通过这种方式,我实现了我的功能。