時間:2024-03-12 20:33作者:下載吧人氣:10
平時在開發中,針對動態sql這塊目前是薄弱點,自己根據官網在對應項目邊測試邊寫博客,此篇只是為了加深動態sql的熟練度,有不到之處敬請批評指正!
使用動態 SQL 最常見情景是根據條件包含 where 子句的一部分。比如:
<select id=”findActiveBlogWithTitleLike”
resultType=”Blog”>
SELECT * FROM BLOG
WHERE state = ‘ACTIVE’
<if test=”title != null”>
AND title like #{title}
</if>
</select>
網友評論