idea使用mybatis插件mapper中的方法爆紅的解決方案
問題描述
idea使用mybatis插件mapper中的方法爆紅,resultType返回的是實體類,項目能正常運行。

提示:Result type doesn't match for Select id="test"
mapper:
public interface TestMapper {
@MapKey("code")
Map<String, CategoryScaleVo> test();
}xml:
<select id="test" resultType="com.test.model.vo.CategoryScaleVo">
select category as code, count(1) as count from advise
GROUP BY category
</select>解決方案:
resultType換成resultMap
<resultMap id="categoryScaleMap" type="com.test.model.vo.CategoryScaleVo"> <result column="code" property="code"/> <result column="count" property="count"/> </resultMap> <select id="test" resultMap="categoryScaleMap"> select category as code, count(1) as count from advise GROUP BY category </select>
這樣就不會爆紅了
到此這篇關(guān)于idea使用mybatis插件mapper中的方法爆紅的解決方案的文章就介紹到這了,更多相關(guān)idea使用mapper方法爆紅內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決spring boot hibernate 懶加載的問題
這篇文章主要介紹了解決spring boot hibernate 懶加載的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-10-10
簡單談?wù)凧ava遍歷樹深度優(yōu)先和廣度優(yōu)先的操作方式
這篇文章主要介紹了簡單談?wù)凧ava遍歷樹深度優(yōu)先和廣度優(yōu)先的操作方式的相關(guān)資料,需要的朋友可以參考下2023-03-03
Spring Boot HikariCP 連接池 YAML 配置最佳實
本文介紹了HikariCP在Spring Boot 2.x及更高版本中的配置方法,包括基礎(chǔ)配置、高級配置、數(shù)據(jù)庫特定配置及MySQL和PostgreSQL的優(yōu)化建議,文章還討論了MySQL的8小時問題,包括其本質(zhì)、常見解決方法,以及如何通過優(yōu)化連接池配置來避免該問題,感興趣的朋友跟隨小編一起看看吧2025-12-12

