-- ----------------------------
2023-9-11
-- ----------------------------
ALTER TABLE mortals_xhx_user ADD COLUMN  `staffId` varchar(64)      COMMENT '员工Id，关联用户员工表';
ALTER TABLE mortals_xhx_user ADD COLUMN  `openId` varchar(64)      COMMENT '微信openId';

ALTER TABLE mortals_xhx_user ADD COLUMN  `serviceAprParams` varchar(1024) default ''     COMMENT '事件服务接口请求参数';
ALTER TABLE mortals_xhx_user ADD COLUMN  `customerId` bigint(20)    COMMENT '客户ID';
ALTER TABLE mortals_xhx_user ADD COLUMN  `shareCode` varchar(64)      COMMENT '员工分享码';


-- ----------------------------
-- 员工离职信息表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_staff_leave`;
CREATE TABLE mortals_xhx_staff_leave(
    `id` bigint(20)   AUTO_INCREMENT   COMMENT '序号，主键，自增长',
    `name` varchar(64)      COMMENT '员工姓名',
    `photoPath` varchar(255)      COMMENT '照片',
    `email` varchar(128)      COMMENT '邮件地址',
    `phoneNumber` varchar(128)      COMMENT '联系电话',
    `companyIds` varchar(128)      COMMENT '所属公司',
    `companyName` varchar(128)      COMMENT '所属公司名称',
    `positionName` varchar(128)      COMMENT '职位名称',
    `staffStatus` tinyint(2)    DEFAULT '3'  COMMENT '员工状态(1.正式,2.试用,3.离职)',
    `leaveDate` datetime      COMMENT '离职时间',
    `remark` varchar(255)      COMMENT '备注',
    `sumViews` int(4)    DEFAULT '0'  COMMENT '累计查看次数',
    `viewsByDay` int(4)    DEFAULT '0'  COMMENT '当日查看次数',
    `sendBusinessCardTimes` int(4)    DEFAULT '0'  COMMENT '发送名片次数',
    `createUserId` bigint(20) NOT NULL     COMMENT '创建用户',
    `createTime` datetime NOT NULL     COMMENT '创建时间',
    `updateUserId` bigint(20)      COMMENT '更新用户',
    `updateTime` datetime      COMMENT '更新时间',
PRIMARY KEY  (`id`)
,KEY `name` (`name`) USING BTREE
,KEY `companyIds` (`companyIds`) USING BTREE
,KEY `staffStatus` (`staffStatus`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工离职信息';



-- ----------------------------
-- 员工离职信息菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '员工离职信息', '/staff/leave/list', 0,'', 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);

-- ----------------------------
-- 员工离职信息资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '员工离职信息-菜单管理-查看', '/staff/leave/list,/staff/leave/view,/staff/leave/info,/staff/leave/export,/staff/leave/exportExcel,/staff/leave/downloadTemplate,/staff/leave/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '员工离职信息-菜单管理-维护', '/staff/leave/add,/staff/leave/edit,/staff/leave/delete,/staff/leave/logicDelete,/staff/leave/save,/staff/leave/importData', 3, 0, NULL, NULL, NULL, 0);

-- ----------------------------
-- 2024-11-20
-- ----------------------------
ALTER TABLE `mortals_xhx_bussinesscard` MODIFY COLUMN `companyId` bigint(20) DEFAULT NULL COMMENT '记录名片持有者所在公司或组织的名称ID';
ALTER TABLE `mortals_xhx_bussinesscard` ADD COLUMN `setting` varchar(256)   COMMENT '名片展示设置';
ALTER TABLE `mortals_xhx_bussinesscard` ADD COLUMN `companyAdress` varchar(256)   COMMENT '单位地址';
ALTER TABLE `mortals_xhx_news_record` ADD COLUMN `viewId` bigint(20)      COMMENT '查看人id';
ALTER TABLE `mortals_xhx_staff_record` ADD COLUMN `viewId` bigint(20)      COMMENT '查看人id';

-- ----------------------------
-- 名片访问记录信息表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_bussinesscard_record`;
CREATE TABLE mortals_xhx_bussinesscard_record(
    `id` bigint(20)   AUTO_INCREMENT   COMMENT '序号，主键，自增长',
    `bussinesscardId` bigint(20)   NOT NULL     COMMENT '名片ID',
    `viewId` bigint(20)      COMMENT '查看人id',
    `viewName` varchar(64)     COMMENT '查看人名称',
    `photoPath` varchar(255) COMMENT '头像地址',
    `sumViews` int(4)    DEFAULT '0'  COMMENT '累计查看次数',
    `remark` varchar(255)      COMMENT '备注',
    `viewTime` datetime    COMMENT '最后浏览时间',
    `createUserId` bigint(20)      COMMENT '创建用户',
    `createTime` datetime   COMMENT '创建时间',
    `updateUserId` bigint(20)      COMMENT '更新用户',
    `updateTime` datetime      COMMENT '更新时间',
PRIMARY KEY  (`id`)
,KEY `viewId` (`viewId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='名片访问记录信息';

ALTER TABLE `mortals_xhx_user` ADD COLUMN `photoPath` varchar(255) COMMENT '头像地址';
ALTER TABLE `mortals_xhx_user` ADD COLUMN `companyAdress` varchar(512)   COMMENT '单位地址';
ALTER TABLE `mortals_xhx_user` ADD COLUMN `nickName` varchar(128)   COMMENT '昵称';

INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('员工名片日访问数初始化', 'StaffViewsByDayInit', '0', 'StaffViewsByDayInit', NULL, NULL, '1', '0', '00:00', NULL, NULL, NULL, '0', NULL, '1', '系统管理员');

ALTER TABLE `mortals_xhx_bussinesscard` ADD COLUMN `backdrop` varchar(256)   COMMENT '名片背景';
ALTER TABLE `mortals_xhx_news` ADD COLUMN `upNums` tinyint(4) NOT NULL   DEFAULT '0'  COMMENT '点赞次数';
-- ----------------------------
-- 新闻点赞记录信息表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_news_up`;
CREATE TABLE mortals_xhx_news_up(
    `id` bigint(20)   AUTO_INCREMENT   COMMENT '序号，主键，自增长',
    `newsId` bigint(20)      COMMENT '新闻ID',
    `upId` bigint(20)      COMMENT '点赞人ID',
    `upName` varchar(64) NOT NULL     COMMENT '点赞人名称',
    `sumUp` int(4)    DEFAULT '0'  COMMENT '累计分享次数',
    `remark` varchar(255)      COMMENT '备注',
    `upTime` datetime NOT NULL     COMMENT '点赞时间',
    `createUserId` bigint(20) NOT NULL     COMMENT '创建用户',
    `createTime` datetime NOT NULL     COMMENT '创建时间',
    `updateUserId` bigint(20)      COMMENT '更新用户',
    `updateTime` datetime      COMMENT '更新时间',
PRIMARY KEY  (`id`)
,KEY `upName` (`upName`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='新闻点赞记录信息';
