sql语句的问题,不知道能否达到这种效果

一张成绩表
student_id type score time
001 yu 55 2022-04-22
001 shu 88 2022-04-22
001 ying 65 2022-04-22
002 yu 88 2022-04-22
002 shu 42 2022-04-22
002 ying 67 2022-04-22

希望查询结果是:

student_id yu shu ying time
001 55 88 65 2022-04-22
002 88 42 67 2022-04-22

修改下问题,原问句可能让大家误解了。

SQL语句查询能做到这种效果吗?怎么做?

select student_id,
max(case  type when  'yu' then score end) yu, 
max(case  type when  'shu' then score end) shu, 
max(case  type when  'ying' then score end) ying, 
max( time) time from 成绩表
group by student_id

没用mybatis-plus写过,但是原理应该都差不多,你可以把所有数据都查出来然后保存到数组,再通过数组做循环就可以了

因为你最终的数据结果的结构跟表映射的bean不一样,mybatis-plus提供的都是结果为映射bean的,所以先查出来,在代码里做处理比较好