alter table customer_staff drop column `PASSWORD`; alter table customer_staff drop column FACE_IMG; alter table customer_staff drop column IDENTITY_NO; alter table customer_staff MODIFY COLUMN GENDER int(1) COMMENT '性别0.未知,1男,2.女'; alter table customer_staff add column HEAD_PHOTO varchar(500) COMMENT '头像'; alter table customer_staff add column ACTIVE_FLAG varchar(20) not null COMMENT 'inactive未激活,active已激活'; alter table customer_staff add column ACTIVE_TIME DATETIME COMMENT '激活时间'; alter table customer_staff add column ENABLE_FLAG VARCHAR(20) not null COMMENT '未禁用enable,已禁用disabled'; alter table customer_staff add column WORK_TYPE VARCHAR(20) not null comment 'fulltime专职parttime兼职'; -- --2020-04-18 alter table customer_staff add column CUSTOMER_ID varchar(64) NOT NULL COMMENT '客户Id CUSTOMER.id'; -- --2020-04-18v2 CREATE TABLE `staff_wechat` ( `ID` varchar(64) NOT NULL COMMENT '唯一标识', `USER_ID` varchar(64) NOT NULL COMMENT '用户Id user.id', `WX_OPEN_ID` varchar(64) NOT NULL COMMENT 'openId', `WX_UNION_ID` varchar(64) DEFAULT NULL COMMENT '微信unionId', `MOBILE` varchar(11) DEFAULT NULL COMMENT '手机号', `NICKNAME` varchar(32) DEFAULT NULL COMMENT '昵称', `SEX` int(11) DEFAULT NULL COMMENT '性别', `HEAD_IMG_URL` varchar(1024) DEFAULT NULL COMMENT '头像', `COUNTRY` varchar(32) DEFAULT NULL COMMENT '国家', `PROVINCE` varchar(32) DEFAULT NULL COMMENT '省份', `CITY` varchar(32) DEFAULT NULL COMMENT '城市', `LANGUAGE` varchar(32) DEFAULT NULL COMMENT '语言', `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员微信关系表 '; alter table grid_latest MODIFY COLUMN PID VARCHAR(64) comment'上级组织ID (数据统计字段)'; alter table staff_wechat add column LATEST_LOGIN_TIME datetime NOT NULL COMMENT '最后一次登录时间'; alter table staff_wechat drop column LATEST_LOGIN_TIME; CREATE TABLE `staff_login_history` ( `ID` varchar(64) NOT NULL COMMENT '唯一标识', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', WX_OPEN_ID varchar(64) NOT NULL COMMENT '微信openId', `MOBILE` varchar(20) NOT NULL COMMENT '手机号', `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构id', `GRID_ID` varchar(64) COMMENT '网格表Id (CUSTOMER_GRID.id)', `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录日志表'; drop table if EXISTS staff_login_history; CREATE TABLE `staff_agency_visited` ( `ID` varchar(64) NOT NULL COMMENT '唯一标识', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', `WX_OPEN_ID` varchar(64) NOT NULL COMMENT '微信openId', `MOBILE` varchar(20) NOT NULL COMMENT '手机号', `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关单位id来源于customer_agency.id', `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入组织日志表'; CREATE TABLE `staff_grid_visited` ( `ID` varchar(64) NOT NULL COMMENT '唯一标识', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入网格日志表'; -- 2020.4.22 增加政府端角色表&政府工作人员-角色关系表 CREATE TABLE `staff_role` ( `ID` varchar(64) NOT NULL, `STAFF_ID` varchar(64) NOT NULL COMMENT '用户ID', `ROLE_ID` varchar(64) NOT NULL COMMENT '角色ID', `ORG_ID` varchar(255) DEFAULT NULL COMMENT '角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID', `DEL_FLAG` tinyint(1) DEFAULT NULL, `REVISION` int(10) DEFAULT NULL, `CREATED_BY` varchar(64) DEFAULT NULL, `CREATED_TIME` datetime DEFAULT NULL, `UPDATED_BY` varchar(64) DEFAULT NULL, `UPDATED_TIME` datetime DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员-角色关系表'; CREATE TABLE `gov_staff_role` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。', `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:agency,department,grid', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, `REVISION` int(10) NULL DEFAULT NULL, `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `CREATED_TIME` datetime(0) NULL DEFAULT NULL, `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色表' ROW_FORMAT = Dynamic; CREATE TABLE `gov_staff_role_template` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:org,dept,grid', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, `REVISION` int(10) NULL DEFAULT NULL, `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `CREATED_TIME` datetime(0) NULL DEFAULT NULL, `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色模板表' ROW_FORMAT = Dynamic; INSERT INTO `gov_staff_role_template` VALUES ('1', 'agency_leader', '单位领导', 'agency', 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('2', 'dept_leader', '部门领导', 'department', 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('3', 'party_principals', '党建负责人', '', 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('4', 'manager', '管理员', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('5', 'staff', '工作人员', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL); INSERT INTO `gov_staff_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL); -- --2020-04-26 ALTER TABLE customer_staff MODIFY COLUMN `EMAIL` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱' ; ALTER TABLE customer_staff MODIFY COLUMN `ADDRESS` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址';