-- 微笑榆山二期相关表结构修改

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;

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';