فهرست منبع

视频中心视频流处理

lipenghui 1 ماه پیش
والد
کامیت
89d7d2b7e8

+ 10 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/yanfan/sip/device/YfSipDeviceController.java

@@ -4,7 +4,9 @@ import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDe
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDeviceRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDeviceSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.YfSipDeviceDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
 import cn.iocoder.yudao.module.pms.service.yanfan.sip.device.YfSipDeviceService;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -95,4 +97,12 @@ public class YfSipDeviceController {
                         BeanUtils.toBean(list, YfSipDeviceRespVO.class));
     }
 
+
+    @Operation(summary = "查询监控设备树结构")
+    //@PreAuthorize("@ss.hasPermi('iot:video:list')")
+    @GetMapping("/listchannel/{deviceId}")
+    public CommonResult<List<BaseTree<YfSipDeviceChannelDO>>> listchannel(@PathVariable("deviceId") String deviceId) {
+        List<BaseTree<YfSipDeviceChannelDO>> baseTrees = yfSipDeviceService.selectSipDeviceChannelList(deviceId);
+        return success(baseTrees);
+    }
 }

+ 5 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/yanfan/sip/device/channel/YfSipDeviceChannelController.java

@@ -5,8 +5,11 @@ import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.device.YfSipDeviceService;
 import cn.iocoder.yudao.module.pms.service.yanfan.sip.device.channel.YfSipDeviceChannelService;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import lombok.extern.java.Log;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -42,6 +45,8 @@ public class YfSipDeviceChannelController {
 
     @Resource
     private YfSipDeviceChannelService yfSipDeviceChannelService;
+    @Autowired
+    private YfSipDeviceService yfSipDeviceService;
 
     @PostMapping("/create")
     @Operation(summary = "创建yf监控设备通道信息")

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/yanfan/sip/device/channel/YfSipDeviceChannelMapper.java

@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
 import liquibase.pro.packaged.Y;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * yf监控设备通道信息 Mapper
@@ -19,6 +20,11 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface YfSipDeviceChannelMapper extends BaseMapperX<YfSipDeviceChannelDO> {
+    List<YfSipDeviceChannelDO> selectChannelByCivilCode(@Param("deviceSipId") String deviceSipId, @Param("parentId") String parentId);
+    List<YfSipDeviceChannelDO> selectSipDeviceChannelByDeviceSipId(String deviceSipId);
+    List<YfSipDeviceChannelDO> selectChannelWithoutCiviCode(String deviceId);
+    List<YfSipDeviceChannelDO> selectChannelWithCivilCodeAndLength(@Param("deviceSipId") String deviceSipId, @Param("parentId") String parentId, @Param("length")Integer length);
+    Integer getChannelMinLength(String deviceSipId);
     int updateSipDeviceChannel(YfSipDeviceChannelDO sipDeviceChannel);
     List<YfSipDeviceChannelRespVO> selectSipDeviceChannelList(YfSipDeviceChannelDO sipDeviceChannel);
     YfSipDeviceChannelDO selectSipDeviceChannelByChannelSipId(String channelSipId);

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/sip/device/YfSipDeviceService.java

@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDevicePageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDeviceSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.YfSipDeviceDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import liquibase.pro.packaged.Y;
 
 import javax.validation.Valid;
@@ -16,6 +18,7 @@ import javax.validation.Valid;
  * @author 超级管理员
  */
 public interface YfSipDeviceService {
+    List<BaseTree<YfSipDeviceChannelDO>> selectSipDeviceChannelList(String deviceId);
     int updateSipDeviceStatus(YfSipDeviceDO sipDevice);
     boolean exists(String sipId);
     boolean updateDevice(YfSipDeviceDO device);

+ 12 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/sip/device/YfSipDeviceServiceImpl.java

@@ -5,8 +5,12 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDevicePageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.vo.YfSipDeviceSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.YfSipDeviceDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
 import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.sip.device.YfSipDeviceMapper;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.device.channel.YfSipDeviceChannelService;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import liquibase.pro.packaged.Y;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,6 +37,8 @@ public class YfSipDeviceServiceImpl implements YfSipDeviceService {
 
     @Resource
     private YfSipDeviceMapper yfSipDeviceMapper;
+    @Autowired
+    private YfSipDeviceChannelService yfSipDeviceChannelService;
 
     @Override
     public YfSipDeviceDO selectSipDeviceBySipId(String sipId)
@@ -51,6 +57,12 @@ public class YfSipDeviceServiceImpl implements YfSipDeviceService {
     }
 
 
+    @Override
+    public List<BaseTree<YfSipDeviceChannelDO>> selectSipDeviceChannelList(String deviceId) {
+        return yfSipDeviceChannelService.queryVideoDeviceTree(deviceId,null,false);
+    }
+
+
     @Override
     @TenantIgnore
     public boolean updateDevice(YfSipDeviceDO device) {

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/sip/device/channel/YfSipDeviceChannelService.java

@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo.YfSipDeviceChannelSaveReqVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import liquibase.pro.packaged.S;
 import liquibase.pro.packaged.Y;
 
@@ -18,6 +19,7 @@ import javax.validation.Valid;
  * @author 超级管理员
  */
 public interface YfSipDeviceChannelService {
+    List<BaseTree<YfSipDeviceChannelDO>> queryVideoDeviceTree(String deviceId, String parentId, boolean onlyCatalog);
     void updateChannel(String deviceId, YfSipDeviceChannelDO channel);
     List<YfSipDeviceChannelRespVO> selectSipDeviceChannelList(YfSipDeviceChannelDO sipDeviceChannel);
     int insertSipDeviceChannel(YfSipDeviceChannelSaveReqVO sipDeviceChannel);

+ 114 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/sip/device/channel/YfSipDeviceChannelServiceImpl.java

@@ -12,9 +12,12 @@ import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.device.channel.vo
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.sip.vo.VideoSessionInfo;
 import cn.iocoder.yudao.module.pms.controller.admin.yanfan.utils.SipUtil;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.product.IotYfProductDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.YfSipDeviceDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.sip.device.YfSipDeviceMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.sip.device.channel.YfSipDeviceChannelMapper;
 import cn.iocoder.yudao.module.pms.service.yanfan.product.IotYfProductService;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.model.BaseTree;
 import liquibase.pro.packaged.Y;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +53,8 @@ public class YfSipDeviceChannelServiceImpl implements YfSipDeviceChannelService
     private IotYfProductService iotYfProductService;
     @Autowired
     private VideoSessionManager streamSession;
+    @Autowired
+    private YfSipDeviceMapper yfSipDeviceMapper;
 
     /**
      * 新增监控设备通道信息
@@ -198,4 +203,113 @@ public class YfSipDeviceChannelServiceImpl implements YfSipDeviceChannelService
             yfSipDeviceChannelMapper.updateSipDeviceChannel(channel);
         }
     }
+
+    @Override
+    public List<BaseTree<YfSipDeviceChannelDO>> queryVideoDeviceTree(String deviceId, String parentId, boolean onlyCatalog) {
+        YfSipDeviceDO device = yfSipDeviceMapper.selectSipDeviceBySipId(deviceId);
+        if (device == null) {
+            return null;
+        }
+        if (parentId == null || parentId.equals(deviceId)) {
+            // 字根节点开始查询
+            List<YfSipDeviceChannelDO> rootNodes = getRootNodes(deviceId, true, !onlyCatalog);
+            return transportChannelsToTree(rootNodes, "");
+        }
+
+        if (parentId.length() % 2 != 0) {
+            return null;
+        }
+        if (parentId.length() == 10) {
+            if (onlyCatalog) {
+                return null;
+            }
+            // parentId为行业编码, 其下不会再有行政区划
+            List<YfSipDeviceChannelDO> channels = yfSipDeviceChannelMapper.selectChannelByCivilCode(deviceId, parentId);
+            return transportChannelsToTree(channels, parentId);
+        }
+        // 查询其下的行政区划和摄像机
+        List<YfSipDeviceChannelDO> channelsForCivilCode = yfSipDeviceChannelMapper.selectChannelWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2);
+        if (!onlyCatalog) {
+            List<YfSipDeviceChannelDO> channels = yfSipDeviceChannelMapper.selectChannelByCivilCode(deviceId, parentId);
+
+            for (YfSipDeviceChannelDO channel : channels) {
+                boolean flag = false;
+                for (YfSipDeviceChannelDO deviceChannel : channelsForCivilCode) {
+                    if (channel.getChannelSipId().equals(deviceChannel.getChannelSipId())) {
+                        flag = true;
+                    }
+                }
+                if (!flag) {
+                    channelsForCivilCode.add(channel);
+                }
+            }
+        }
+        return transportChannelsToTree(channelsForCivilCode, parentId);
+    }
+
+
+    private List<YfSipDeviceChannelDO> getRootNodes(String deviceId, boolean haveCatalog, boolean haveChannel) {
+        if (!haveCatalog && !haveChannel) {
+            return null;
+        }
+        List<YfSipDeviceChannelDO> result = new ArrayList<>();
+        // 使用行政区划
+        Integer length = yfSipDeviceChannelMapper.getChannelMinLength(deviceId);
+        if (length == null) {
+            return null;
+        }
+        if (length <= 10) {
+            if (haveCatalog) {
+                List<YfSipDeviceChannelDO> provinceNode = yfSipDeviceChannelMapper.selectChannelWithCivilCodeAndLength(deviceId, null, length);
+                if (provinceNode != null && provinceNode.size() > 0) {
+                    result.addAll(provinceNode);
+                }
+            }
+            if (haveChannel) {
+                // 查询那些civilCode不在通道中的不规范通道,放置在根目录
+                List<YfSipDeviceChannelDO> nonstandardNode = yfSipDeviceChannelMapper.selectChannelWithoutCiviCode(deviceId);
+                if (nonstandardNode != null && nonstandardNode.size() > 0) {
+                    result.addAll(nonstandardNode);
+                }
+            }
+        } else {
+            if (haveChannel) {
+                List<YfSipDeviceChannelDO> deviceChannels = yfSipDeviceChannelMapper.selectSipDeviceChannelByDeviceSipId(deviceId);
+                if (deviceChannels != null && deviceChannels.size() > 0) {
+                    result.addAll(deviceChannels);
+                }
+            }
+        }
+        return result;
+    }
+
+    private List<BaseTree<YfSipDeviceChannelDO>> transportChannelsToTree(List<YfSipDeviceChannelDO> channels, String parentId) {
+        if (channels == null) {
+            return null;
+        }
+        List<BaseTree<YfSipDeviceChannelDO>> treeNotes = new ArrayList<>();
+        if (channels.size() == 0) {
+            return treeNotes;
+        }
+        for (YfSipDeviceChannelDO channel : channels) {
+            BaseTree<YfSipDeviceChannelDO> node = new BaseTree<>();
+            node.setId(channel.getChannelSipId());
+            node.setDeviceId(channel.getDeviceSipId());
+            node.setName(channel.getChannelName());
+            node.setPid(parentId);
+            node.setBasicData(channel);
+            node.setParent(false);
+            if (channel.getChannelSipId().length() > 8) {
+                if (channel.getChannelSipId().length() > 13) {
+                    String gbCodeType = channel.getChannelSipId().substring(10, 13);
+                    node.setParent(gbCodeType.equals(SipUtil.BUSINESS_GROUP) || gbCodeType.equals(SipUtil.VIRTUAL_ORGANIZATION));
+                }
+            } else {
+                node.setParent(true);
+            }
+            treeNotes.add(node);
+        }
+        Collections.sort(treeNotes);
+        return treeNotes;
+    }
 }

+ 36 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/sip/model/BaseTree.java

@@ -0,0 +1,36 @@
+package cn.iocoder.yudao.module.pms.service.yanfan.sip.model;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.text.Collator;
+import java.util.Comparator;
+
+@Data
+public class BaseTree<T> implements Comparable<BaseTree>{
+    private String id;
+    private String deviceId;
+    private String pid;
+    private String name;
+    private boolean parent;
+    private T basicData;
+    @Override
+    public int compareTo(@NotNull BaseTree treeNode) {
+        if (this.parent || treeNode.isParent()) {
+            if (!this.parent && !treeNode.isParent()) {
+                Comparator<Object> cmp = Collator.getInstance(java.util.Locale.CHINA);
+                return cmp.compare(treeNode.getName(), this.getName());
+            }else {
+                if (this.isParent()) {
+                    return 1;
+                }else {
+                    return -1;
+                }
+            }
+        }else{
+            Comparator<Object> cmp = Collator.getInstance(java.util.Locale.CHINA);
+            return cmp.compare(treeNode.getName(), this.getName());
+        }
+    }
+
+}

+ 192 - 9
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/yanfan/YfSipDeviceChannelMapper.xml

@@ -111,26 +111,26 @@
                      <if test="registerTime != null ">and s.register_time = #{registerTime}</if>
                      <if test="deviceType != null  and deviceType != ''">and s.device_type = #{deviceType}</if>
                      <if test="channelType != null  and channelType != ''">and s.channel_type = #{channelType}</if>
-                     <if test="cityCode != null  and cityCode != ''">and s.cityCode = #{cityCode}</if>
-                     <if test="civilCode != null  and civilCode != ''">and s.civilCode = #{civilCode}</if>
+                     <if test="cityCode != null  and cityCode != ''">and s.city_code = #{cityCode}</if>
+                     <if test="civilCode != null  and civilCode != ''">and s.civil_code = #{civilCode}</if>
                      <if test="manufacture != null  and manufacture != ''">and s.manufacture = #{manufacture}</if>
                      <if test="model != null  and model != ''">and s.model = #{model}</if>
                      <if test="owner != null  and owner != ''">and s.owner = #{owner}</if>
                      <if test="block != null  and block != ''">and s.block = #{block}</if>
                      <if test="address != null  and address != ''">and s.address = #{address}</if>
-                     <if test="parentId != null  and parentId != ''">and s.parentId = #{parentId}</if>
-                     <if test="ipAddress != null  and ipAddress != ''">and s.ipAddress = #{ipAddress}</if>
+                     <if test="parentId != null  and parentId != ''">and s.parent_d = #{parentId}</if>
+                     <if test="ipAddress != null  and ipAddress != ''">and s.ip_address = #{ipAddress}</if>
                      <if test="port != null ">and s.port = #{port}</if>
                      <if test="password != null  and password != ''">and s.password = #{password}</if>
-                     <if test="ptzType != null ">and s.ptzType = #{ptzType}</if>
-                     <if test="ptzTypeText != null  and ptzTypeText != ''">and s.ptzTypeText = #{ptzTypeText}</if>
+                     <if test="ptzType != null ">and s.ptz_type = #{ptzType}</if>
+                     <if test="ptzTypeText != null  and ptzTypeText != ''">and s.ptz_type_text = #{ptzTypeText}</if>
                      <if test="status != null ">and s.status = #{status}</if>
                      <if test="longitude != null ">and s.longitude = #{longitude}</if>
                      <if test="latitude != null ">and s.latitude = #{latitude}</if>
-                     <if test="streamId != null  and streamId != ''">and s.streamId = #{streamId}</if>
-                     <if test="subCount != null ">and s.subCount = #{subCount}</if>
+                     <if test="streamId != null  and streamId != ''">and s.stream_id = #{streamId}</if>
+                     <if test="subCount != null ">and s.sub_count = #{subCount}</if>
                      <if test="parental != null ">and s.parental = #{parental}</if>
-                     <if test="hasAudio != null ">and s.hasAudio = #{hasAudio}</if>
+                     <if test="hasAudio != null ">and s.has_audio = #{hasAudio}</if>
               </where>
        </select>
 
@@ -177,4 +177,187 @@
         from rq_yf_sip_device_channel
         where channel_sip_id = #{channelSipId}
     </select>
+    <select id="getChannelMinLength" resultType="Integer">
+        select min(length(channel_sip_id)) as minLength
+        from rq_yf_sip_device_channel
+        where device_sip_id = #{deviceSipId}
+    </select>
+
+    <select id="selectChannelWithCivilCodeAndLength" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO">
+        select id,
+        tenant_id,
+        tenant_name,
+        product_id,
+        product_name,
+        user_id,
+        user_name,
+        device_sip_id,
+        channel_sip_id,
+        channel_name,
+        register_time,
+        device_type,
+        channel_type,
+        city_code,
+        civil_code,
+        manufacture,
+        model,
+        owner,
+        block,
+        address,
+        parent_id,
+        ip_address,
+        port,
+        password,
+        ptz_type,
+        ptz_type_text,
+        status,
+        longitude,
+        latitude,
+        stream_id,
+        sub_count,
+        parental,
+        has_audio,
+        del_flag,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        remark
+        from rq_yf_sip_device_channel
+        where device_sip_id = #{deviceSipId}
+        <if test='parentId != null and length != null' > and parent_id = #{parentid} or left(channel_sip_id, LENGTH(#{parentId})) = #{parentId} and length(channel_sip_id)=#{length} </if>
+        <if test='parentId == null and length != null' > and parent_id = #{parentid} or length(channel_sip_id)=#{length} </if>
+        <if test='parentId == null and length == null' > and parent_id = #{parentid} </if>
+        <if test='parentId != null and length == null' > and parent_id = #{parentid} or left(channel_sip_id, LENGTH(#{parentId})) = #{parentId} </if>
+    </select>
+
+    <select id="selectChannelWithoutCiviCode" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO">
+        select id,
+               tenant_id,
+               tenant_name,
+               product_id,
+               product_name,
+               user_id,
+               user_name,
+               device_sip_id,
+               channel_sip_id,
+               channel_name,
+               register_time,
+               device_type,
+               channel_type,
+               city_code,
+               civil_code,
+               manufacture,
+               model,
+               owner,
+               block,
+               address,
+               parent_id,
+               ip_address,
+               port,
+               password,
+               ptz_type,
+               ptz_type_text,
+               status,
+               longitude,
+               latitude,
+               stream_id,
+               sub_count,
+               parental,
+               has_audio,
+               del_flag,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from rq_yf_sip_device_channel
+        where device_sip_id=#{deviceSipId} and civil_code not in (select civilCode from sip_device_channel where device_sip_id=#{deviceSipId} group by civilCode)
+    </select>
+    <select id="selectSipDeviceChannelByDeviceSipId" parameterType="String" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO">
+        select id,
+               tenant_id,
+               tenant_name,
+               product_id,
+               product_name,
+               user_id,
+               user_name,
+               device_sip_id,
+               channel_sip_id,
+               channel_name,
+               register_time,
+               device_type,
+               channel_type,
+               city_code,
+               civil_code,
+               manufacture,
+               model,
+               owner,
+               block,
+               address,
+               parent_id,
+               ip_address,
+               port,
+               password,
+               ptz_type,
+               ptz_type_text,
+               status,
+               longitude,
+               latitude,
+               stream_id,
+               sub_count,
+               parental,
+               has_audio,
+               del_flag,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from rq_yf_sip_device_channel
+        where device_sip_id = #{deviceSipId}
+    </select>
+    <select id="selectChannelByCivilCode" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO">
+        select id,
+               tenant_id,
+               tenant_name,
+               product_id,
+               product_name,
+               user_id,
+               user_name,
+               device_sip_id,
+               channel_sip_id,
+               channel_name,
+               register_time,
+               device_type,
+               channel_type,
+               city_code,
+               civil_code,
+               manufacture,
+               model,
+               owner,
+               block,
+               address,
+               parent_id,
+               ip_address,
+               port,
+               password,
+               ptz_type,
+               ptz_type_text,
+               status,
+               longitude,
+               latitude,
+               stream_id,
+               sub_count,
+               parental,
+               has_audio,
+               del_flag,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from rq_yf_sip_device_channel
+        where device_sip_id = #{deviceSipId} and length(channel_sip_id)>14 and civil_code=#{parentId}
+    </select>
 </mapper>