杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
-- YumiNail 首次部署主 SQL
|
||||
-- YumiNail 最小运行初始化 SQL
|
||||
-- 说明:
|
||||
-- 1. 首次部署空库时,只需要执行本文件即可完成基础建表、结构补丁、权限种子、VIP 规则、admin01 初始化与默认权限分配。
|
||||
-- 1. 首次部署空库时,只需要执行本文件即可完成基础建表、结构补丁、权限种子、基础参数、协议、MessageHub、VIP 规则与管理员初始化。
|
||||
-- 2. 2026-03-20_user_asset_vip_coupon_permission_patch.sql、2026-03-25_user_shop_binding_and_shop_status_patch.sql、
|
||||
-- 2026-03-20_init_admin_permission_template.sql 仍保留用于已有数据库的增量升级,不再作为空库首选入口。
|
||||
-- 3. 当前 Nacos datasource.yaml 指向 nailart,本文件默认按该库名初始化;如果你的实际数据库名不同,请先统一 datasource 与下方库名。
|
||||
-- 4. 本文件只初始化一个平台管理员 xiaowang(默认密码 888888),不写入开发/验收用户、门店、作品、标签、订单、消息公告等业务数据。
|
||||
CREATE DATABASE IF NOT EXISTS nailart DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
use nailart;
|
||||
|
||||
@@ -14,6 +15,8 @@ create table t_balance
|
||||
primary key comment '余额表主键索引',
|
||||
user_id bigint unsigned not null comment '关联用户表主键',
|
||||
amount decimal(10, 2) default 0.00 not null comment '当前余额',
|
||||
total_recharge_amount decimal(10, 2) default 0.00 not null comment '累计充值金额',
|
||||
last_recharge_time datetime null comment '最近一次充值时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '余额账户创建时间',
|
||||
last_update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '最近一次更新时间',
|
||||
constraint uk_user_id
|
||||
@@ -31,6 +34,14 @@ create table t_balance_change_detail
|
||||
amount decimal(10, 2) not null comment '本次变动金额(正数为增加,负数为减少)',
|
||||
type varchar(20) not null comment '变动类型(如充值、消费、退款)',
|
||||
current_balance decimal(10, 2) not null comment '变动后的当前余额',
|
||||
before_balance decimal(10, 2) null comment '变动前余额',
|
||||
after_balance decimal(10, 2) null comment '变动后余额',
|
||||
change_scene varchar(32) null comment '余额变动场景',
|
||||
related_order_id bigint unsigned null comment '关联系统订单ID',
|
||||
related_order_no varchar(64) null comment '关联系统订单号',
|
||||
external_order_no varchar(64) null comment '手工录入的外部订单号',
|
||||
operator_id bigint unsigned null comment '操作人ID',
|
||||
remark varchar(255) null comment '备注',
|
||||
change_time datetime default CURRENT_TIMESTAMP not null comment '变动时间'
|
||||
)
|
||||
comment '用户余额变动明细表';
|
||||
@@ -116,6 +127,9 @@ create table t_coupon
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删',
|
||||
shop_id bigint null comment '所属店铺ID',
|
||||
coupon_scene varchar(32) default 'NORMAL' not null comment '优惠券场景',
|
||||
required_vip_level varchar(20) null comment '要求的VIP等级',
|
||||
auto_match tinyint unsigned default 0 not null comment '是否自动匹配',
|
||||
constraint uk_coupon_code
|
||||
unique (coupon_code) comment '优惠券编码唯一索引'
|
||||
)
|
||||
@@ -181,6 +195,7 @@ create table t_login_identity
|
||||
login_method varchar(50) not null comment '登录方式(0-手机号、1-账号、2-邮箱)',
|
||||
input_value varchar(100) not null comment '前端输入的具体值(如手机号、账号、邮箱)',
|
||||
input_time datetime not null comment '输入时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
status tinyint unsigned default 1 null comment '状态:1-有效,0-无效'
|
||||
)
|
||||
@@ -226,7 +241,7 @@ create table t_nail_artist_info
|
||||
identity varchar(50) default '' null comment '身份',
|
||||
experience int unsigned default 0 null comment '从业年限',
|
||||
skills text null comment '技能标签ID集合,多个ID以逗号分隔',
|
||||
rating decimal(3, 1) default 0.0 null comment '评分',
|
||||
rating decimal(3, 1) default 4.5 null comment '评分',
|
||||
status tinyint unsigned default 1 null comment '状态:1-营业中,0-休息中',
|
||||
participate_production tinyint unsigned default 1 not null comment '是否参与美甲制作:1-参与,0-不参与',
|
||||
work_start_time time null comment '工作开始时间',
|
||||
@@ -277,9 +292,12 @@ create table t_order
|
||||
primary key,
|
||||
order_no varchar(50) not null comment '订单编号',
|
||||
user_id bigint unsigned not null comment '关联用户表主键',
|
||||
shop_id bigint unsigned null comment '所属店铺ID',
|
||||
total_amount decimal(10, 2) not null comment '订单总金额',
|
||||
actual_amount decimal(10, 2) not null comment '实际支付金额',
|
||||
coupon_id bigint unsigned default 0 null comment '使用的优惠券ID',
|
||||
user_coupon_id bigint unsigned null comment '用户券ID',
|
||||
coupon_source_type varchar(32) null comment '优惠来源类型',
|
||||
status tinyint unsigned default 1 not null comment '订单状态:1-待使用,2-已完成,3-已取消',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
@@ -307,6 +325,7 @@ create table t_order_item
|
||||
quantity int unsigned not null comment '商品数量',
|
||||
price decimal(10, 2) not null comment '商品单价',
|
||||
artist_id bigint unsigned null comment '关联美甲师ID',
|
||||
appointment_time datetime null comment '预约开始时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删'
|
||||
@@ -408,6 +427,16 @@ create table t_shop
|
||||
latitude decimal(12, 8) null comment '店铺纬度',
|
||||
business_hours varchar(100) default '' null comment '店铺营业时间',
|
||||
cover_image_file_id varchar(50) default '' null comment '店铺封面图文件ID',
|
||||
theme_primary_color varchar(20) null comment '前台主题主色',
|
||||
theme_secondary_color varchar(20) null comment '前台主题辅色',
|
||||
theme_accent_color varchar(20) null comment '前台主题强调色',
|
||||
theme_page_bg_color varchar(20) null comment '前台主题页面背景色',
|
||||
theme_card_bg_color varchar(20) null comment '前台主题卡片背景色',
|
||||
theme_background_image_file_id varchar(50) null comment '前台主题背景图文件ID',
|
||||
status tinyint unsigned default 1 not null comment '店铺状态:1-启用,0-停用',
|
||||
authorization_start_date date null comment '店铺授权起始日',
|
||||
authorization_days int null comment '店铺授权有效天数',
|
||||
authorization_expire_time datetime null comment '店铺授权到期时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
is_delete tinyint unsigned default 0 null comment '逻辑删除:0-未删,1-已删',
|
||||
@@ -633,6 +662,9 @@ create table t_vip_benefit
|
||||
primary key comment 'VIP权益主键索引',
|
||||
benefit_info text not null comment '权益详情(如折扣、专属服务)',
|
||||
required_vip_level varchar(20) not null comment '所需VIP等级',
|
||||
level_rank int default 0 not null comment '等级序号',
|
||||
recharge_threshold decimal(10, 2) default 0.00 not null comment '累计充值门槛',
|
||||
status tinyint unsigned default 1 not null comment '状态',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
@@ -647,11 +679,13 @@ create table t_vip_info
|
||||
(
|
||||
id bigint unsigned auto_increment comment 'VIP信息唯一主键ID(雪花ID)'
|
||||
primary key comment 'VIP信息主键索引',
|
||||
user_id bigint unsigned null comment '所属用户ID',
|
||||
vip_level varchar(20) not null comment 'VIP等级(如青铜、白银)',
|
||||
start_time datetime not null comment 'VIP开通时间',
|
||||
expire_time datetime not null comment 'VIP到期时间',
|
||||
expire_time datetime null comment 'VIP到期时间',
|
||||
activation_method varchar(50) not null comment 'VIP开通方式(如购买、赠送)',
|
||||
benefit_id bigint unsigned not null comment '关联VIP权益信息表主键',
|
||||
benefit_id bigint unsigned null comment '关联VIP权益信息表主键',
|
||||
manual_override tinyint unsigned default 0 not null comment '是否手工覆盖VIP等级',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
@@ -783,6 +817,7 @@ CALL sp_add_column_if_not_exists('t_balance_change_detail', 'related_order_no',
|
||||
CALL sp_add_column_if_not_exists('t_balance_change_detail', 'external_order_no', 'varchar(64) NULL COMMENT ''手工录入的外部订单号''');
|
||||
CALL sp_add_column_if_not_exists('t_balance_change_detail', 'operator_id', 'bigint unsigned NULL COMMENT ''操作人ID''');
|
||||
CALL sp_add_column_if_not_exists('t_balance_change_detail', 'remark', 'varchar(255) NULL COMMENT ''备注''');
|
||||
CALL sp_add_column_if_not_exists('t_login_identity', 'create_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间''');
|
||||
|
||||
UPDATE t_balance_change_detail
|
||||
SET before_balance = COALESCE(before_balance, current_balance - amount),
|
||||
@@ -984,45 +1019,6 @@ WHERE NOT EXISTS (
|
||||
WHERE required_vip_level = '黄金'
|
||||
);
|
||||
|
||||
INSERT INTO t_coupon (
|
||||
coupon_code,
|
||||
coupon_name,
|
||||
coupon_type,
|
||||
discount_value,
|
||||
min_amount,
|
||||
reduce_amount,
|
||||
total_count,
|
||||
used_count,
|
||||
start_time,
|
||||
end_time,
|
||||
status,
|
||||
create_time,
|
||||
update_time,
|
||||
is_delete,
|
||||
shop_id,
|
||||
coupon_scene,
|
||||
required_vip_level,
|
||||
auto_match
|
||||
)
|
||||
VALUES
|
||||
('VIP_AUTO_BRONZE_95', '青铜VIP自动95折券', 1, 9.50, 0.00, 0.00, 999999, 0, NOW(), '2099-12-31 23:59:59', 1, NOW(), NOW(), 0, NULL, 'VIP_AUTO', '青铜', 1),
|
||||
('VIP_AUTO_SILVER_92', '白银VIP自动92折券', 1, 9.20, 0.00, 0.00, 999999, 0, NOW(), '2099-12-31 23:59:59', 1, NOW(), NOW(), 0, NULL, 'VIP_AUTO', '白银', 1),
|
||||
('VIP_AUTO_GOLD_90', '黄金VIP自动90折券', 1, 9.00, 0.00, 0.00, 999999, 0, NOW(), '2099-12-31 23:59:59', 1, NOW(), NOW(), 0, NULL, 'VIP_AUTO', '黄金', 1)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
coupon_name = VALUES(coupon_name),
|
||||
coupon_type = VALUES(coupon_type),
|
||||
discount_value = VALUES(discount_value),
|
||||
min_amount = VALUES(min_amount),
|
||||
reduce_amount = VALUES(reduce_amount),
|
||||
total_count = VALUES(total_count),
|
||||
status = VALUES(status),
|
||||
is_delete = VALUES(is_delete),
|
||||
shop_id = VALUES(shop_id),
|
||||
coupon_scene = VALUES(coupon_scene),
|
||||
required_vip_level = VALUES(required_vip_level),
|
||||
auto_match = VALUES(auto_match),
|
||||
update_time = NOW();
|
||||
|
||||
DROP PROCEDURE IF EXISTS sp_add_column_if_not_exists;
|
||||
DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists;
|
||||
DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists;
|
||||
@@ -1112,10 +1108,18 @@ END$$
|
||||
DELIMITER ;
|
||||
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'status', 'tinyint unsigned NOT NULL DEFAULT 1 COMMENT ''店铺状态:1-启用,0-停用''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'authorization_start_date', 'date NULL COMMENT ''店铺授权起始日''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'authorization_days', 'int NULL COMMENT ''店铺授权有效天数''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'authorization_expire_time', 'datetime NULL COMMENT ''店铺授权有效期,空表示长期有效''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'map_provider', 'varchar(20) NOT NULL DEFAULT ''TENCENT'' COMMENT ''地图服务商:TENCENT/AMAP''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'longitude', 'decimal(12,8) NULL COMMENT ''店铺经度''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'latitude', 'decimal(12,8) NULL COMMENT ''店铺纬度''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_primary_color', 'varchar(20) NULL COMMENT ''前台主题主色''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_secondary_color', 'varchar(20) NULL COMMENT ''前台主题辅色''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_accent_color', 'varchar(20) NULL COMMENT ''前台主题强调色''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_page_bg_color', 'varchar(20) NULL COMMENT ''前台主题页面背景色''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_card_bg_color', 'varchar(20) NULL COMMENT ''前台主题卡片背景色''');
|
||||
CALL sp_add_column_if_not_exists('t_shop', 'theme_background_image_file_id', 'varchar(50) NULL COMMENT ''前台主题背景图文件ID''');
|
||||
|
||||
UPDATE t_shop
|
||||
SET status = 1
|
||||
@@ -1217,7 +1221,7 @@ DROP PROCEDURE IF EXISTS sp_add_index_if_not_exists;
|
||||
DROP PROCEDURE IF EXISTS sp_add_unique_index_if_not_exists;
|
||||
|
||||
-- ========================================
|
||||
-- 首次部署整合区:权限种子 / admin01 初始化 / 默认权限分配
|
||||
-- 首次部署整合区:权限种子 / xiaowang 初始化 / 默认权限分配
|
||||
-- 来源:2026-03-20_init_admin_permission_template.sql
|
||||
-- ========================================
|
||||
|
||||
@@ -1274,9 +1278,9 @@ VALUES
|
||||
('message:create', '发布消息', '消息管理', '发布站内消息', NOW(), NOW(), 0),
|
||||
('message:delete', '撤回消息', '消息管理', '撤回已发布站内消息', NOW(), NOW(), 0)
|
||||
,
|
||||
('announcement:view', 'View Announcements', 'Announcement Management', 'View announcement list and detail', NOW(), NOW(), 0),
|
||||
('announcement:create', 'Create Announcements', 'Announcement Management', 'Publish announcements', NOW(), NOW(), 0),
|
||||
('announcement:delete', 'Withdraw Announcements', 'Announcement Management', 'Withdraw published announcements', NOW(), NOW(), 0)
|
||||
('announcement:view', '查看公告', '公告管理', '查看公告列表与详情', NOW(), NOW(), 0),
|
||||
('announcement:create', '发布公告', '公告管理', '发布公告', NOW(), NOW(), 0),
|
||||
('announcement:delete', '撤回公告', '公告管理', '撤回已发布公告', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_name = VALUES(permission_name),
|
||||
permission_group = VALUES(permission_group),
|
||||
@@ -1298,9 +1302,9 @@ ON DUPLICATE KEY UPDATE
|
||||
|
||||
INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000008011, 'announcement:view', 'View Announcements', 'Announcement Management', 'View announcement list and detail', NOW(), NOW(), 0),
|
||||
(910000000008012, 'announcement:create', 'Create Announcements', 'Announcement Management', 'Publish announcements', NOW(), NOW(), 0),
|
||||
(910000000008013, 'announcement:delete', 'Withdraw Announcements', 'Announcement Management', 'Withdraw published announcements', NOW(), NOW(), 0)
|
||||
(910000000008011, 'announcement:view', '查看公告', '公告管理', '查看公告列表与详情', NOW(), NOW(), 0),
|
||||
(910000000008012, 'announcement:create', '发布公告', '公告管理', '发布公告', NOW(), NOW(), 0),
|
||||
(910000000008013, 'announcement:delete', '撤回公告', '公告管理', '撤回已发布公告', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_name = VALUES(permission_name),
|
||||
permission_group = VALUES(permission_group),
|
||||
@@ -1327,10 +1331,10 @@ INSERT INTO t_user (
|
||||
SELECT
|
||||
0,
|
||||
'系统管理员',
|
||||
'admin01',
|
||||
'xiaowang',
|
||||
0,
|
||||
0,
|
||||
'$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W',
|
||||
'$2a$10$I3mV64NhISqMmm7soSki1.Y36ve.TOINGOrVt0U0kxjO7GtxavE16',
|
||||
'',
|
||||
'管理员',
|
||||
4,
|
||||
@@ -1342,7 +1346,7 @@ SELECT
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user
|
||||
WHERE account = 'admin01'
|
||||
WHERE account = 'xiaowang'
|
||||
);
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
@@ -1535,233 +1539,15 @@ ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
-- YumiNail 手工验收种子数据
|
||||
INSERT INTO t_nail_artist_info (user_id, identity, experience, skills, rating, status, participate_production, work_start_time, work_end_time, portfolio, create_time, update_time, is_delete)
|
||||
SELECT u.id, '店长', 3, '', 5.0, 1, 0, '09:00:00', '18:00:00', '', NOW(), NOW(), 0
|
||||
FROM t_user u
|
||||
WHERE u.type = 2 AND u.is_delete = 0
|
||||
AND NOT EXISTS (SELECT 1 FROM t_nail_artist_info nai WHERE nai.user_id = u.id AND nai.is_delete = 0);
|
||||
|
||||
UPDATE t_nail_artist_info nai
|
||||
INNER JOIN t_user u ON u.id = nai.user_id AND u.type = 3
|
||||
SET nai.participate_production = 1
|
||||
WHERE nai.participate_production IS NULL;
|
||||
|
||||
UPDATE t_nail_artist_info nai
|
||||
INNER JOIN t_user u ON u.id = nai.user_id AND u.type = 2
|
||||
SET nai.participate_production = COALESCE(nai.participate_production, 0);
|
||||
|
||||
-- 小型全覆盖验收数据,便于人工抽检。
|
||||
-- Password hash matches the existing admin seed password hash; reset in non-local environments if needed.
|
||||
INSERT INTO t_shop (id, shop_name, description, address, business_hours, cover_image_file_id, create_time, update_time, is_delete, image_file_ids, status)
|
||||
SELECT 910000000000001, '验收主店', '用于验收的主门店', '验收路 1 号', '09:00-21:00', '', NOW(), NOW(), 0, '', 1
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_shop WHERE id = 910000000000001);
|
||||
|
||||
INSERT INTO t_shop (id, shop_name, description, address, business_hours, cover_image_file_id, create_time, update_time, is_delete, image_file_ids, status)
|
||||
SELECT 910000000000002, '验收分店', '用于验收的分门店', '验收路 2 号', '10:00-20:00', '', NOW(), NOW(), 0, '', 1
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_shop WHERE id = 910000000000002);
|
||||
|
||||
INSERT INTO t_vip_info (id, vip_level, start_time, expire_time, activation_method, benefit_id, create_time, update_time)
|
||||
SELECT 910000000000101, '青铜会员', NOW(), DATE_ADD(NOW(), INTERVAL 1 YEAR), '验收种子数据', COALESCE((SELECT id FROM t_vip_benefit WHERE level_rank = 1 LIMIT 1), 0), NOW(), NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_vip_info WHERE id = 910000000000101);
|
||||
|
||||
INSERT INTO t_vip_info (id, vip_level, start_time, expire_time, activation_method, benefit_id, create_time, update_time)
|
||||
SELECT 910000000000102, '白银会员', NOW(), DATE_ADD(NOW(), INTERVAL 1 YEAR), '验收种子数据', COALESCE((SELECT id FROM t_vip_benefit WHERE level_rank = 2 LIMIT 1), 0), NOW(), NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_vip_info WHERE id = 910000000000102);
|
||||
|
||||
INSERT INTO t_vip_info (id, vip_level, start_time, expire_time, activation_method, benefit_id, create_time, update_time)
|
||||
SELECT 910000000000103, '黄金会员', NOW(), DATE_ADD(NOW(), INTERVAL 1 YEAR), '验收种子数据', COALESCE((SELECT id FROM t_vip_benefit WHERE level_rank = 3 LIMIT 1), 0), NOW(), NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_vip_info WHERE id = 910000000000103);
|
||||
|
||||
INSERT INTO t_user (id, shop_id, nickname, account, phone, email, phone_verified, email_verified, password, signature, level, type, vip_id, create_time, update_time, is_delete, status, avatar)
|
||||
VALUES
|
||||
(910000000001001, 910000000000001, '验收普通用户', 'accept_user_normal', '18800001001', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '普通用户', 0, 0, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000001002, 910000000000001, '验收青铜用户', 'accept_user_bronze', '18800001002', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '青铜会员', 0, 910000000000101, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000001003, 910000000000001, '验收白银用户', 'accept_user_silver', '18800001003', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '白银会员', 0, 910000000000102, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000001004, 910000000000001, '验收黄金用户', 'accept_user_gold', '18800001004', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '黄金会员', 0, 910000000000103, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000002001, 910000000000001, '验收店长', 'accept_manager_main', '18800002001', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '店长', 2, 0, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000002002, 910000000000001, '验收参与制作店长', 'accept_manager_artist', '18800002002', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '店长', 2, 0, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000002003, 910000000000002, '验收分店店长', 'accept_manager_branch', '18800002003', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '店长', 2, 0, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000003001, 910000000000001, '验收美甲师', 'accept_artist_main', '18800003001', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '美甲师', 3, 0, NOW(), NOW(), 0, 1, NULL),
|
||||
(910000000003002, 910000000000002, '验收分店美甲师', 'accept_artist_branch', '18800003002', NULL, 1, 0, '$2a$10$9v.6PztWy3.vmJiVMaOyKuWeVqAnpuHB3hQ3Dgiuz6L8IwBe7Cn9W', '', '美甲师', 3, 0, NOW(), NOW(), 0, 1, NULL)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
shop_id = VALUES(shop_id),
|
||||
nickname = VALUES(nickname),
|
||||
phone = VALUES(phone),
|
||||
level = VALUES(level),
|
||||
type = VALUES(type),
|
||||
vip_id = VALUES(vip_id),
|
||||
status = VALUES(status),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_user_shop_binding (user_id, shop_id, status, create_time, update_time, is_delete)
|
||||
SELECT u.id, u.shop_id, 1, NOW(), NOW(), 0
|
||||
FROM t_user u
|
||||
WHERE u.id BETWEEN 910000000001001 AND 910000000003002
|
||||
AND u.shop_id > 0
|
||||
ON DUPLICATE KEY UPDATE
|
||||
status = 1,
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_nail_artist_info (user_id, identity, experience, skills, rating, status, participate_production, work_start_time, work_end_time, portfolio, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000002001, '店长', 5, '门店管理', 5.0, 1, 0, '09:00:00', '18:00:00', '', NOW(), NOW(), 0),
|
||||
(910000000002002, '参与制作店长', 8, '美甲设计', 5.0, 1, 1, '09:30:00', '20:00:00', '', NOW(), NOW(), 0),
|
||||
(910000000002003, '分店店长', 4, '分店管理', 4.8, 1, 1, '10:00:00', '19:00:00', '', NOW(), NOW(), 0),
|
||||
(910000000003001, '美甲师', 3, '凝胶,护理', 4.9, 1, 1, '10:00:00', '21:00:00', '', NOW(), NOW(), 0),
|
||||
(910000000003002, '分店美甲师', 2, '基础护理,修复', 4.7, 1, 1, '10:00:00', '19:00:00', '', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
identity = VALUES(identity),
|
||||
experience = VALUES(experience),
|
||||
skills = VALUES(skills),
|
||||
rating = VALUES(rating),
|
||||
status = VALUES(status),
|
||||
participate_production = VALUES(participate_production),
|
||||
work_start_time = VALUES(work_start_time),
|
||||
work_end_time = VALUES(work_end_time),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_balance (user_id, amount, create_time, last_update_time, total_recharge_amount, last_recharge_time)
|
||||
VALUES
|
||||
(910000000001001, 68.00, NOW(), NOW(), 100.00, DATE_SUB(NOW(), INTERVAL 10 DAY)),
|
||||
(910000000001002, 288.00, NOW(), NOW(), 600.00, DATE_SUB(NOW(), INTERVAL 8 DAY)),
|
||||
(910000000001003, 588.00, NOW(), NOW(), 1200.00, DATE_SUB(NOW(), INTERVAL 6 DAY)),
|
||||
(910000000001004, 988.00, NOW(), NOW(), 2600.00, DATE_SUB(NOW(), INTERVAL 4 DAY))
|
||||
ON DUPLICATE KEY UPDATE
|
||||
amount = VALUES(amount),
|
||||
total_recharge_amount = VALUES(total_recharge_amount),
|
||||
last_recharge_time = VALUES(last_recharge_time),
|
||||
last_update_time = NOW();
|
||||
|
||||
INSERT INTO t_balance_change_detail (id, user_id, amount, type, current_balance, change_time)
|
||||
VALUES
|
||||
(910000000007001, 910000000001001, 100.00, 'RECHARGE', 100.00, DATE_SUB(NOW(), INTERVAL 10 DAY)),
|
||||
(910000000007002, 910000000001001, -32.00, 'CONSUME', 68.00, DATE_SUB(NOW(), INTERVAL 9 DAY)),
|
||||
(910000000007003, 910000000001002, 600.00, 'RECHARGE', 600.00, DATE_SUB(NOW(), INTERVAL 8 DAY)),
|
||||
(910000000007004, 910000000001002, -312.00, 'CONSUME', 288.00, DATE_SUB(NOW(), INTERVAL 7 DAY)),
|
||||
(910000000007005, 910000000001003, 1200.00, 'RECHARGE', 1200.00, DATE_SUB(NOW(), INTERVAL 6 DAY)),
|
||||
(910000000007006, 910000000001003, -612.00, 'CONSUME', 588.00, DATE_SUB(NOW(), INTERVAL 5 DAY)),
|
||||
(910000000007007, 910000000001004, 2600.00, 'RECHARGE', 2600.00, DATE_SUB(NOW(), INTERVAL 4 DAY)),
|
||||
(910000000007008, 910000000001004, -1612.00, 'CONSUME', 988.00, DATE_SUB(NOW(), INTERVAL 3 DAY))
|
||||
ON DUPLICATE KEY UPDATE
|
||||
amount = VALUES(amount),
|
||||
type = VALUES(type),
|
||||
current_balance = VALUES(current_balance),
|
||||
change_time = VALUES(change_time);
|
||||
|
||||
INSERT INTO t_product (id, shop_id, title, description, image_file_ids, price, tags, like_count, collect_count, approximate_duration, bookable_artists, available_coupons, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000004001, 910000000000001, '验收凝胶美甲', '可由普通美甲师和参与制作店长预约服务。', '', 168.00, '验收,凝胶', 0, 0, '90 分钟', '910000000003001,910000000002002', '', NOW(), NOW(), 0),
|
||||
(910000000004002, 910000000000001, '验收店长专属款', '用于验证参与制作店长的预约流程。', '', 268.00, '验收,店长', 0, 0, '120 分钟', '910000000002002', '', NOW(), NOW(), 0),
|
||||
(910000000004003, 910000000000002, '验收分店护理', '用于验证跨店不可预约的分店商品。', '', 128.00, '验收,分店', 0, 0, '60 分钟', '910000000003002,910000000002003', '', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
shop_id = VALUES(shop_id),
|
||||
title = VALUES(title),
|
||||
description = VALUES(description),
|
||||
price = VALUES(price),
|
||||
tags = VALUES(tags),
|
||||
approximate_duration = VALUES(approximate_duration),
|
||||
bookable_artists = VALUES(bookable_artists),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_cart (user_id, product_id, quantity, create_time, update_time, is_delete)
|
||||
VALUES (910000000001004, 910000000004001, 1, NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
quantity = VALUES(quantity),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_order (id, order_no, user_id, total_amount, actual_amount, coupon_id, status, create_time, update_time, is_delete)
|
||||
SELECT 910000000005001, 'ACCEPTANCE-ORDER-001', 910000000001004, 168.00, 168.00, 0, 1, NOW(), NOW(), 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM t_order WHERE order_no = 'ACCEPTANCE-ORDER-001');
|
||||
|
||||
INSERT INTO t_order_item (order_id, product_id, quantity, price, artist_id, create_time, update_time, is_delete)
|
||||
SELECT 910000000005001, 910000000004001, 1, 168.00, 910000000002002, NOW(), NOW(), 0
|
||||
WHERE EXISTS (SELECT 1 FROM t_order WHERE id = 910000000005001)
|
||||
AND NOT EXISTS (SELECT 1 FROM t_order_item WHERE order_id = 910000000005001 AND product_id = 910000000004001);
|
||||
|
||||
INSERT INTO t_system_message (id, title, content, publisher_id, publisher_name, publisher_type, target_type, target_ids, popup_enabled, status, publish_time, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000006001, '平台验收通知', '这是一条面向当前和后续新增用户的平台通知。', 910000000001001, '验收管理员', 4, 'PLATFORM_ALL', '', 1, 1, NOW(), NOW(), NOW(), 0),
|
||||
(910000000006002, '本店验收通知', '这是一条面向本店动态用户范围的店铺通知。', 910000000002002, '参与制作店长', 2, 'CURRENT_SHOP_ALL', '910000000000001', 1, 1, NOW(), NOW(), NOW(), 0),
|
||||
(910000000006003, '指定用户验收通知', '这是一条仅指定用户可见的通知。', 910000000002002, '参与制作店长', 2, 'SELECTED_USERS', '910000000001004', 1, 1, NOW(), NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
title = VALUES(title),
|
||||
content = VALUES(content),
|
||||
publisher_id = VALUES(publisher_id),
|
||||
publisher_name = VALUES(publisher_name),
|
||||
publisher_type = VALUES(publisher_type),
|
||||
target_type = VALUES(target_type),
|
||||
target_ids = VALUES(target_ids),
|
||||
popup_enabled = VALUES(popup_enabled),
|
||||
status = VALUES(status),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_system_message_user_state (message_id, user_id, popup_shown, read_status, popup_time, read_time, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000006001, 910000000001001, 1, 1, DATE_SUB(NOW(), INTERVAL 1 DAY), DATE_SUB(NOW(), INTERVAL 1 DAY), NOW(), NOW(), 0),
|
||||
(910000000006002, 910000000001002, 1, 0, DATE_SUB(NOW(), INTERVAL 2 HOUR), NULL, NOW(), NOW(), 0),
|
||||
(910000000006003, 910000000001004, 0, 0, NULL, NULL, NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
popup_shown = VALUES(popup_shown),
|
||||
read_status = VALUES(read_status),
|
||||
popup_time = VALUES(popup_time),
|
||||
read_time = VALUES(read_time),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
-- 小型全覆盖抽检数据可在空库初始化后按需扩展:管理员、店长、美甲师、普通用户、VIP 等级、商品、余额流水均由本初始化文件统一承载。
|
||||
|
||||
-- ========================================
|
||||
-- 雪花 ID 口径收口区:去掉运行时主键表的 AUTO_INCREMENT
|
||||
-- 说明:
|
||||
-- 1. 前面的建表与种子数据继续沿用旧链路,保证空库初始化过程不受影响
|
||||
-- 2. 本段在所有初始化数据完成后执行,将运行时已切到应用层雪花 ID 的表统一收口
|
||||
-- 3. 与 2026-03-30_snowflake_id_alignment_patch.sql 保持同口径
|
||||
-- 1. 前面的建表与基础配置种子继续沿用旧链路,保证空库初始化过程不受影响
|
||||
-- 2. 本段将运行时已切到应用层雪花 ID 的主键表统一收口
|
||||
-- 3. 后续基础配置插入均使用显式主键,与 2026-03-30_snowflake_id_alignment_patch.sql 保持同口径
|
||||
-- ========================================
|
||||
|
||||
INSERT INTO t_announcement (id, title, content, publisher_id, publisher_name, publisher_type, target_type, target_ids, status, sort_order, publish_time, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000010001, '平台公告', '平台公告:欢迎体验首页滚动公告功能。', 910000000001001, '验收管理员', 4, 'PLATFORM_ALL', '', 1, 10, NOW(), NOW(), NOW(), 0),
|
||||
(910000000010002, '本店公告', '本店公告:今日可预约店长参与制作服务。', 910000000002002, '参与制作店长', 2, 'CURRENT_SHOP_ALL', '910000000000001', 1, 20, NOW(), NOW(), NOW(), 0),
|
||||
(910000000010003, '专属公告', '专属公告:这是指定用户可见的验收公告。', 910000000002002, '参与制作店长', 2, 'SELECTED_USERS', '910000000001004', 1, 30, NOW(), NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
title = VALUES(title),
|
||||
content = VALUES(content),
|
||||
publisher_id = VALUES(publisher_id),
|
||||
publisher_name = VALUES(publisher_name),
|
||||
publisher_type = VALUES(publisher_type),
|
||||
target_type = VALUES(target_type),
|
||||
target_ids = VALUES(target_ids),
|
||||
status = VALUES(status),
|
||||
sort_order = VALUES(sort_order),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_vip_recharge_plan (id, shop_id, title, recharge_amount, gift_amount, vip_level, description, sort_order, status, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(910000000011001, 910000000000001, '充100送10', 100.00, 10.00, '青铜VIP', '适合轻量体验用户,仅展示不发起支付。', 10, 1, NOW(), NOW(), 0),
|
||||
(910000000011002, 910000000000001, '充500送80', 500.00, 80.00, '白银VIP', '适合常规护理用户,仅展示不发起支付。', 20, 1, NOW(), NOW(), 0),
|
||||
(910000000011003, 910000000000001, '充1000送200', 1000.00, 200.00, '黄金VIP', '适合高频预约用户,仅展示不发起支付。', 30, 1, NOW(), NOW(), 0),
|
||||
(910000000011004, 910000000000002, '分店充100送10', 100.00, 10.00, '青铜VIP', '分店验收充值档位。', 10, 1, NOW(), NOW(), 0),
|
||||
(910000000011005, 910000000000002, '分店充500送80', 500.00, 80.00, '白银VIP', '分店验收充值档位。', 20, 1, NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
shop_id = VALUES(shop_id),
|
||||
title = VALUES(title),
|
||||
recharge_amount = VALUES(recharge_amount),
|
||||
gift_amount = VALUES(gift_amount),
|
||||
vip_level = VALUES(vip_level),
|
||||
description = VALUES(description),
|
||||
sort_order = VALUES(sort_order),
|
||||
status = VALUES(status),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
DROP PROCEDURE IF EXISTS sp_drop_auto_increment_on_id_if_exists;
|
||||
|
||||
DELIMITER $$
|
||||
@@ -1896,7 +1682,7 @@ CREATE TABLE IF NOT EXISTS t_user_invite_code (
|
||||
|
||||
INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(313931273555136490, 'messagehub:config:manage', '管理MessageHub配置', '消息配置', '管理YumiNail投递MessageHub的场景级对接参数', NOW(), NOW(), 0)
|
||||
(313931273555136490, 'messagehub:config:manage', '管理消息参数', '参数管理', '管理地图 Key、短信 MessageHub 等平台参数', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_name = VALUES(permission_name),
|
||||
permission_group = VALUES(permission_group),
|
||||
@@ -1904,22 +1690,6 @@ ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT u.id, p.id, NOW(), NOW(), u.id, u.id, 0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND p.permission_code = 'messagehub:config:manage'
|
||||
WHERE u.is_delete = 0
|
||||
AND u.type = 4
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
AND up.is_delete = 0
|
||||
);
|
||||
|
||||
INSERT INTO t_messagehub_push_config (
|
||||
id,
|
||||
scene_code,
|
||||
@@ -2040,6 +1810,22 @@ CREATE TABLE IF NOT EXISTS t_system_parameter_config (
|
||||
UNIQUE KEY uk_system_parameter_group_key (config_group, config_key, is_delete)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统参数配置';
|
||||
|
||||
SET @system_parameter_enabled_missing := (
|
||||
SELECT COUNT(1) = 0
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 't_system_parameter_config'
|
||||
AND COLUMN_NAME = 'enabled'
|
||||
);
|
||||
SET @system_parameter_enabled_sql := IF(
|
||||
@system_parameter_enabled_missing,
|
||||
'ALTER TABLE t_system_parameter_config ADD COLUMN enabled tinyint NOT NULL DEFAULT 1 COMMENT ''是否启用:1启用,0停用'' AFTER config_value',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_system_parameter_enabled FROM @system_parameter_enabled_sql;
|
||||
EXECUTE stmt_system_parameter_enabled;
|
||||
DEALLOCATE PREPARE stmt_system_parameter_enabled;
|
||||
|
||||
INSERT INTO t_legal_agreement (id, agreement_type, title, version, content, status, effective_time, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(313931273555138001, 'USER_TERMS', '用户协议', '2026.05.18', '欢迎使用 YumiNail。请在使用账号、预约、订单、会员、消息等功能前仔细阅读本协议。继续登录或注册即表示你已理解并同意平台基础服务规则、账号安全要求、订单预约规则和依法合规使用要求。', 1, NOW(), NOW(), NOW(), 0),
|
||||
@@ -2054,7 +1840,7 @@ ON DUPLICATE KEY UPDATE
|
||||
|
||||
INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(313931273555136601, 'legal_agreement:manage', '协议管理', '安全管理', '管理用户协议和隐私政策版本', NOW(), NOW(), 0)
|
||||
(313931273555136601, 'legal_agreement:manage', '管理协议', '协议管理', '管理用户协议和隐私政策版本', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_name = VALUES(permission_name),
|
||||
permission_group = VALUES(permission_group),
|
||||
@@ -2062,29 +1848,39 @@ ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT u.id, p.id, NOW(), NOW(), u.id, u.id, 0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND p.permission_code = 'legal_agreement:manage'
|
||||
WHERE u.is_delete = 0
|
||||
AND u.type = 4
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
AND up.is_delete = 0
|
||||
);
|
||||
|
||||
INSERT INTO t_system_parameter_config (
|
||||
id, config_group, config_key, config_name, config_value, enabled, remark, create_time, update_time, is_delete
|
||||
)
|
||||
VALUES
|
||||
(313931273555139001, 'MAP', 'TENCENT_MAP_KEY', '腾讯位置服务 Key', '', 0, '用于后台店铺选点和腾讯地图展示;请在后台参数管理中填入真实 Key 后启用', NOW(), NOW(), 0)
|
||||
(313931273555139000, 'MAP', 'MAP_PROVIDER', '当前地图渠道', 'TENCENT', 1, 'TENCENT 或 AMAP;决定后台店铺选点默认使用哪个地图渠道', NOW(), NOW(), 0),
|
||||
(313931273555139001, 'MAP', 'TENCENT_MAP_KEY', '腾讯 Web Key', '', 0, '用于后台腾讯地图选点和 Web 展示;请在后台参数管理中填入真实 Key 后启用', NOW(), NOW(), 0),
|
||||
(313931273555139002, 'MAP', 'AMAP_WEB_KEY', '高德 Web Key', '', 0, '用于后台高德地图选点和 Web 展示;Web 端 Key 与小程序 Key 分开维护', NOW(), NOW(), 0),
|
||||
(313931273555139003, 'MAP', 'AMAP_MINI_KEY', '高德小程序 Key', '', 0, '用于后续小程序端高德 SDK/API 调用;不要与 Web Key 混用', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
config_name = VALUES(config_name),
|
||||
remark = VALUES(remark),
|
||||
config_value = IF(t_system_parameter_config.config_key = 'MAP_PROVIDER' AND (t_system_parameter_config.config_value IS NULL OR t_system_parameter_config.config_value = ''), VALUES(config_value), t_system_parameter_config.config_value),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
-- 最小运行初始化:确保 xiaowang 拥有当前权限目录中的全部权限。
|
||||
INSERT INTO t_user_permission (id, user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT
|
||||
313931273556000000 + p.id,
|
||||
u.id,
|
||||
p.id,
|
||||
NOW(),
|
||||
NOW(),
|
||||
u.id,
|
||||
u.id,
|
||||
0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
WHERE u.account = 'xiaowang'
|
||||
AND u.is_delete = 0
|
||||
AND u.type = 4
|
||||
ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_by = VALUES(update_by),
|
||||
update_time = NOW();
|
||||
|
||||
Reference in New Issue
Block a user