mybatis中特殊符号(大于号、小于号)的处理
1、预定义字符
< <=相当于=> < 小于号 > <=相当于=> > 大于号
案例:
<select id="a" parameterType="java.lang.String" resultType="com.gao.entity.MyDemo">
select *
from 数据库表2
(
select *
from 数据库表1
where id = #{id}
)
where rownum <= 10
</select>
2、使用 CDdata
<![CDATA[sql语句]]>
案例:
<select id="a" parameterType="java.lang.String" resultType="com.gao.entity.MyDemo"> <![CDATA[ select * from 数据库表2 ( select * from 数据库表1 where id = #{id} ) where
rownum <= 10 ]]> </select>