init: initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
-- 植物养护后台管理系统 - 用户初始化数据
|
||||
-- 执行前请确保 users 表已存在
|
||||
-- 注意:密码需要根据实际加密方式进行处理
|
||||
|
||||
-- ============================================
|
||||
-- 用户数据
|
||||
-- 密码:123456 (请根据实际加密算法替换)
|
||||
-- ============================================
|
||||
|
||||
-- 超级管理员
|
||||
INSERT INTO users (id, account, name, nick_name, phone, client_id, created_at, updated_at) VALUES
|
||||
('user_admin', 'admin', '超级管理员', '管理员', '13800138000', 'pc', NOW(), NOW());
|
||||
|
||||
-- 运营管理员
|
||||
INSERT INTO users (id, account, name, nick_name, phone, client_id, created_at, updated_at) VALUES
|
||||
('user_operator', 'operator', '运营管理员', '小运营', '13800138001', 'pc', NOW(), NOW());
|
||||
|
||||
-- 内容编辑
|
||||
INSERT INTO users (id, account, name, nick_name, phone, client_id, created_at, updated_at) VALUES
|
||||
('user_editor', 'editor', '内容编辑', '小编辑', '13800138002', 'pc', NOW(), NOW());
|
||||
|
||||
-- 测试用户
|
||||
INSERT INTO users (id, account, name, nick_name, phone, client_id, created_at, updated_at) VALUES
|
||||
('user_test', 'test', '测试用户', '测试', '13800138003', 'pc', NOW(), NOW());
|
||||
|
||||
-- ============================================
|
||||
-- 用户角色关联(根据实际表结构调整)
|
||||
-- 假设关联表是 user_roles,字段是 user_id 和 role_id
|
||||
-- ============================================
|
||||
|
||||
INSERT INTO user_roles (user_id, role_id) VALUES
|
||||
('user_admin', 'role_admin'),
|
||||
('user_operator', 'role_operator'),
|
||||
('user_editor', 'role_editor'),
|
||||
('user_test', 'role_user');
|
||||
|
||||
-- ============================================
|
||||
-- 客户端数据(如果需要)
|
||||
-- ============================================
|
||||
|
||||
INSERT INTO clients (id, client_id, name, grant_type, active_timeout, created_at, updated_at) VALUES
|
||||
('client_pc', 'pc', 'PC管理端', 'password', 86400, NOW(), NOW()),
|
||||
('client_mini', 'mini', '小程序端', 'wechat', 604800, NOW(), NOW());
|
||||
|
||||
-- ============================================
|
||||
-- 查询验证
|
||||
-- ============================================
|
||||
-- SELECT u.account, u.name, r.name as role_name FROM user_roles ur
|
||||
-- JOIN users u ON ur.user_id = u.id
|
||||
-- JOIN roles r ON ur.role_id = r.id;
|
||||
Reference in New Issue
Block a user