From 3f83569edc5a9c5f4e4ef5f055ab253d8c41b488 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 1 Oct 2025 15:51:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91=E6=96=B0=E5=A2=9E=E7=AE=80=E5=8D=95=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=A4=84=E7=90=86=E5=99=A8=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=99=A8=EF=BC=8C=E4=BC=98=E5=8C=96=20JSON?= =?UTF-8?q?=20=E8=A7=A3=E6=9E=90=E9=97=AE=E9=A2=98=EF=BC=88=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=EF=BC=8C=E5=B7=B2=E7=BB=8F=E8=A7=A3=E5=86=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/SimpleTypeHandlerConfig.java | 33 ---------------- .../handler/SimpleObjectTypeHandler.java | 39 ------------------- .../mapper/device/IotDevicePropertyMapper.xml | 11 +----- 3 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/config/SimpleTypeHandlerConfig.java delete mode 100644 yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/handler/SimpleObjectTypeHandler.java diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/config/SimpleTypeHandlerConfig.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/config/SimpleTypeHandlerConfig.java deleted file mode 100644 index 7360e488ff..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/config/SimpleTypeHandlerConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.yudao.module.iot.framework.mybatis.config; - -import cn.iocoder.yudao.module.iot.framework.mybatis.handler.SimpleObjectTypeHandler; -import jakarta.annotation.PostConstruct; -import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.session.SqlSessionFactory; -import org.apache.ibatis.type.TypeHandlerRegistry; -import org.springframework.context.annotation.Configuration; - -/** - * 简单类型处理器配置 - * 注册自定义的类型处理器,避免 JSON 解析错误 - * - * @author 芋道源码 - */ -@Slf4j -@Configuration -public class SimpleTypeHandlerConfig { - - @Resource - private SqlSessionFactory sqlSessionFactory; - - @PostConstruct - public void registerTypeHandlers() { - TypeHandlerRegistry registry = sqlSessionFactory.getConfiguration().getTypeHandlerRegistry(); - - // 注册简单的 Object 类型处理器,避免 JSON 解析问题 - registry.register(java.lang.Object.class, new SimpleObjectTypeHandler()); - - log.info("简单类型处理器注册完成,避免 JSON 解析错误"); - } -} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/handler/SimpleObjectTypeHandler.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/handler/SimpleObjectTypeHandler.java deleted file mode 100644 index c61bf94258..0000000000 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/framework/mybatis/handler/SimpleObjectTypeHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.module.iot.framework.mybatis.handler; - -import org.apache.ibatis.type.BaseTypeHandler; -import org.apache.ibatis.type.JdbcType; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * 简单的 Object 类型处理器 - * 直接返回字符串,避免 JSON 解析问题 - * - * @author 芋道源码 - */ -public class SimpleObjectTypeHandler extends BaseTypeHandler { - - @Override - public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) - throws SQLException { - ps.setString(i, parameter.toString()); - } - - @Override - public Object getNullableResult(ResultSet rs, String columnName) throws SQLException { - return rs.getString(columnName); // 直接返回字符串 - } - - @Override - public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException { - return rs.getString(columnIndex); // 直接返回字符串 - } - - @Override - public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { - return cs.getString(columnIndex); // 直接返回字符串 - } -} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDevicePropertyMapper.xml b/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDevicePropertyMapper.xml index 85149d67a1..94da3feb47 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDevicePropertyMapper.xml +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDevicePropertyMapper.xml @@ -66,20 +66,13 @@ DESCRIBE product_property_${productId} - - - - -