-- 达梦数据库种子数据 (INSERT only, tables already exist)
-- 在 DBeaver/Navicat 中直接执行此文件

-- 只删除种子数据，保留已导入的菜单(83行)
DELETE FROM SYS_USER_ROLE;
DELETE FROM SYS_USER_POST;
DELETE FROM SYS_ROLE_DEPT;
DELETE FROM SYS_USER;
DELETE FROM SYS_POST;
DELETE FROM SYS_DEPT;
DELETE FROM SYS_ROLE;
DELETE FROM SYS_DICT_DATA;
DELETE FROM SYS_DICT_TYPE;
DELETE FROM SYS_CONFIG;
DELETE FROM SYS_JOB;
DELETE FROM SYS_NOTICE;

-- 部门
INSERT INTO SYS_DEPT VALUES(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);
INSERT INTO SYS_DEPT VALUES(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', SYSDATE, '', NULL);

-- 用户 (admin/admin123, ry/admin123 的 bcrypt hash)
INSERT INTO SYS_USER VALUES(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', SYSDATE, SYSDATE, 'admin', SYSDATE, '', NULL, '管理员');
INSERT INTO SYS_USER VALUES(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', SYSDATE, SYSDATE, 'admin', SYSDATE, '', NULL, '测试员');

-- 岗位
INSERT INTO SYS_POST VALUES(1, 'ceo', '董事长', 1, '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_POST VALUES(2, 'se', '项目经理', 2, '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_POST VALUES(3, 'hr', '人力资源', 3, '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_POST VALUES(4, 'user', '普通员工', 4, '0', 'admin', SYSDATE, '', NULL, '');

-- 角色
INSERT INTO SYS_ROLE VALUES('1', '超级管理员', 'admin', 1, '1', 1, 1, '0', '0', 'admin', SYSDATE, '', NULL, '超级管理员');
INSERT INTO SYS_ROLE VALUES('2', '普通角色', 'common', 2, '2', 1, 1, '0', '0', 'admin', SYSDATE, '', NULL, '普通角色');

-- 用户角色关联
INSERT INTO SYS_USER_ROLE VALUES('1', '1');
INSERT INTO SYS_USER_ROLE VALUES('2', '2');

-- 用户岗位关联
INSERT INTO SYS_USER_POST VALUES('1', '1');
INSERT INTO SYS_USER_POST VALUES('2', '2');

-- 角色部门关联
INSERT INTO SYS_ROLE_DEPT VALUES('2', '100');
INSERT INTO SYS_ROLE_DEPT VALUES('2', '101');
INSERT INTO SYS_ROLE_DEPT VALUES('2', '105');

-- 字典类型
INSERT INTO SYS_DICT_TYPE VALUES(1, '用户性别', 'sys_user_sex', '0', 'admin', SYSDATE, '', NULL, '用户性别列表');
INSERT INTO SYS_DICT_TYPE VALUES(2, '菜单状态', 'sys_show_hide', '0', 'admin', SYSDATE, '', NULL, '菜单状态列表');
INSERT INTO SYS_DICT_TYPE VALUES(3, '系统开关', 'sys_normal_disable', '0', 'admin', SYSDATE, '', NULL, '系统开关列表');
INSERT INTO SYS_DICT_TYPE VALUES(4, '任务状态', 'sys_job_status', '0', 'admin', SYSDATE, '', NULL, '任务状态列表');
INSERT INTO SYS_DICT_TYPE VALUES(5, '任务分组', 'sys_job_group', '0', 'admin', SYSDATE, '', NULL, '任务分组列表');
INSERT INTO SYS_DICT_TYPE VALUES(6, '系统是否', 'sys_yes_no', '0', 'admin', SYSDATE, '', NULL, '系统是否列表');
INSERT INTO SYS_DICT_TYPE VALUES(7, '通知类型', 'sys_notice_type', '0', 'admin', SYSDATE, '', NULL, '通知类型列表');
INSERT INTO SYS_DICT_TYPE VALUES(8, '通知状态', 'sys_notice_status', '0', 'admin', SYSDATE, '', NULL, '通知状态列表');
INSERT INTO SYS_DICT_TYPE VALUES(9, '操作类型', 'sys_oper_type', '0', 'admin', SYSDATE, '', NULL, '操作类型列表');
INSERT INTO SYS_DICT_TYPE VALUES(10, '系统状态', 'sys_common_status', '0', 'admin', SYSDATE, '', NULL, '登录状态列表');

-- 字典数据
INSERT INTO SYS_DICT_DATA VALUES(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', SYSDATE, '', NULL, '性别男');
INSERT INTO SYS_DICT_DATA VALUES(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', SYSDATE, '', NULL, '性别女');
INSERT INTO SYS_DICT_DATA VALUES(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', SYSDATE, '', NULL, '性别未知');
INSERT INTO SYS_DICT_DATA VALUES(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_DICT_DATA VALUES(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', SYSDATE, '', NULL, '');

-- 参数配置
INSERT INTO SYS_CONFIG VALUES(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(6, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(7, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '1', 'Y', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_CONFIG VALUES(8, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', SYSDATE, '', NULL, '');

-- 定时任务
INSERT INTO SYS_JOB VALUES(1, '系统默认（无参）', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_JOB VALUES(2, '系统默认（有参）', 'DEFAULT', 'ryTask.ryParams(''ry'')', '0/15 * * * * ?', '3', '1', '1', 'admin', SYSDATE, '', NULL, '');
INSERT INTO SYS_JOB VALUES(3, '系统默认（多参）', 'DEFAULT', 'ryTask.ryMultipleParams(''ry'', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', SYSDATE, '', NULL, '');

COMMIT;
