mybatis返回集合只返回第一条数据, 而navicat返回两条,是什么原因?

  • Post author:
  • Post category:其他




navicat查询

在这里插入图片描述



mybatis查询

在这里插入图片描述



控制台输出

10:42:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : ==>  Preparing: SELECT t1.target_id targetId, GROUP_CONCAT( t2.subject_name ) subjectName FROM t_subject_target t1 LEFT JOIN t_subject t2 ON t1.subject_id = t2.id WHERE t1.target_id IN ( ? , ? ) GROUP BY t1.target_id 
10:42:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : ==> Parameters: 271319473477124096(String),  271322304489717760(String)
10:42:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : <==      Total: 1



解决

在这里插入图片描述



控制台输出

10:45:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : ==>  Preparing: SELECT t1.target_id targetId, GROUP_CONCAT( t2.subject_name ) subjectName FROM t_subject_target t1 LEFT JOIN t_subject t2 ON t1.subject_id = t2.id WHERE t1.target_id IN ( 271319473477124096 , 271322304489717760 ) GROUP BY t1.target_id 
10:45:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : ==> Parameters: 
10:45:27 DEBUG c.c.s.d.m.T.querySubjectNameById         : <==      Total: 2



版权声明:本文为qq_28356887原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。