From 6f72e38a56bc6dc883fb6b33c412c87743e95f2f Mon Sep 17 00:00:00 2001 From: yitonglei Date: Fri, 22 Jul 2022 11:22:39 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81flyway=E5=A2=9E=E5=8A=A0V4.1=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8t=5Fregion=202=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=B8=AD=E6=A0=B9=E6=8D=AE=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E8=81=9A=E5=90=88=E6=9F=A5=E8=AF=A2=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8C=BA=E5=B8=82=E4=BF=A1=E6=81=AF=E4=BB=A5t=5Fregio?= =?UTF-8?q?n=E8=A1=A8=E4=B8=BA=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/db/V4.1__init_t_region.sql | 25 +++++++++++++++++++ .../mapper/CameraOrgenizationMapper.java | 15 +++++------ .../mapper/monitor/CameraChannelMapper.xml | 6 ++++- .../monitor/CameraOrganizationMapper.xml | 21 ++++++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 config/db/V4.1__init_t_region.sql diff --git a/config/db/V4.1__init_t_region.sql b/config/db/V4.1__init_t_region.sql new file mode 100644 index 00000000..d0dcf54e --- /dev/null +++ b/config/db/V4.1__init_t_region.sql @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS `t_region`; +CREATE TABLE `t_region` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `region_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `region_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `channel_count` int(0) NULL DEFAULT 0, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of t_region +-- ---------------------------- +INSERT INTO `t_region` VALUES (1, '市南区', '370202', 4367); +INSERT INTO `t_region` VALUES (2, '市北区', '370203', 7193); +INSERT INTO `t_region` VALUES (3, '西海岸新区', '370211', 41402); +INSERT INTO `t_region` VALUES (4, '崂山区', '370212', 19573); +INSERT INTO `t_region` VALUES (5, '李沧区', '370213', 5702); +INSERT INTO `t_region` VALUES (6, '城阳区', '370214', 14565); +INSERT INTO `t_region` VALUES (7, '即墨区', '370215', 13794); +INSERT INTO `t_region` VALUES (8, '高新区', '370271', 0); +INSERT INTO `t_region` VALUES (9, '胶州市', '370281', 14874); +INSERT INTO `t_region` VALUES (10, '平度市', '370283', 16383); +INSERT INTO `t_region` VALUES (11, '莱西市', '370285', 10046); + +SET FOREIGN_KEY_CHECKS = 1; 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 872f9cf4..4562507e 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 @@ -54,15 +54,12 @@ public interface CameraOrgenizationMapper extends BaseDao { @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_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_organization WHERE orgaid >(SELECT a.orgaid FROM t_camera_organization a INNER JOIN \n" + - "\t(\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(); +// @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_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/resources/mapper/monitor/CameraChannelMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml index f7055b14..beb03e0d 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml @@ -215,7 +215,11 @@ diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml index 0aeae4d0..8e52a2fc 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraOrganizationMapper.xml @@ -29,4 +29,25 @@ ) + + + UPDATE t_region a + INNER JOIN + ( + SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code + ) b + ON a.region_code = b.region_code + SET a.channel_count = b.channel_count + + + + + + + + + + + + \ No newline at end of file