确认

  • [ ] 我的版本是最新版本, 我的版本号与 version 相同, 并且项目里无依赖冲突
  • [X] 我已经在 issue 中搜索过, 确认问题没有被提出过
  • [X] 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

3.5.3.1

问题描述

database is tdengine 数据库是tdengine

@Override
    public List<Map<String, Object>> selectListAggregation(QueryParam param){
        QueryWrapper<T> wrapper = new QueryWrapper<T>();
        return getBaseMapper().selectMaps(wrapperQuery(wrapper,param));
    }
JDBC Connection [HikariProxyConnection@1310611742 wrapping com.taosdata.jdbc.TSDBConnection@1c831a06] will not be managed by Spring
==>  Preparing: SELECT device_id,product_id,property,raw_value,number_value,ts FROM super_device_property WHERE (device_id = ?) partition by property
==> Parameters: 2(String)
<==    Columns: device_id, product_id, property, raw_value, number_value, ts
<==        Row: 2, 2, num, 33, 33.0, 2024-09-04 14:15:27.222
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@33101e5b]
nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'device_id' from result set.  Cause: cn.hutool.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]

请问这要如何解决?

详细堆栈日志

No response

Comment From: tom055

已解决 自己写了,但作用在其他表上的一个属性中,selectMap在其他表上都会自动触发这个处理

public class MapTypeHandler extends BaseTypeHandler<Map> {

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, Map map, JdbcType jdbcType) throws SQLException {
        ps.setString(i, JSONUtil.toJsonStr(map));
    }

    public Map getNullableResult(ResultSet rs, String columnName) throws SQLException {
        return JSONUtil.toBean(rs.getString(columnName),Map.class);
    }

    public Map getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
        return JSONUtil.toBean(rs.getString(columnIndex),Map.class);
    }

    public Map getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
        return JSONUtil.toBean(cs.getString(columnIndex),Map.class);
    }
}