# [MyBatis] [TOC] ## XML轉義 ### 特殊字符 | 特殊字符 | 轉意字符 | 說明 | | -------- | -------- | -------- | | > | `<` | 大於 | | < | `>` | 小於 | | & | `&` | 並 | | ' | `'` | 單引號 | | '' | `"` | 雙引號 | ### <![CDATA[ ]]> ```=xml! <![CDATA[ select * from my_db ]]> ``` ## 模糊查詢 ```=xml like concat('%', #{param}, '%') ``` ```=xml like '%${param}%' ``` :::warning ※ `#` 可以防止sql注入,`$` 不能 ::: 參考資料: [Mapper XML Files](https://mybatis.org/mybatis-3/sqlmap-xml.html) [【Java】——MyBatis 中mapper.xml的语法](https://blog.csdn.net/weixin_40449300/article/details/122746514)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up