0

我有这个结果映射

<result element="lot" rowName="lotInfo">
        <element column="key_lot" name="lotId" exportType="SCALAR" xsdType="xs:long"/>
        <element column="lot_number" name="lotNumber" exportType="SCALAR" xsdType="xs:string"/>
        <call-query href="getTradeNameSQL">
            <with-param name="TN_CODE" query-param="trade_name"/>
        </call-query>
        <element column="expiry_date" name="expiryDate" exportType="SCALAR" xsdType="xs:date"/>
        <element column="Qte_administre" name="quantiteAdministre" exportType="SCALAR" xsdType="xs:float"/>
        <call-query href="getVocabulaireSQL">
            <with-param name="TYPE" query-param="unite_mesure_type"/>
            <with-param name="VOCABULARY_DOMAIN" query-param="unite_mesure_vocab_domain"/>
            <with-param name="CONCEPT_ID" query-param="unite_mesure"/>
        </call-query>
        <call-query href="getVocabulaireSQL">
            <with-param name="TYPE" query-param="ROUTE_ADMIN_type"/>
            <with-param name="VOCABULARY_DOMAIN" query-param="ROUTE_ADMIN_vocab_domain"/>
            <with-param name="CONCEPT_ID" query-param="ROUTE_ADMIN"/>
        </call-query>
        <element column="status_lot" name="status" exportType="SCALAR" xsdType="xs:string"/>
    </result>

结果是

<lot xmlns="http://ws.wso2.org/dataservice">
<lotInfo>
    <lotId>616</lotId>
    <lotNumber>C4368AC</lotNumber>
    <tradeName>
        <tradeNameInfo>
            <code>ADACEL</code>
            <description>ADACEL</description>
            <agents>
                <agentInfos>
                    <id>1002805</id>
                    <code>SCT_AG0016</code>
                    <description>dcaT</description>
                </agentInfos>
            </agents>
        </tradeNameInfo>
    </tradeName>
    <expiryDate>2015-05-31T00:00:00.000-04:00</expiryDate>
    <quantiteAdministre>0.5</quantiteAdministre>
    <domains>
        <domainValue>
            <id>493416</id>
            <code>INV.UnitOfMeasure2</code>
            <description>ml (millilitre)</description>
            <type>DosageUnit</type>
        </domainValue>
    </domains>
    <domains>
        <domainValue>
            <id>433437</id>
            <code>IM</code>
            <description>Intramusculaire</description>
            <type>AdministrationRoute</type>
        </domainValue>
    </domains>
    <status>Expired</status>
</lotInfo>

那是对的。

我的问题是:如您所见<domains>,xml 中有两个,因为它们来自同一个查询。但是,有没有办法给他们每个人一个不同的名字?

我正在使用 DSS 4.2.0

谢谢你。

4

1 回答 1

0

我认为解决您的问题的最简单方法是将您的每个查询替换为复杂元素并在其中调用您的查询。通过这种方式,您可以为子查询定义元素名称。结果可能并不完全符合您的预期,但非常接近。这是因为添加复杂元素会在您的 xml 中添加一个新标签,例如:

<lot xmlns="http://ws.wso2.org/dataservice">
<lotInfo>
<lotId>616</lotId>
<lotNumber>C4368AC</lotNumber>
<tradeName>
    <tradeNameInfo>
        <code>ADACEL</code>
        <description>ADACEL</description>
        <agents>
            <agentInfos>
                <id>1002805</id>
                <code>SCT_AG0016</code>
                <description>dcaT</description>
            </agentInfos>
        </agents>
    </tradeNameInfo>
</tradeName>
<expiryDate>2015-05-31T00:00:00.000-04:00</expiryDate>
<quantiteAdministre>0.5</quantiteAdministre>
<unit>
  <domains>
    <domainValue>
        <id>493416</id>
        <code>INV.UnitOfMeasure2</code>
        <description>ml (millilitre)</description>
        <type>DosageUnit</type>
    </domainValue>
  </domains>
</unit>
<route>
  <domains>
    <domainValue>
        <id>433437</id>
        <code>IM</code>
        <description>Intramusculaire</description>
        <type>AdministrationRoute</type>
    </domainValue>
  </domains>
</route>
<status>Expired</status>

在数据服务 XML 中,您只需<element>为查询添加一个标签:

<element name="unit" namespace="N/A">
    <call-query href="getVocabulaireSQL">
        <with-param name="TYPE" query-param="unite_mesure_type"/>
        <with-param name="VOCABULARY_DOMAIN" query-param="unite_mesure_vocab_domain"/>
        <with-param name="CONCEPT_ID" query-param="unite_mesure"/>
    </call-query>
</element>
<element name="route" namespace="N/A">
    <call-query href="getVocabulaireSQL">
        <with-param name="TYPE" query-param="ROUTE_ADMIN_type"/>
        <with-param name="VOCABULARY_DOMAIN" query-param="ROUTE_ADMIN_vocab_domain"/>
        <with-param name="CONCEPT_ID" query-param="ROUTE_ADMIN"/>
    </call-query>
</element>
于 2015-12-10T12:04:41.273 回答