我正在尝试基于连接查询获取字段的值数组,但返回第二个表中的所有值。我的预期结果是
{"description":"",
"id":479,
"brand":"Lowepro",
"mrp":4900,
"name":"Lowepro Photo Hatchback 16L AW Camera Bag",
"brandID":19,
"srp":[3773,3547,3685],
"category":"Camera bags"}
现在的结果是:第二个表中的所有srp值(包含srp值)。
你可以帮助我....?提前谢谢。 Data-config.xml是
<entity name="master_products" pk="id"
query="select p.* ,b.* ,c.*,d.* from master_products p ,master_brands b,master_product_categories c,master_affiliate_product_mappings d where b.id=p.brand_id and c.id=p.product_category_id and d.our_product_id=p.id"
deltaImportQuery="SELECT * FROM master_products WHERE product_name='${dataimporter.delta.product_name}' ">
<field column="product_name" name="name"/>
<field column="product_description" name="description"/>
<field column="id" name="id"/>
<field column="mrp" name="mrp"/>
<field column="brand_id" name="brandID"/>
<entity name="master_affiliate_product_mappings"
query="select * from master_affiliate_product_mappings"
deltaImportQuery="select * from master_affiliate_product_mappings where our_product_id={master_products.id}"
processor="SqlEntityProcessor" cacheImpl="SortedMapBackedCache" >
<field column="srp" name="srp" />
</entity>
<entity name="master_brands"
query="select * from master_brands"
deltaImportQuery="select * from master_brands where id ={master_products.brand_id}"
processor="SqlEntityProcessor" cacheImpl="SortedMapBackedCache" >
<field column="brand" name="brand" />
</entity>
<entity name="master_product_categories"
query="select * from master_product_categories"
deltaImportQuery="select * from master_product_categories where id ={master_products. product_category_id}" processor="SqlEntityProcessor" cacheImpl="SortedMapBackedCache" >
<field column="category" name="category" />
</entity>
</entity>