diff --git a/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java b/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java index 0eb75ff2..fc7f066d 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java @@ -628,6 +628,7 @@ public class CommonGbChannel { commonGbChannel.setCommonGbName(streamProxy.getName()); commonGbChannel.setCommonGbLongitude(streamProxy.getLongitude()); commonGbChannel.setCommonGbLatitude(streamProxy.getLatitude()); + commonGbChannel.setCommonGbStatus(true); commonGbChannel.setCreateTime(DateUtil.getNow()); commonGbChannel.setUpdateTime(DateUtil.getNow()); return commonGbChannel; diff --git a/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java index 03ef0994..cc923fec 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java @@ -28,6 +28,7 @@ public class MybatisConfig { if (userSetting.getSqlLog()){ config.setLogImpl(StdOutImpl.class); } + // 自动将数据库中的下划线转换为驼峰格式 config.setMapUnderscoreToCamelCase(true); sqlSessionFactory.setConfiguration(config); return sqlSessionFactory.getObject(); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java index 9f22defa..2b8ad3ca 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java @@ -95,6 +95,11 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { @Override public int add(CommonGbChannel channel) { + CommonGbChannel commonGbChannel = commonGbChannelMapper.queryByDeviceID(channel.getCommonGbDeviceID()); + if (commonGbChannel != null) { + channel.setCommonGbId(commonGbChannel.getCommonGbId()); + return update(channel); + } int result = commonGbChannelMapper.add(channel); if (result == 0) { return 0;