我試圖避免有一個額外的XML來定義在mybatis3映射器。註釋適合。如何在MyBatis中使用帶註釋的動態SQL查詢(如何使用selectProvider)?
我對@ SelectProvider/@ InsertProvider/etc的使用有點困惑。不要以爲網上有很多資源指導我完成這個任務。
基本上,我想在mybatis3中找到備選的註釋版本。
例如,我有一個XML映射器,我想將其轉換爲使用註解
<select ...>
<where>
<if cause.....>
</if>
<if cause......>
</if>
</where>
</select>
誰能提供一個具體的答案/解決方案,包括代碼?
在此先感謝!
MyClass中@SelectProvider(type=MyClass.class, method="myMethod")
public Object selectById(int id);
:
這是真的很酷。但有一點需要注意:'
相關問題