2014-09-02 27 views
0

我正在開發簡單的dss服務,其中根據某些輸入參數檢索客戶詳細信息。當wso2中的某個輸出字段爲空時,無法檢索記錄的詳細信息dss服務器

在輸出中,我顯示了customer_id,first_name,last_name,mobile_number,email和客戶狀態。

現在,如果上述6個輸出字段中的任何一個在數據庫條目中都是空白的(例如,如果客戶的手機號碼沒有輸入到數據庫中),並且我試圖通過dss查看客戶詳細信息,我不會獲取客戶詳細信息在輸出中。

只有在數據庫的上述6個輸出字段中有值時,纔會檢索到該客戶的詳細信息。

我試圖把輸出字段作爲可選項,但沒有幫助。也嘗試給輸出字段默認值,但也沒有幫助

以下是我的數據服務。

<data name="CustomerStatusManagementDssdirectconsole"> 
    <config id="ildb"> 
     <property name="carbon_datasource_name">il_database</property> 
    </config> 
    <query id="select_customer_details_by_any_parameter" useConfig="ildb"> 
     <sql>select * from ildb_schema.customer_detail where identifier like :cust_id and first_name like :firstname and last_name like :lastname and mobile_number like :mobilenumber and email like :email</sql> 
     <result element="Customers" rowName="customer"> 
     <element column="identifier" name="cid" xsdType="xs:string"/> 
     <element column="first_name" name="first_name" xsdType="xs:string"/> 
     <element column="last_name" name="last_name" xsdType="xs:string"/> 
     <element column="mobile_number" name="mobile_number" xsdType="xs:string"/> 
     <element column="user_status" name="user_status" xsdType="xs:string"/> 
     <element column="email" name="email" xsdType="xs:string"/> 
     </result> 
     <param name="cust_id" sqlType="STRING"/> 
     <param name="firstname" sqlType="STRING"/> 
     <param name="lastname" sqlType="STRING"/> 
     <param name="mobilenumber" sqlType="STRING"/> 
     <param name="email" sqlType="STRING"/> 
    </query> 
    <operation name="select_customer_details_by_any_parameter_operation"> 
     <call-query href="select_customer_details_by_any_parameter"> 
     <with-param name="cust_id" query-param="identifier"/> 
     <with-param name="firstname" query-param="first_name"/> 
     <with-param name="lastname" query-param="last_name"/> 
     <with-param name="mobilenumber" query-param="mobile_number"/> 
     <with-param name="email" query-param="email"/> 
     </call-query> 
    </operation> 
    </data> 

Eg. If there is a customer with customer_id=110,first_name=abc,last_name=xyz,[email protected],mobile=<<blank>>,status=active 

如果我檢索嘗試該服務選項通過DSS以上的客戶,我得到下面的輸出,沒有客戶的細節

<Customers xmlns="http://ws.wso2.org/dataservice"/> 

回答

0

你寫的查詢要求所有參數都存在。也許它可能被命名爲「select_customer_details_by_every_parameter」而不是「select_customer_details_by_any_parameter」。 :)

在WSO2 DDS中,您可以爲每個數據源定義多個數據服務查詢,每個數據源具有不同的參數。看起來你只有一個查詢,並且有一個操作需要每個參數。我建議爲您的數據源編寫多個數據服務查詢,其中一個只包含where子句中的主鍵字段。這應該允許您檢索具有其他空列的行。

乾杯, Colin

相關問題