添加通道管理

结构优化
648540858 2023-08-25 15:49:56 +08:00
parent 288b4d4a41
commit 43fe078723
6 changed files with 448 additions and 18 deletions

View File

@ -2,11 +2,11 @@ CREATE TABLE `wvp_common_gb_channel`
( (
`common_gb_id` bigint unsigned NOT NULL AUTO_INCREMENT, `common_gb_id` bigint unsigned NOT NULL AUTO_INCREMENT,
`common_gb_device_id` varchar(50) NOT NULL, `common_gb_device_id` varchar(50) NOT NULL,
`common_gb_name` varchar(255) NOT NULL, `common_gb_name` varchar(255) DEFAULT NULL,
`common_gb_manufacturer` varchar(255) DEFAULT NULL, `common_gb_manufacturer` varchar(255) DEFAULT NULL,
`common_gb_model` varchar(255) DEFAULT NULL, `common_gb_model` varchar(255) DEFAULT NULL,
`common_gb_owner` varchar(255) DEFAULT NULL, `common_gb_owner` varchar(255) DEFAULT NULL,
`common_gb_civilCode` varchar(50) NOT NULL, `common_gb_civilCode` varchar(50) DEFAULT NULL,
`common_gb_block` varchar(255) DEFAULT NULL, `common_gb_block` varchar(255) DEFAULT NULL,
`common_gb_address` varchar(255) DEFAULT NULL, `common_gb_address` varchar(255) DEFAULT NULL,
`common_gb_parental` integer, `common_gb_parental` integer,
@ -21,7 +21,7 @@ CREATE TABLE `wvp_common_gb_channel`
`common_gb_ip_address` varchar(50) DEFAULT NULL, `common_gb_ip_address` varchar(50) DEFAULT NULL,
`common_gb_port` integer, `common_gb_port` integer,
`common_gb_password` varchar(50) DEFAULT NULL, `common_gb_password` varchar(50) DEFAULT NULL,
`common_gb_status` varchar(50) DEFAULT 'OFF', `common_gb_status` bool default false,
`common_gb_longitude` double, `common_gb_longitude` double,
`common_gb_latitude` double, `common_gb_latitude` double,
`common_gb_ptz_type` integer, `common_gb_ptz_type` integer,
@ -35,6 +35,8 @@ CREATE TABLE `wvp_common_gb_channel`
`common_gb_download_speed` varchar(255) DEFAULT NULL, `common_gb_download_speed` varchar(255) DEFAULT NULL,
`common_gb_svc_time_support_mode` integer, `common_gb_svc_time_support_mode` integer,
`type` varchar(255) NOT NULL, `type` varchar(255) NOT NULL,
`updateTime` varchar(50) NOT NULL,
`createTime` varchar(50) NOT NULL,
PRIMARY KEY (`common_gb_id`), PRIMARY KEY (`common_gb_id`),
UNIQUE KEY `common_gb_device_id` (`common_gb_device_id`) UNIQUE KEY `common_gb_device_id` (`common_gb_device_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

View File

@ -144,7 +144,7 @@ public class CommonGbChannel {
* () * ()
*/ */
@Schema(description = "设备状态(必选)") @Schema(description = "设备状态(必选)")
private String commonGbStatus; private Boolean commonGbStatus;
/** /**
* () * ()
@ -290,6 +290,18 @@ public class CommonGbChannel {
@Schema(description = "类型: 28181, push, proxy") @Schema(description = "类型: 28181, push, proxy")
private String type; private String type;
/**
*
*/
@Schema(description = "更新时间")
private String updateTime;
/**
*
*/
@Schema(description = "创建时间")
private String createTime;
public int getCommonGbId() { public int getCommonGbId() {
return commonGbId; return commonGbId;
} }
@ -458,11 +470,11 @@ public class CommonGbChannel {
this.commonGbPassword = commonGbPassword; this.commonGbPassword = commonGbPassword;
} }
public String getCommonGbStatus() { public boolean getCommonGbStatus() {
return commonGbStatus; return commonGbStatus;
} }
public void setCommonGbStatus(String commonGbStatus) { public void setCommonGbStatus(boolean commonGbStatus) {
this.commonGbStatus = commonGbStatus; this.commonGbStatus = commonGbStatus;
} }
@ -569,4 +581,24 @@ public class CommonGbChannel {
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
public void setCommonGbStatus(Boolean commonGbStatus) {
this.commonGbStatus = commonGbStatus;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
} }

View File

@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.common.CommonGbChannel;
import java.util.List;
public interface ICommonGbChannelService { public interface ICommonGbChannelService {
CommonGbChannel getChannel(String channelId); CommonGbChannel getChannel(String channelId);
@ -17,10 +19,8 @@ public interface ICommonGbChannelService {
/** /**
* *
* *
* @param gbDeviceId * @param gbDeviceId
* @param syncCoordinate TRUE 使 TRUE * @param syncKeys
* @param syncBusinessGroup TRUE使
* @param syncRegion TRUE使
*/ */
boolean SyncChannelFromGb28181Device(String gbDeviceId, boolean syncCoordinate, boolean syncBusinessGroup, boolean syncRegion); boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys);
} }

View File

@ -84,7 +84,7 @@ public class BusinessGroupServiceImpl implements IBusinessGroupService {
boolean result = false; boolean result = false;
if (!businessGroupInDb.getCommonBusinessGroupPath().equals(businessGroup.getCommonBusinessGroupPath())) { if (!businessGroupInDb.getCommonBusinessGroupPath().equals(businessGroup.getCommonBusinessGroupPath())) {
// 需要更新通道信息 // 需要更新通道信息
int updateCount = commonGbChannelDao.updateBusinessGroupPath(businessGroup.getCommonBusinessGroupPath()); int updateCount = commonGbChannelDao.updateBusinessGroupPath(businessGroupInDb.getCommonBusinessGroupPath(), businessGroup.getCommonBusinessGroupPath());
if (updateCount > 0) { if (updateCount > 0) {
dataSourceTransactionManager.rollback(transactionStatus); dataSourceTransactionManager.rollback(transactionStatus);
return false; return false;
@ -94,6 +94,7 @@ public class BusinessGroupServiceImpl implements IBusinessGroupService {
} else { } else {
result = businessGroupDao.update(businessGroup) > 0; result = businessGroupDao.update(businessGroup) > 0;
} }
dataSourceTransactionManager.commit(transactionStatus);
return result; return result;
} }

View File

@ -5,9 +5,14 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.service.ICommonGbChannelService; import com.genersoft.iot.vmp.service.ICommonGbChannelService;
import com.genersoft.iot.vmp.storager.dao.CommonGbChannelMapper; import com.genersoft.iot.vmp.storager.dao.CommonGbChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
@ -19,6 +24,12 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
@Autowired @Autowired
private DeviceChannelMapper deviceChannelMapper; private DeviceChannelMapper deviceChannelMapper;
@Autowired
DataSourceTransactionManager dataSourceTransactionManager;
@Autowired
TransactionDefinition transactionDefinition;
@Override @Override
public CommonGbChannel getChannel(String channelId) { public CommonGbChannel getChannel(String channelId) {
@ -42,16 +53,146 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
@Override @Override
public boolean checkChannelInPlatform(String channelId, String platformServerId) { public boolean checkChannelInPlatform(String channelId, String platformServerId) {
return commonGbChannelMapper.checkChannelInPlatform(channelId, platformServerId); return commonGbChannelMapper.checkChannelInPlatform(channelId, platformServerId) > 0;
} }
@Override @Override
public boolean SyncChannelFromGb28181Device(String gbDeviceId, boolean syncCoordinate, boolean syncBusinessGroup, boolean syncRegion) { public boolean SyncChannelFromGb28181Device(String gbDeviceId, List<String> syncKeys) {
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryAllChannels(gbDeviceId); List<DeviceChannel> deviceChannels = deviceChannelMapper.queryAllChannels(gbDeviceId);
if (deviceChannels.isEmpty()) { if (deviceChannels.isEmpty()) {
return false; return false;
} }
List<CommonGbChannel> commonGbChannelList = new ArrayList<>(deviceChannels.size());
for (DeviceChannel deviceChannel : deviceChannels) {
CommonGbChannel commonGbChannel = getCommonChannelFromDeviceChannel(deviceChannel, syncKeys);
commonGbChannelList.add(commonGbChannel);
}
int limit = 300;
boolean result;
if (commonGbChannelList.size() <= limit) {
result = commonGbChannelMapper.addAll(commonGbChannelList) > 0;
} else {
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
for (int i = 0; i < commonGbChannelList.size(); i += limit) {
int toIndex = i + limit;
if (i + limit > commonGbChannelList.size()) {
toIndex = commonGbChannelList.size();
}
List<CommonGbChannel> commonGbChannelListSub = commonGbChannelList.subList(i, toIndex);
int currentResult = commonGbChannelMapper.addAll(commonGbChannelListSub);
if (currentResult <= 0) {
dataSourceTransactionManager.rollback(transactionStatus);
return false;
}
}
dataSourceTransactionManager.commit(transactionStatus);
result = true;
}
return result;
}
return false; private CommonGbChannel getCommonChannelFromDeviceChannel(DeviceChannel deviceChannel, List<String> syncKeys) {
if (deviceChannel == null || syncKeys == null || syncKeys.isEmpty()) {
return null;
}
CommonGbChannel commonGbChannel = new CommonGbChannel();
commonGbChannel.setCommonGbDeviceID(deviceChannel.getChannelId());
for (String key : syncKeys) {
switch (key) {
case "commonGbName":
commonGbChannel.setCommonGbName(deviceChannel.getName());
break;
case "commonGbManufacturer":
commonGbChannel.setCommonGbManufacturer(deviceChannel.getManufacture());
break;
case "commonGbModel":
commonGbChannel.setCommonGbModel(deviceChannel.getModel());
break;
case "commonGbOwner":
commonGbChannel.setCommonGbOwner(deviceChannel.getOwner());
break;
case "commonGbCivilCode":
commonGbChannel.setCommonGbCivilCode(deviceChannel.getCivilCode());
break;
case "commonGbBlock":
commonGbChannel.setCommonGbBlock(deviceChannel.getBlock());
break;
case "commonGbAddress":
commonGbChannel.setCommonGbAddress(deviceChannel.getAddress());
break;
case "commonGbParental":
commonGbChannel.setCommonGbParental(deviceChannel.getParental());
break;
case "commonGbParentID":
commonGbChannel.setCommonGbParentID(deviceChannel.getParentId());
break;
case "commonGbSafetyWay":
commonGbChannel.setCommonGbSafetyWay(deviceChannel.getSafetyWay());
break;
case "commonGbRegisterWay":
commonGbChannel.setCommonGbRegisterWay(deviceChannel.getRegisterWay());
break;
case "commonGbCertNum":
commonGbChannel.setCommonGbCertNum(deviceChannel.getCertNum());
break;
case "commonGbCertifiable":
commonGbChannel.setCommonGbCertifiable(deviceChannel.getCertifiable());
break;
case "commonGbErrCode":
commonGbChannel.setCommonGbErrCode(deviceChannel.getErrCode());
break;
case "commonGbEndTime":
commonGbChannel.setCommonGbEndTime(deviceChannel.getEndTime());
break;
case "commonGbSecrecy":
if (NumberUtils.isParsable(deviceChannel.getSecrecy())) {
commonGbChannel.setCommonGbSecrecy(Integer.parseInt(deviceChannel.getSecrecy()));
}
break;
case "commonGbIPAddress":
commonGbChannel.setCommonGbIPAddress(deviceChannel.getIpAddress());
break;
case "commonGbPort":
commonGbChannel.setCommonGbPort(deviceChannel.getPort());
break;
case "commonGbPassword":
commonGbChannel.setCommonGbPassword(deviceChannel.getPassword());
break;
case "commonGbStatus":
commonGbChannel.setCommonGbStatus(deviceChannel.isStatus());
break;
case "commonGbLongitude":
commonGbChannel.setCommonGbLongitude(deviceChannel.getLongitude());
break;
case "commonGbLatitude":
commonGbChannel.setCommonGbLatitude(deviceChannel.getLatitude());
break;
case "commonGbPtzType":
commonGbChannel.setCommonGbPtzType(deviceChannel.getPTZType());
break;
case "commonGbPositionType":
commonGbChannel.setCommonGbPositionType(deviceChannel.getCommonGbPositionType());
break;
case "commonGbRoomType":
break;
case "commonGbUseType":
break;
case "commonGbSupplyLightType":
break;
case "commonGbDirectionType":
break;
case "commonGbResolution":
break;
case "commonGbBusinessGroupID":
commonGbChannel.setCommonGbBusinessGroupID(deviceChannel.getBusinessGroupId());
break;
case "commonGbDownloadSpeed":
break;
case "commonGbSVCTimeSupportMode":
break;
}
}
return commonGbChannel;
} }
} }

View File

@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.common.CommonGbChannel;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@ -9,21 +9,275 @@ import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface CommonGbChannelMapper { public interface CommonGbChannelMapper {
@Select(value = "select * from wvp_common_gb_channel where common_gb_business_group_id = '#{commonBusinessGroupPath}'")
List<CommonGbChannel> getChannels(String commonBusinessGroupPath); List<CommonGbChannel> getChannels(String commonBusinessGroupPath);
@Update(value = "<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_common_gb_channel SET " +
"updateTime= #{ item.updateTime} " +
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
" <if test='commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
" <if test='commonGbManufacturer != null' > ,common_gb_manufacturer= #{ item.commonGbManufacturer} </if>" +
" <if test='commonGbModel != null' > ,common_gb_model= #{ item.commonGbModel} </if>" +
" <if test='commonGbOwner != null' > ,common_gb_owner= #{ item.commonGbOwner} </if>" +
" <if test='commonGbCivilCode != null' > ,common_gb_civilCode= #{ item.commonGbCivilCode} </if>" +
" <if test='commonGbBlock != null' > ,common_gb_block= #{ item.commonGbBlock} </if>" +
" <if test='commonGbAddress != null' > ,common_gb_address= #{ item.commonGbAddress} </if>" +
" <if test='common_gb_parental != null' > ,common_gb_parental= #{ item.commonGbParental} </if>" +
" <if test='commonGbParentID != null' > ,common_gb_parent_id= #{ item.commonGbParentID} </if>" +
" <if test='commonGbSafetyWay != null' > ,common_gb_safety_way= #{ item.commonGbSafetyWay} </if>" +
" <if test='commonGbRegisterWay != null' > ,common_gb_register_way= #{ item.commonGbRegisterWay} </if>" +
" <if test='commonGbCertNum != null' > ,common_gb_cert_num= #{ item.commonGbCertNum} </if>" +
" <if test='commonGbCertifiable != null' > ,common_gb_certifiable= #{ item.commonGbCertifiable} </if>" +
" <if test='commonGbErrCode != null' > ,common_gb_err_code= #{ item.commonGbErrCode} </if>" +
" <if test='commonGbEndTime != null' > ,common_gb_end_time= #{ item.commonGbEndTime} </if>" +
" <if test='commonGbSecrecy != null' > ,common_gb_secrecy= #{ item.commonGbSecrecy} </if>" +
" <if test='commonGbIPAddress != null' > ,common_gb_ip_address= #{ item.commonGbIPAddress} </if>" +
" <if test='commonGbPort != null' > ,common_gb_port= #{ item.commonGbPort} </if>" +
" <if test='commonGbPassword != null' > ,common_gb_password= #{ item.commonGbPassword} </if>" +
" <if test='commonGbStatus != null' > ,common_gb_status= #{ item.commonGbStatus} </if>" +
" <if test='commonGbLongitude != null' > ,common_gb_longitude= #{ item.commonGbLongitude} </if>" +
" <if test='commonGbLatitude != null' > ,common_gb_latitude= #{ item.commonGbLatitude} </if>" +
" <if test='commonGbPtzType != null' > ,common_gb_ptz_type= #{ item.commonGbPtzType} </if>" +
" <if test='commonGbPositionType != null' > ,common_gb_position_type= #{ item.commonGbPositionType} </if>" +
" <if test='commonGbRoomType != null' > ,common_gb_room_type= #{ item.commonGbRoomType} </if>" +
" <if test='commonGbUseType != null' > ,common_gb_use_type= #{ item.commonGbUseType} </if>" +
" <if test='commonGbEndTime != null' > ,common_gb_supply_light_type= #{ item.commonGbSupplyLightType} </if>" +
" <if test='commonGbSupplyLightType != null' > ,common_gb_direction_type= #{ item.commonGbDirectionType} </if>" +
" <if test='commonGbResolution != null' > ,common_gb_resolution= #{ item.commonGbResolution} </if>" +
" <if test='commonGbBusinessGroupID != null' > ,common_gb_business_group_id= #{ item.commonGbBusinessGroupID} </if>" +
" <if test='commonGbDownloadSpeed != null' > ,common_gb_download_speed= #{ item.commonGbDownloadSpeed} </if>" +
" <if test='commonGbSVCTimeSupportMode != null' > ,common_gb_svc_time_support_mode= #{ item.commonGbSVCTimeSupportMode} </if>" +
" <if test='type != null' > ,type= #{ item.type} </if>" +
" WHERE common_gb_id=#{item.commonGbId}" +
"</foreach>" +
"</script>")
int updateChanelForBusinessGroup(List<CommonGbChannel> channels); int updateChanelForBusinessGroup(List<CommonGbChannel> channels);
@Delete(value = "<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"delete from wvp_common_gb_channel WHERE common_gb_id=#{item.commonGbId}" +
"</foreach>" +
"</script>")
int removeChannelsForBusinessGroup(List<CommonGbChannel> channels); int removeChannelsForBusinessGroup(List<CommonGbChannel> channels);
int updateBusinessGroupPath(String commonBusinessGroupPath); @Update("update wvp_common_gb_channel set common_gb_business_group_id = #{newPath} where common_gb_business_group_id = #{oldPath}")
int updateBusinessGroupPath(String oldPath, String newPath);
@Select("select * from wvp_common_gb_channel where common_gb_device_id=#{channelId}")
CommonGbChannel queryByDeviceID(String channelId); CommonGbChannel queryByDeviceID(String channelId);
@Insert(value = "<script>" +
"insert into wvp_common_gb_channel ( " +
"common_gb_device_id" +
" <if test='common_gb_name != null' > ,common_gb_name </if>" +
" <if test='common_gb_manufacturer != null' > ,common_gb_manufacturer </if>" +
" <if test='common_gb_model != null' > ,common_gb_model </if>" +
" <if test='common_gb_owner != null' > ,common_gb_owner </if>" +
" <if test='common_gb_civilCode != null' > ,common_gb_civilCode </if>" +
" <if test='common_gb_block != null' > ,common_gb_block </if>" +
" <if test='common_gb_address != null' > ,common_gb_address </if>" +
" <if test='common_gb_parental != null' > ,common_gb_parental </if>" +
" <if test='common_gb_parent_id != null' > ,common_gb_parent_id </if>" +
" <if test='common_gb_safety_way != null' > ,common_gb_safety_way </if>" +
" <if test='common_gb_register_way != null' > ,common_gb_register_way </if>" +
" <if test='common_gb_cert_num != null' > ,common_gb_cert_num </if>" +
" <if test='common_gb_certifiable != null' > ,common_gb_certifiable </if>" +
" <if test='common_gb_err_code != null' > ,common_gb_err_code </if>" +
" <if test='common_gb_end_time != null' > ,common_gb_end_time </if>" +
" <if test='common_gb_secrecy != null' > ,common_gb_secrecy </if>" +
" <if test='common_gb_ip_address != null' > ,common_gb_ip_address </if>" +
" <if test='common_gb_port != null' > ,common_gb_port </if>" +
" <if test='common_gb_password != null' > ,common_gb_password </if>" +
" <if test='common_gb_status != null' > ,common_gb_status </if>" +
" <if test='common_gb_longitude != null' > ,common_gb_longitude </if>" +
" <if test='common_gb_latitude != null' > ,common_gb_latitude </if>" +
" <if test='common_gb_ptz_type != null' > ,common_gb_ptz_type </if>" +
" <if test='common_gb_position_type != null' > ,common_gb_position_type </if>" +
" <if test='common_gb_room_type != null' > ,common_gb_room_type </if>" +
" <if test='common_gb_use_type != null' > ,common_gb_use_type </if>" +
" <if test='common_gb_supply_light_type != null' > ,common_gb_supply_light_type </if>" +
" <if test='common_gb_direction_type != null' > ,common_gb_direction_type </if>" +
" <if test='common_gb_resolution != null' > ,common_gb_resolution </if>" +
" <if test='common_gb_business_group_id != null' > ,common_gb_business_group_id </if>" +
" <if test='common_gb_download_speed != null' > ,common_gb_download_speed </if>" +
" <if test='common_gb_svc_time_support_mode != null' > ,common_gb_svc_time_support_mode </if>" +
" <if test='type != null' > ,type </if>" +
" <if test='updateTime != null' > ,updateTime </if>" +
" <if test='createTime != null' > ,createTime </if>" +
") values (" +
"#{commonGbDeviceID}" +
" <if test='common_gb_name != null' > ,#{commonGbName}</if>" +
" <if test='common_gb_manufacturer != null' > ,#{commonGbManufacturer}</if>" +
" <if test='common_gb_model != null' > ,#{commonGbModel}</if>" +
" <if test='common_gb_owner != null' > ,#{commonGbOwner}</if>" +
" <if test='common_gb_civilCode != null' > ,#{commonGbCivilCode}</if>" +
" <if test='common_gb_block != null' > ,#{commonGbBlock}</if>" +
" <if test='common_gb_address != null' > ,#{commonGbAddress}</if>" +
" <if test='common_gb_parental != null' > ,#{commonGbParental}</if>" +
" <if test='common_gb_parent_id != null' > ,#{commonGbParentID}</if>" +
" <if test='common_gb_safety_way != null' > ,#{commonGbSafetyWay}</if>" +
" <if test='common_gb_register_way != null' > ,#{commonGbRegisterWay}</if>" +
" <if test='common_gb_cert_num != null' > ,#{commonGbCertNum}</if>" +
" <if test='common_gb_certifiable != null' > ,#{commonGbCertifiable}</if>" +
" <if test='common_gb_err_code != null' > ,#{commonGbErrCode}</if>" +
" <if test='common_gb_end_time != null' > ,#{commonGbEndTime}</if>" +
" <if test='common_gb_secrecy != null' > ,#{commonGbSecrecy}</if>" +
" <if test='common_gb_ip_address != null' > ,#{commonGbIPAddress}</if>" +
" <if test='common_gb_port != null' > ,#{commonGbPort}</if>" +
" <if test='common_gb_password != null' > ,#{commonGbPassword}</if>" +
" <if test='common_gb_status != null' > ,#{commonGbStatus}</if>" +
" <if test='common_gb_longitude != null' > ,#{commonGbLongitude}</if>" +
" <if test='common_gb_latitude != null' > ,#{commonGbLatitude}</if>" +
" <if test='common_gb_ptz_type != null' > ,#{commonGbPtzType}</if>" +
" <if test='common_gb_position_type != null' > ,#{commonGbPositionType}</if>" +
" <if test='common_gb_room_type != null' > ,#{commonGbRoomType}</if>" +
" <if test='common_gb_use_type != null' > ,#{commonGbUseType}</if>" +
" <if test='common_gb_supply_light_type != null' > ,#{commonGbSupplyLightType}</if>" +
" <if test='common_gb_direction_type != null' > ,#{commonGbDirectionType}</if>" +
" <if test='common_gb_resolution != null' > ,#{commonGbResolution}</if>" +
" <if test='common_gb_business_group_id != null' > ,#{commonGbBusinessGroupID}</if>" +
" <if test='common_gb_download_speed != null' > ,#{commonGbDownloadSpeed}</if>" +
" <if test='common_gb_svc_time_support_mode != null' > ,#{commonGbSVCTimeSupportMode}</if>" +
" <if test='type != null' > ,#{type}</if>" +
" <if test='updateTime != null' > ,#{updateTime}</if>" +
" <if test='createTime != null' > ,#{createTime}</if>" +
")" +
"</script>")
int add(CommonGbChannel channel); int add(CommonGbChannel channel);
@Delete("delete from wvp_common_gb_channel where common_gb_device_id = #{channelId}")
int deleteByDeviceID(String channelId); int deleteByDeviceID(String channelId);
@Update(value = "<script>" +
"UPDATE wvp_common_gb_channel SET " +
"updateTime= #{ updateTime} " +
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ commonGbDeviceID} </if>" +
" <if test='commonGbName != null' > ,common_gb_name= #{ commonGbName} </if>" +
" <if test='commonGbManufacturer != null' > ,common_gb_manufacturer= #{ commonGbManufacturer} </if>" +
" <if test='commonGbModel != null' > ,common_gb_model= #{ commonGbModel} </if>" +
" <if test='commonGbOwner != null' > ,common_gb_owner= #{ commonGbOwner} </if>" +
" <if test='commonGbCivilCode != null' > ,common_gb_civilCode= #{ commonGbCivilCode} </if>" +
" <if test='commonGbBlock != null' > ,common_gb_block= #{ commonGbBlock} </if>" +
" <if test='commonGbAddress != null' > ,common_gb_address= #{ commonGbAddress} </if>" +
" <if test='common_gb_parental != null' > ,common_gb_parental= #{ commonGbParental} </if>" +
" <if test='commonGbParentID != null' > ,common_gb_parent_id= #{ commonGbParentID} </if>" +
" <if test='commonGbSafetyWay != null' > ,common_gb_safety_way= #{ commonGbSafetyWay} </if>" +
" <if test='commonGbRegisterWay != null' > ,common_gb_register_way= #{ commonGbRegisterWay} </if>" +
" <if test='commonGbCertNum != null' > ,common_gb_cert_num= #{ commonGbCertNum} </if>" +
" <if test='commonGbCertifiable != null' > ,common_gb_certifiable= #{ commonGbCertifiable} </if>" +
" <if test='commonGbErrCode != null' > ,common_gb_err_code= #{ commonGbErrCode} </if>" +
" <if test='commonGbEndTime != null' > ,common_gb_end_time= #{ commonGbEndTime} </if>" +
" <if test='commonGbSecrecy != null' > ,common_gb_secrecy= #{ commonGbSecrecy} </if>" +
" <if test='commonGbIPAddress != null' > ,common_gb_ip_address= #{ commonGbIPAddress} </if>" +
" <if test='commonGbPort != null' > ,common_gb_port= #{ commonGbPort} </if>" +
" <if test='commonGbPassword != null' > ,common_gb_password= #{ commonGbPassword} </if>" +
" <if test='commonGbStatus != null' > ,common_gb_status= #{ commonGbStatus} </if>" +
" <if test='commonGbLongitude != null' > ,common_gb_longitude= #{ commonGbLongitude} </if>" +
" <if test='commonGbLatitude != null' > ,common_gb_latitude= #{ commonGbLatitude} </if>" +
" <if test='commonGbPtzType != null' > ,common_gb_ptz_type= #{ commonGbPtzType} </if>" +
" <if test='commonGbPositionType != null' > ,common_gb_position_type= #{ commonGbPositionType} </if>" +
" <if test='commonGbRoomType != null' > ,common_gb_room_type= #{ commonGbRoomType} </if>" +
" <if test='commonGbUseType != null' > ,common_gb_use_type= #{ commonGbUseType} </if>" +
" <if test='commonGbEndTime != null' > ,common_gb_supply_light_type= #{ commonGbSupplyLightType} </if>" +
" <if test='commonGbSupplyLightType != null' > ,common_gb_direction_type= #{ commonGbDirectionType} </if>" +
" <if test='commonGbResolution != null' > ,common_gb_resolution= #{ commonGbResolution} </if>" +
" <if test='commonGbBusinessGroupID != null' > ,common_gb_business_group_id= #{ commonGbBusinessGroupID} </if>" +
" <if test='commonGbDownloadSpeed != null' > ,common_gb_download_speed= #{ commonGbDownloadSpeed} </if>" +
" <if test='commonGbSVCTimeSupportMode != null' > ,common_gb_svc_time_support_mode= #{ commonGbSVCTimeSupportMode} </if>" +
" <if test='type != null' > ,type= #{ type} </if>" +
" WHERE common_gb_id=#{commonGbId}" +
"</script>")
int update(CommonGbChannel channel); int update(CommonGbChannel channel);
boolean checkChannelInPlatform(String channelId, String platformServerId); @Select("select count(1)\n" +
"from wvp_common_gb_channel gc " +
"right join wvp_common_platform_channel pc " +
"on gc.common_gb_device_id = pc.common_gb_channel_id" +
"where gc.common_gb_device_id=#{channelId} and pc.platform_id=#{platformServerId}")
int checkChannelInPlatform(String channelId, String platformServerId);
@Insert(value = "<script>" +
"insert into wvp_common_gb_channel ( " +
"common_gb_device_id, " +
"common_gb_name, " +
"common_gb_manufacturer, " +
"common_gb_model, " +
"common_gb_owner, " +
"common_gb_civilCode, " +
"common_gb_block, " +
"common_gb_address, " +
"common_gb_parental, " +
"common_gb_parent_id, " +
"common_gb_safety_way, " +
"common_gb_register_way, " +
"common_gb_cert_num, " +
"common_gb_certifiable, " +
"common_gb_err_code, " +
"common_gb_end_time, " +
"common_gb_secrecy, " +
"common_gb_ip_address, " +
"common_gb_port, " +
"common_gb_password, " +
"common_gb_status, " +
"common_gb_longitude, " +
"common_gb_latitude, " +
"common_gb_ptz_type, " +
"common_gb_position_type, " +
"common_gb_room_type, " +
"common_gb_use_type, " +
"common_gb_supply_light_type, " +
"common_gb_direction_type, " +
"common_gb_resolution, " +
"common_gb_business_group_id, " +
"common_gb_download_speed, " +
"common_gb_svc_time_support_mode, " +
"type, " +
"updateTime, " +
"createTime " +
") values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"( #{commonGbDeviceID}, " +
"#{commonGbName}, " +
"#{commonGbManufacturer}, " +
"#{commonGbModel}, " +
"#{commonGbOwner}, " +
"#{commonGbCivilCode}, " +
"#{commonGbBlock}," +
"#{commonGbAddress}," +
"#{commonGbParental}," +
"#{commonGbParentID}," +
"#{commonGbSafetyWay}," +
"#{commonGbRegisterWay}," +
"#{commonGbCertNum}," +
"#{commonGbCertifiable}," +
"#{commonGbErrCode}," +
"#{commonGbEndTime}," +
"#{commonGbSecrecy}," +
"#{commonGbIPAddress}," +
"#{commonGbPort}," +
"#{commonGbPassword}," +
"#{commonGbStatus}," +
"#{commonGbLongitude}," +
"#{commonGbLatitude}," +
"#{commonGbPtzType}," +
"#{commonGbPositionType}," +
"#{commonGbRoomType}," +
"#{commonGbUseType}," +
"#{commonGbSupplyLightType}," +
"#{commonGbDirectionType}," +
"#{commonGbResolution}," +
"#{commonGbBusinessGroupID}," +
"#{commonGbDownloadSpeed}," +
"#{commonGbSVCTimeSupportMode}," +
"#{type}," +
"#{updateTime}," +
"#{createTime}" +
")" +
"</foreach>" +
"</script>")
int addAll(List<CommonGbChannel> commonGbChannelList);
} }