From 75a51451fb11bf563dabac168c9b3d1051213ad4 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Tue, 19 Jul 2022 12:03:05 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=8E=BB=E6=8E=89=E6=89=80=E6=9C=89t?= =?UTF-8?q?=5Fcamera=5Fchannel01=E5=92=8Ct=5Fcamera=5Forganization02?= =?UTF-8?q?=E7=9A=84=E5=90=8E=E7=BC=80=E3=80=82=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?sql=E7=89=88=E6=9C=AC=E4=B8=BAt=5Fcamera=5Fchannel=E5=92=8Ct=5F?= =?UTF-8?q?camera=5Forganization=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....9__camechannelandorganization_add_col.sql | 6 +++++ .../monitor/entity/CameraChannelNew.java | 2 +- .../mapper/CameraOrgenizationMapper.java | 26 +++++++++---------- .../monitor/service/MonitorService.java | 7 +++-- .../mapper/monitor/CameraChannelMapper.xml | 8 +++--- .../monitor/CameraOrganizationMapper.xml | 4 +-- 6 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 config/db/V3.9__camechannelandorganization_add_col.sql diff --git a/config/db/V3.9__camechannelandorganization_add_col.sql b/config/db/V3.9__camechannelandorganization_add_col.sql new file mode 100644 index 00000000..ea691f7a --- /dev/null +++ b/config/db/V3.9__camechannelandorganization_add_col.sql @@ -0,0 +1,6 @@ +ALTER TABLE t_camera_channel ADD COLUMN region_code VARCHAR(255) COMMENT '市区编码'; +ALTER TABLE t_camera_channel ADD COLUMN region_name VARCHAR(255) COMMENT '市区名称'; + +ALTER TABLE t_camera_organization ADD COLUMN count INT DEFAULT(0); +ALTER TABLE t_camera_organization ADD COLUMN is_parent INT COMMENT '是否父节点'; +ALTER TABLE t_camera_organization ADD COLUMN path VARCHAR(500) COMMENT '从属关系'; \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java index 18e228f2..70f51a2f 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannelNew.java @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data -@TableName("t_camera_channel01") +@TableName("t_camera_channel") public class CameraChannelNew { @TableId diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java index 1bedc87c..872f9cf4 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraOrgenizationMapper.java @@ -17,51 +17,51 @@ public interface CameraOrgenizationMapper extends BaseDao { @Select("select * from t_camera_organization where parent_id = #{parentId}") List selectSubOrganization(@Param("parentId") String parentId); - @Select("select * from t_camera_organization02 where parent_id = #{parentId}") + @Select("select * from t_camera_organization where parent_id = #{parentId}") List selectSubOrganizationMap(@Param("parentId") String parentId); - @Select("select name,parent_id,id from t_camera_organization02 where path LIKE CONCAT(#{path},'%') ") + @Select("select name,parent_id,id from t_camera_organization where path LIKE CONCAT(#{path},'%') ") List selectSubOrganizationMapByPath(@Param("path") String path); void batchSaveOrgenization(List list); - @Select("SELECT name,parent_id,id,path FROM t_camera_organization02 WHERE id = #{id}") + @Select("SELECT name,parent_id,id,path FROM t_camera_organization WHERE id = #{id}") Map selectOrgenizationById(@Param("id") String id); - @Update("UPDATE t_camera_organization02 SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}") + @Update("UPDATE t_camera_organization SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}") void updateOrganizationPaht(@Param("path") String path,@Param("id") String id); - @Select(" SELECT id FROM t_camera_organization02") + @Select(" SELECT id FROM t_camera_organization") List listOrgenization(); - @Select(" SELECT name FROM t_camera_organization02 where substring(id,5) = #{idPart} and left(id,3) = '006'") + @Select(" SELECT name FROM t_camera_organization where substring(id,5) = #{idPart} and left(id,3) = '006'") String getNameByidPart(@Param("idPart")String idPart); - @Update("UPDATE t_camera_organization02 SET COUNT = COUNT + 1 WHERE id = #{id}") + @Update("UPDATE t_camera_organization SET COUNT = COUNT + 1 WHERE id = #{id}") void updateOrganizationCount(@Param("id") String id); void batchSaveCameraChannel(List list); - @Select("select * from t_camera_organization02") + @Select("select * from t_camera_organization") List testAll(); @Update("truncate table ${tableName}") void truncate(@Param("tableName") String tableName) ; - @Select("select orgaid,id,name,path from t_camera_organization02 order by orgaid") + @Select("select orgaid,id,name,path from t_camera_organization order by orgaid") List selectAllSubOrganizationMap(); - @Update("UPDATE t_camera_organization02 SET channelCount = #{channelCount} where orgaid = #{orgaId}") + @Update("UPDATE t_camera_organization SET channelCount = #{channelCount} where orgaid = #{orgaId}") void editChannelCount(@Param("channelCount") Integer channelCount,@Param("orgaId") Integer orgaId); @Update(" UPDATE t_region a inner join \n" + - " (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel01 GROUP BY region_code) b\n" + + " (SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code) b\n" + " ON a.region_code = b.region_code set a.channel_count = b.channel_count") void updateRegionChannelCount(); - @Select(" SELECT id FROM t_camera_organization02 WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization02 a INNER JOIN \n" + + @Select(" SELECT id FROM t_camera_organization WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization a INNER JOIN \n" + "\t(\n" + - "\t\tSELECT parent_id FROM t_camera_channel01 ORDER BY idt_camera_channel desc LIMIT 1\n" + + "\t\tSELECT parent_id FROM t_camera_channel ORDER BY idt_camera_channel desc LIMIT 1\n" + "\t) b ON a.id = b.parent_id \n" + ") ORDER BY orgaid ASC ") List listOrgenization2(); diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java index ebdd67ec..f15068d4 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/service/MonitorService.java @@ -1248,8 +1248,8 @@ public class MonitorService { //2、获取视频通道信息并保存,多线程版 @Async public void saveChannelInfoAsync() throws Exception { - //1-清空t_camera_channel01 - cameraOrgenMapper.truncate("t_camera_channel01"); + //1-清空t_camera_channel + cameraOrgenMapper.truncate("t_camera_channel"); //2-创建线程池 ExecutorService executorService = Executors.newFixedThreadPool(20);//20个线程足够 @@ -1294,6 +1294,9 @@ public class MonitorService { //6-更新完通道信息后,查询地区下通道的数量并更新到地区表和市区表中 editChannelCount(); + + //7-同步武伟达的t_channel_mtm_label数据 + } //单独保存视频通道信息 diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml index 640929c9..e8a299b8 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml @@ -117,7 +117,7 @@ @@ -135,7 +135,7 @@ * sin(radians( tcc.gps_y ))) AS `distance` FROM - t_camera_channel01 tcc + t_camera_channel tcc JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code JOIN t_label tl ON tl.label_code = tcml.label_code @@ -183,7 +183,7 @@ * sin(radians( tcc.gps_y ))) AS `distance` FROM - t_camera_channel01 tcc + t_camera_channel tcc JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code JOIN t_label tl ON tl.label_code = tcml.label_code @@ -215,6 +215,6 @@ \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml index bc024b3f..0aeae4d0 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml @@ -3,7 +3,7 @@ - INSERT INTO t_camera_organization02 ( + INSERT INTO t_camera_organization ( id,name,parent_id,sort,subCount,path,is_parent,is_root ) VALUES @@ -15,7 +15,7 @@ - INSERT INTO t_camera_channel01 + INSERT INTO t_camera_channel ( channel_code,channel_id,channel_name,gps_x,gps_y,status, parent_id,region_code,region_name,node_name