原来写的是:
@MapKey(“team_id”) 写完测试 OK,第二天,查询报错
nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'team_id' in 'class com.gtinfo.core.vo.volunteer.VolunteerTeamTotalVo'
实际上 该vo中Getter是有的

修改为下列就好了。
@MapKey("teamId")
Map<Long, VolunteerTeamTotalVo> getVolunteerTeamCountInfo(@Param("list") List<Long> teamIdList);
看注解注释,可以是属性名或者列名。感觉好奇怪,不知道怎么回事。

本文讲述了作者在使用Mybatis时遇到的关于@MapKey注解错误,发现实际Getter存在但报错,通过调整注解中的属性名并修复映射方法,揭示了注解属性名与实际属性或列名的一致性问题。
1784

被折叠的 条评论
为什么被折叠?



