ibatis批量查询(excel批量导出)
原创
©著作权归作者所有:来自51CTO博客作者QC班长的原创作品,请联系作者获取转载授权,否则将追究法律责任
<sql id="pageWhere">
<dynamic prepend="where">
<isNotEmpty prepend="and" property="fs_id"><!--主键-->
<![CDATA[ fs_id like '%'+#fs_id#+'%' ]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="conditionGroupList"><!--批量导出-->
fs_id in
<iterate property="conditionGroupList" conjunction="," open="(" close=")">
<![CDATA[ #conditionGroupList[]# ]]>
</iterate>
</isNotEmpty>
</dynamic>
</sql>
select * from where fs_id in (xxxxxxxxxx,xxxxxxxxxxx,xxxxxxxxxxxx,xxxxxxxx)
<sql id="pageWhere">
<dynamic prepend="where">
<isNotEmpty prepend="and" property="fs_id"><!--主键-->
<![CDATA[ fs_id like '%'+#fs_id#+'%' ]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="conditionGroupList"><!--批量导出-->
<iterate property="conditionGroupList" conjunction="or" open="(" close=")">
<![CDATA[ fs_id = #conditionGroupList[]# ]]>
</iterate>
</isNotEmpty>
</dynamic>
</sql>打印出的sql语句如下:select * from where ( fs_id =xxxxxxxxxx or fs_id =xxxxxxxxxx or fs_id =xxxxxxxxxx)
执行效率感兴趣的朋友测试下。