ibatis sqlmaping的問題

sqlmap發表於2006-07-27
要生成的SQL語句
select a.doc_id,a.title,a.keyword,a.uploadpath,a.creator,a.create_date,a.uploadimage,a.doc_type,b.dimension_id,b.menu_id
from document a,document_dimension b where a.doc_id=b.doc_id
and ((b.dimension_id='1004' and b.menu_id='1040')or (b.dimension_id='1005' and b.menu_id='1041'))
現在dimension_id,menu_id的值都放在List中。
但不知在sqlmapping裡如何配置。
後改為
select
a.doc_id,a.title,a.keyword,a.uploadpath,a.creator,a.create_date,a.uploadimage,a.doc_type
from document a,document_dimension b where a.doc_id=b.doc_id
and ((b.dimension_id='1004' or b.dimension_id='1005')
and (b.menu_id='1040'or b.menu_id='1041'))

<iterate property="dimensionList" open="(" close=")" conjunction="or">
b.dimension_id = dimensionList[]#
</iterate>
<iterate property="menuList" open="(" close=")" conjunction="or">
b.menu_id = menuList[]#
</iterate>
這樣的配置結果不太對。同時可能menu_id為空,我要判斷menu_id為空的話就不會生成b.menu_id="".有沒有方法處理。

相關文章