java如何使用“分组依据”从mybatis sql获取映射结果?
@Select({
"<script>",
"SELECT tag_id as tagId, count(*) as count FROM table_1",
"where poi_id=#{poiId} and spu_id=#{spuId} and tag_id in ",
"<foreach collection='tagIdList' item='tagId' index='index' open='(' separator = ',' close=')' >",
"#{tagId}",
"</foreach>",
" group by tag_id ",
"</script>"
})
@ResultType(HashMap.class)
Map<Long, Integer> getMap(@Param("poiId") long poiId, @Param("spuId") long spuId
, @Param("tagIdList") List<Long> tagIdList)
使用上面的sql,我得到以下错误
组织。迈巴蒂斯。春天MyBatisSystemException:嵌套异常为org。阿帕奇。伊巴蒂斯。例外。TooManyResultsException:预期selectOne()会返回一个结果(或null),但发现:2
出了什么问题,如何解决?谢谢
共 (0) 个答案