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