mybatis如何用嵌套list接收返回值?

新手上路,请多包涵

框架:java、mybatis、oracle数据库
问题描述:
数据库查询结果如图
image.png
mybatis查询语句如下:

<select id="getScatterData" resultType="map" fetchSize="500">
    select DISTINCT tl.TIME, tl.MF
    from ${table} tl
    <where>
        <if test="startTime != null and startTime != ''">
            and tl.TIME &gt;= to_date(#{startTime}, 'yyyy-mm-dd hh24:mi:ss')
        </if>
        <if test="endTime != null and endTime != ''">
            and tl.TIME &lt; to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
        </if>
    </where>
    ORDER BY tl.TIME
</select>

现在返回的是这种类型的数据,[{}, {}, {}, {}],
但是我不想要这种类型的,我想要的是这种的,[[], [], [], []],比如:

[
    ['2023-01-29 13:03:45', 23],
    ['2023-01-29 13:03:45', 43],
    ['2023-01-29 15:43:55', 33],
    ['2023-01-29 15:43:55', 13],
]

想问一下,有没有什么办法?

阅读 2.3k
2 个回答

没这种数据格式的吧,你这个格式是应用在哪里的?传给前端?

这个是echarts的格式
image.png

[{},{}]这种数常规的数组或则集合类型,你期望的那种感觉是个多维数组了,这种只有自己去转换。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题