| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- -- 仅同步“公司信息”模块:不会修改 fa_news 或公司动态数据。
- CREATE TABLE IF NOT EXISTS `fa_company_info` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `address` VARCHAR(255) NOT NULL COMMENT '公司总部地址',
- `employee_count` VARCHAR(100) NOT NULL COMMENT '员工数量',
- `total_sales` VARCHAR(100) NOT NULL COMMENT '产品总销售额',
- `createtime` BIGINT NULL DEFAULT NULL COMMENT '创建时间',
- `updatetime` BIGINT NULL DEFAULT NULL COMMENT '更新时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公司信息';
- -- 兼容已创建旧表(总销售额为数值)的情况,改为允许汉字文本。
- ALTER TABLE `fa_company_info`
- MODIFY COLUMN `employee_count` VARCHAR(100) NOT NULL COMMENT '员工数量',
- MODIFY COLUMN `total_sales` VARCHAR(100) NOT NULL COMMENT '产品总销售额';
- INSERT IGNORE INTO `fa_auth_rule`
- (`type`, `pid`, `name`, `title`, `icon`, `url`, `condition`, `remark`, `ismenu`, `menutype`, `extend`, `py`, `pinyin`, `createtime`, `updatetime`, `weigh`, `status`)
- VALUES
- ('file', 0, 'company_info', '公司信息', 'fa fa-building', '', '', '', 1, NULL, '', 'gsxx', 'gongsixinxi', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal');
- SET @company_info_pid = (SELECT `id` FROM `fa_auth_rule` WHERE `name` = 'company_info' LIMIT 1);
- INSERT IGNORE INTO `fa_auth_rule`
- (`type`, `pid`, `name`, `title`, `icon`, `url`, `condition`, `remark`, `ismenu`, `menutype`, `extend`, `py`, `pinyin`, `createtime`, `updatetime`, `weigh`, `status`)
- VALUES
- ('file', @company_info_pid, 'company_info/index', '查看', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal'),
- ('file', @company_info_pid, 'company_info/add', '添加', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal'),
- ('file', @company_info_pid, 'company_info/edit', '编辑', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal'),
- ('file', @company_info_pid, 'company_info/del', '删除', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal'),
- ('file', @company_info_pid, 'company_info/multi', '批量更新', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 'normal');
- -- 给当前项目的“普通管理员”角色追加菜单权限;可重复执行。
- SET @company_info_rules = (
- SELECT GROUP_CONCAT(`id` ORDER BY `id` SEPARATOR ',')
- FROM `fa_auth_rule`
- WHERE `name` IN ('company_info', 'company_info/index', 'company_info/add', 'company_info/edit', 'company_info/del', 'company_info/multi')
- );
- UPDATE `fa_auth_group`
- SET `rules` = CONCAT_WS(',', NULLIF(CONVERT(`rules` USING utf8mb4), ''), CONVERT(@company_info_rules USING utf8mb4))
- WHERE `id` = 2
- AND FIND_IN_SET(
- CONVERT(@company_info_pid USING utf8mb4) COLLATE utf8mb4_unicode_ci,
- CONVERT(`rules` USING utf8mb4) COLLATE utf8mb4_unicode_ci
- ) = 0;
|