-- 请按如下分类提交sql！！！
-- Version V3.5.47.0141
-- uat 2025-1-16/20
-- prod todo

------------------------------------
-- 表结构
------------------------------------

ALTER TABLE `zh_sub_project`
ADD COLUMN `page_show` varchar(5000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '{\"bwtz\":\"1\"}' COMMENT '前台页面或功能展示与隐藏' AFTER `lock_file`,
ADD COLUMN `fun_rela` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '功能设置(json.stringify)' AFTER `page_show`,
ADD COLUMN `data_collect` tinyint(1) NOT NULL DEFAULT 0 COMMENT '决策大屏是否显示及对应大屏编号' AFTER `fun_rela`,
ADD COLUMN `data_collect_pages` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '需要展示的大屏字符串，以，分隔' AFTER `data_collect`;

ALTER TABLE `zh_category`
ADD COLUMN `spid` varchar(36) NOT NULL DEFAULT '' COMMENT '子项目id（uuid）' AFTER `pid`;

ALTER TABLE `zh_category_value`
ADD COLUMN `spid` varchar(36) NOT NULL DEFAULT '' COMMENT '子项目id（uuid）' AFTER `pid`;

ALTER TABLE `zh_sub_project_permission`
ADD COLUMN `self_category_level` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' AFTER `update_time`;

ALTER TABLE `zh_project_log`
ADD COLUMN `spid` varchar(36) NOT NULL DEFAULT '' COMMENT '操作子项目' AFTER `pid`;

ALTER TABLE `zh_sub_project`
MODIFY COLUMN `rela_tender` varchar(5000) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '关联标段id(\',\'分隔)' AFTER `user_id`;

ALTER TABLE `zh_budget`
MODIFY COLUMN `rela_tender` varchar(5000) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '关联标段id(\',\'分隔)' AFTER `std_id`;

------------------------------------
-- 表数据
------------------------------------

UPDATE zh_project_log pl LEFT JOIN zh_tender t ON pl.tid = t.id SET pl.spid = IF(ISNULL(t.spid),'',t.spid);
