- 同一个文件引用sql片段
<!-- sql片段:分页结束 -->
<sql id="pagerEnd">
<![CDATA[
limit #{offSet},#{pageSize}
]]>
</sql>
<!-- 引用sql片段查询分页列表-->
<select id="getListByPager" parameterType="map" resultType="com.xxx.TaskJobEntity">
select guid, task_name,satellite from task_job
<include refid="pagerEnd"/>
</select>
- 不同文件引用sql片段
- common.xml
<mapper namespace="common.Paging">
<!-- sql片段:分页结束 -->
<sql id="pagerEnd">
<![CDATA[
limit #{offSet},#{pageSize}
]]>
</sql>
</mapper>
- 其他mapper
<!-- 引用common的sql片段查询分页列表-->
<select id="getListByPager" parameterType="map" resultType="com.xxx.TaskJobEntity">
select guid, task_name,satellite from task_job
<include refid="common.Paging.pagerEnd"/>
</select>
版权声明:本文为ximaiyao1984原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。