代码改变世界

ibatis 动态SQL相关

2011-02-09 15:52  hanwesley  阅读(444)  评论(0编辑  收藏  举报

  <dynamic>

              <isNotEqual prepend="AND" property="accountType" compareValue="2">

                r.shop_keeper_id = #shopKeeperId#

               </isNotEqual>

              <isNotEmpty prepend="and" property="campaignId">

                  r.campaign_id=#campaignId#

              </isNotEmpty>

              <isNotNull prepend="and" property="campaignList">

                   r.campaign_id in

                    <iterate property="campaignList" open="("  close=")" conjunction=",">

                             #campaignList[].campaignId#

                    </iterate>

              </isNotNull>

  </dynamic>    

 与isNot相对的is可以相反的替换以上逻辑。