-- 微笑榆山二期相关表结构修改
-- ——————————————————————————————————————————————————————————————————————————————————————————————————
-- 物业模块
DROP TABLE IF EXISTS `epdc_property`;
CREATE TABLE `epdc_property`  (
  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
  `PROPERTY_NAME` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物业名称',
  `PROPERTY_CODE` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物业编码',
  `EFFECTIVE_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否有效(0-否，1-是)',
  `REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
  `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记(0-否，1-是)',
  `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
  `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
  `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物业表' ROW_FORMAT = Compact;

INSERT INTO `epdc_property`(`ID`, `PROPERTY_NAME`, `PROPERTY_CODE`, `EFFECTIVE_FLAG`, `REVISION`, `DEL_FLAG`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('17528acce15b4a019a9034fd650924a6', '济南诚远物业管理有限公司', 'JNCHY', '1', 0, '0', '1263011454953480193', '2020-05-28 15:52:19', '1263011454953480193', '2020-05-28 15:52:19');
INSERT INTO `epdc_property`(`ID`, `PROPERTY_NAME`, `PROPERTY_CODE`, `EFFECTIVE_FLAG`, `REVISION`, `DEL_FLAG`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('aec3693e310ed0a706d8be5c4cf02574', '济南顺成物业管理有限公司', 'JNSHCH', '1', 0, '0', '1263011454953480193', '2020-05-28 15:51:55', '1263011454953480193', '2020-05-28 15:51:55');
INSERT INTO `epdc_property`(`ID`, `PROPERTY_NAME`, `PROPERTY_CODE`, `EFFECTIVE_FLAG`, `REVISION`, `DEL_FLAG`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('665e5f70f460c87899376aa09c3a2595', '济南会仙物业管理有限公司', 'JNHX', '1', 0, '0', '1263011454953480193', '2020-05-28 15:51:38', '1263011454953480193', '2020-05-28 15:51:38');
INSERT INTO `epdc_property`(`ID`, `PROPERTY_NAME`, `PROPERTY_CODE`, `EFFECTIVE_FLAG`, `REVISION`, `DEL_FLAG`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('774abdee6ee6be3598a1810c1b4beb6b', '济南瑞坤物业管理有限公司', 'JNRK', '1', 0, '0', '1263011454953480193', '2020-05-28 15:51:24', '1263011454953480193', '2020-05-28 15:51:24');
INSERT INTO `epdc_property`(`ID`, `PROPERTY_NAME`, `PROPERTY_CODE`, `EFFECTIVE_FLAG`, `REVISION`, `DEL_FLAG`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5c4f109f79cc5a51c7203117c3b460b3', '济南东通物业管理有限公司', 'JNDT', '1', 0, '0', '1263011454953480193', '2020-05-28 15:51:04', '1263011454953480193', '2020-05-28 15:51:04');


CREATE TABLE `epdc_police`  (
  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
  `POLICE_NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '民警名称',
  `POLICE_AVATAR` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '民警照片地址',
  `POLICE_TEL` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '民警联系方式',
  `POLICE_NO` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '警号',
  `DEPT_NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '民警所在机构名称',
  `DEPT_ID` bigint(20) NOT NULL COMMENT '民警所在机构id（此处存储社区id）',
  `DISPLAY_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '是否展示 0否 ，1是',
  `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记 0：未删除，1：已删除',
  `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁',
  `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
  `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
  `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
  `ALL_DEPT_IDS` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所有部门ID',
  `ALL_DEPT_NAMES` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所有部门名称',
  `PARENT_DEPT_IDS` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父所有部门',
  `PARENT_DEPT_NAMES` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父所有部门',
  PRIMARY KEY (`ID`) USING BTREE,
  INDEX `epdc_group_GRID_ID_IDX`(`DEPT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '民警表' ROW_FORMAT = Compact;

DROP TABLE IF EXISTS `epdc_property_project_score`;
CREATE TABLE `epdc_property_project_score`  (
  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
  `PROJECT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物业项目ID',
  `PROPERTY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物业ID',
  `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID',
  `SCORE` decimal(4, 1) NOT NULL DEFAULT 0.0 COMMENT '得分',
  `REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
  `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记(0-否，1-是)',
  `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
  `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
  `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物业项目得分表' ROW_FORMAT = Compact;

ALTER TABLE epdc_property_project ADD COLUMN `PROPERTY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '物业ID';
-- 话题表新增群类别字段
ALTER TABLE epdc_topic ADD COLUMN `GROUP_CATEGORY` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '群类别 2：物业群；3警民群';
-- 已有话题类别全部为物业群
UPDATE epdc_topic SET GROUP_CATEGORY = '2';




-- ——————————————————————————————————————————————————————————————————————————————————————————————————
-- 新闻模块
ALTER TABLE epdc_news_category ADD COLUMN `INDEPENDENT_FLAG` VARCHAR ( 1 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '是否有独立的模块功能 0:否;1:是';
--
UPDATE epdc_news_category SET `INDEPENDENT_FLAG` = '0';
INSERT INTO `epdc_news_category`(`ID`, `CATEGORY_NAME`, `CATEGORY_CODE`, `DESCRIPTION`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `INDEPENDENT_FLAG`) VALUES ('c3fa1d4d907f3d8b884eb635f1faeb22', '警情通报', 'police_notice', '微笑榆山-平安榆山-警情通报', 200, '0', 0, '1', '2020-05-26 16:29:53', '1', '2020-05-26 16:29:53', '1');
INSERT INTO `epdc_news_category`(`ID`, `CATEGORY_NAME`, `CATEGORY_CODE`, `DESCRIPTION`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `INDEPENDENT_FLAG`) VALUES ('df2d23bb3ce93af2aa254822c53620b9', '平安防范', 'safety_precautions', '微笑榆山-平安榆山-平安防范', 201, '0', 0, '1263011454953480193', '2020-05-21 17:32:37', '1263011454953480193', '2020-05-21 17:47:26', '1');
ALTER TABLE epdc_news MODIFY COLUMN NEWS_CONTENT MEDIUMTEXT;
ALTER TABLE epdc_notice MODIFY COLUMN NOTICE_CONTENT MEDIUMTEXT;

-- ——————————————————————————————————————————————————————————————————————————————————————————————————
-- api模块
CREATE TABLE `epdc_startup_page`  (
  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
  `IMG_URL` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '图片地址',
  `DURATION` int(11) NOT NULL COMMENT '停留时长 单位：秒',
  `ENABLE_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '启用标识 0：否，1：是',
  `REMARK` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁',
  `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
  `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
  `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
  `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
  `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
  `SORT` int(11) NULL DEFAULT 0 COMMENT '排序',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '启动页管理 启动页管理' ROW_FORMAT = Compact;

-- ——————————————————————————————————————————————————————————————————————————————————————————————————
-- admin模块
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263374024260476929, 0, '', 0, 'icon-file-markdown', '', 100, 0, 1, '2020-05-21 15:40:14', 1263011454953480193, '2020-05-26 14:11:33', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263374388162486273, 1263374024260476929, 'police/police', 0, 'icon-audit', '', 0, 0, 1, '2020-05-21 15:41:41', 1, '2020-05-21 15:41:41', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263374778954178561, 1263374024260476929, 'police/group', 0, 'icon-team', '', 10, 0, 1, '2020-05-21 15:43:14', 1263011454953480193, '2020-05-26 14:16:32', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263374898068217858, 1263374024260476929, 'police/topic', 0, '', '', 0, 1, 1, '2020-05-21 15:43:43', 1, '2020-05-21 15:48:37', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263375630787960834, 1263374024260476929, 'police/topic', 0, 'icon-codelibrary', '', 20, 0, 1, '2020-05-21 15:46:37', 1263011454953480193, '2020-05-26 14:16:49', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263376248533442562, 1263375630787960834, '', 1, '', 'police:topic:export', 0, 0, 1, '2020-05-21 15:49:05', 1263011454953480193, '2020-05-26 16:46:40', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263377067068645378, 1263374388162486273, '', 1, '', 'police:police:save', 0, 0, 1, '2020-05-21 15:52:20', 1265536510657060865, '2020-05-27 17:02:42', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263389245565853697, 1263374388162486273, '', 1, '', 'police:police:update', 0, 0, 1, '2020-05-21 16:40:43', 1265536510657060865, '2020-05-27 17:02:23', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1263389459173367809, 1263374388162486273, '', 1, '', 'police:police:delete', 0, 0, 1, '2020-05-21 16:41:34', 1265536510657060865, '2020-05-27 17:02:33', '');
INSERT INTO `sys_menu`(`id`, `pid`, `url`, `type`, `icon`, `permissions`, `sort`, `del_flag`, `creator`, `create_date`, `updater`, `update_date`, `menu_code`) VALUES (1265920816797736962, 1263374388162486273, '', 1, '', 'police:police:supplement', 3, 0, 1263011454953480193, '2020-05-28 16:20:17', 1263011454953480193, '2020-05-28 16:20:17', '');


INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263374024260476929, 'name', '警民管理', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263374388162486273, 'name', '民警管理', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263374778954178561, 'name', '警民群管理', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263374898068217858, 'name', '民警话题管理', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263375630787960834, 'name', '警民话题管理', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263377067068645378, 'name', '新增', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263389245565853697, 'name', '修改', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263389459173367809, 'name', '删除', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1265920816797736962, 'name', '警民群补建', 'zh-CN');
INSERT INTO `sys_language`(`table_name`, `table_id`, `field_name`, `field_value`, `language`) VALUES ('sys_menu', 1263376248533442562, 'name', '导出话题', 'zh-CN');
