ibatis查询列表跟总记录,都引用相同SQL
2024-08-31 13:51:58
在查询记录集合跟查询记录总记录数的时候,我们需要所写的SQL要一样,那么可以都引用同一个SQL。写法如下:
<sqlMap namespace="Server">
<sql id="sql_select_BeneficiaryUmInfo">
select id_beneficiary, id_um, remark from sibrms_beneficiary_um
<dynamic prepend="where">
<isNotEmpty prepend="and" property="id_beneficiary">
id_beneficiary = #id_beneficiary#
</isNotEmpty>
<isNotEmpty prepend="and" property="id_um">
id_um = #id_um#
</isNotEmpty>
</dynamic>
</sql>
<!-- 查询数据集合 -->
<select id="select_BeneficiaryUmInfo"
parameterClass="java.util.HashMap"
resultClass="server.report.model.BeneficiaryUmInfo">
<include refid="sql_select_BeneficiaryUmInfo" />
</select>
<!-- 查询数据集合总记录数 -->
<select id="select_BeneficiaryUmInfo_count"
parameterClass="java.util.Map" resultClass="java.lang.Integer">
select count(0) from(
<include refid="sql_select_BeneficiaryUmInfo" />
)
</select></sqlMap>
最新文章
- PHP工作笔记:yii2各种功能汇总
- 软件工程(FZU2015)赛季得分榜,第五回合
- C#小小总结(面向对象)
- XHTML的若干注意点
- Etl之HiveSql调优(union all)
- 2015.11.16JQuery 隐藏,显示按钮.
- c#中SqlHelper类的编写(三)
- Tomcat7.0配置
- Android中关于JNI 的学习(三)在JNI层訪问Java端对象
- BC#64 4.Tree
- jenkins使用1----初始化设置
- 使用 ctypes 进行 Python 和 C 的混合编程
- pythonweb服务器编程(四)
- C# SQLite数据库
- 怎样才能提交一个让开发人员拍手叫好的bug单
- CRT/LCD/VGA Information and Timing
- 开发手记:Linux下更改Oracle表空间大小
- Nginx反向代理中使用proxy_redirect重定向url
- 微软在线实验室启用谷歌的reCAPTCHA,我们又丢失了一个好东东
- Linux-(ps,grep)