IBATIS如何复用SQL片段
为了消除重复片段,我们使用【sql】和【include】标签。【sql】标签用来包含重复片段,【include】标签用来引入片段: xml 代码
<sql id="selectItem_fragment">
FROM items
WHERE parentid = 6
sql>
<select id="selectItemCount" resultresultClass="Item">
SELECT id, name
<include refid="selectItem_fragment"/>
select>