开发者社区> 问答> 正文

ibatis iterator 标签下面不能dynamic标签,逻辑如何改写??报错

下面这条SQL如何写?

这样子的时候报错,iterator标签下面不能有dynamic标签。

<iterate property="condList"  open="(" close=")" conjunction="or">  
(
<dynamic>
     <isNotNull  property="lid" prepend="and"> SOURCE_LID = #condList[].lid#</isNotNull> 
     <isNotNull  property="mid" prepend="and"> MID = #condList[].mid#</isNotNull> 
     <isNotNull  property="fid" prepend="and"> FID = #condList[].fid#</isNotNull> 
     <isNotNull  property="ctid" prepend="and"> CTID = #condList[].ctid#</isNotNull> 
     <isNotNull  property="accountType" prepend="and"> ACCOUNT_TYPE = #condList[].accountType#</isNotNull>   


 </dynamic>


)
</iterate>




展开
收起
爱吃鱼的程序员 2020-06-09 13:39:59 474 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    发现下面这种方法可以解决问题,虽然不完美

    <iterateproperty="condList"open="("close=")"conjunction="or">(1=1<isNotNullproperty="lid"prepend="and">SOURCE_LID=#condList[].lid#</isNotNull><isNotNullproperty="mid"prepend="and">MID=#condList[].mid#</isNotNull><isNotNullproperty="fid"prepend="and">FID=#condList[].fid#</isNotNull><isNotNullproperty="ctid"prepend="and">CTID=#condList[].ctid#</isNotNull><isNotNullproperty="accountType"prepend="and">ACCOUNT_TYPE=#condList[].accountType#</isNotNull>)</iterate>



    2020-06-09 13:40:17
    赞同 展开评论 打赏
问答分类:
SQL
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多