-- ============================================================================ -- OARMS - 系统管理模块 初始数据 -- Database: DM8 (达梦) -- Schema: OARMS -- Version: V11.0.0 -- Date: 2026-05-24 -- Description: 角色、权限、用户初始数据 -- ============================================================================ -- ---------------------------------------------------------------------------- -- 1. 角色(3 个) -- ---------------------------------------------------------------------------- INSERT INTO OARMS.SYS_ROLE (id, role_code, role_name, description, status, create_by, create_time, create_name) VALUES ('role_city_supervisor', 'CITY_SUPERVISOR', '市局广告监管人员', '全市户外广告监管统筹、监测规则管理、违法广告线索处置', 1, 'system', CURRENT_TIMESTAMP, '系统'), ('role_district_supervisor', 'DISTRICT_SUPERVISOR', '区局广告监管人员', '本辖区户外广告日常监控、违法内容发现与取证', 1, 'system', CURRENT_TIMESTAMP, '系统'), ('role_operator', 'OPERATOR', '广告大屏运营商', '大屏信息维护、广告播放时间上报、录屏参数查看', 1, 'system', CURRENT_TIMESTAMP, '系统'); -- ---------------------------------------------------------------------------- -- 2. 权限码(27 个) -- ---------------------------------------------------------------------------- -- BS-大屏基础库 INSERT INTO OARMS.SYS_PERMISSION (id, perm_code, perm_name, module, create_by, create_time, create_name) VALUES ('perm_screen_view', 'screen:view', '查看大屏', 'BS', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_screen_create', 'screen:create', '新增大屏', 'BS', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_screen_edit', 'screen:edit', '编辑大屏', 'BS', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_screen_remove', 'screen:remove', '删除大屏', 'BS', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_screen_export', 'screen:export', '导出大屏', 'BS', 'system', CURRENT_TIMESTAMP, '系统'); -- LB-法律法规 INSERT INTO OARMS.SYS_PERMISSION (id, perm_code, perm_name, module, create_by, create_time, create_name) VALUES ('perm_law_view', 'law:view', '查看法律条款', 'LB', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_law_create', 'law:create', '新增条款', 'LB', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_law_edit', 'law:edit', '编辑条款', 'LB', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_law_remove', 'law:remove', '删除条款', 'LB', 'system', CURRENT_TIMESTAMP, '系统'); -- MR-监测规则 INSERT INTO OARMS.SYS_PERMISSION (id, perm_code, perm_name, module, create_by, create_time, create_name) VALUES ('perm_rule_view', 'monitoring-rule:view', '查看规则', 'MR', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_rule_create', 'monitoring-rule:create', '新增规则', 'MR', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_rule_edit', 'monitoring-rule:edit', '编辑规则', 'MR', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_rule_remove', 'monitoring-rule:remove', '删除规则', 'MR', 'system', CURRENT_TIMESTAMP, '系统'); -- AM-广告监控 INSERT INTO OARMS.SYS_PERMISSION (id, perm_code, perm_name, module, create_by, create_time, create_name) VALUES ('perm_config_view', 'recording-config:view', '查看录屏配置', 'AM', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_config_create', 'recording-config:create', '新增录屏配置', 'AM', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_config_edit', 'recording-config:edit', '编辑录屏配置', 'AM', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_task_view', 'recording-task:view', '查看录屏任务', 'AM', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_record_view', 'monitor-record:view', '查看监控记录', 'AM', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_record_handle', 'monitor-record:handle', '处理监控', 'AM', 'system', CURRENT_TIMESTAMP, '系统'); -- CW-内容预警 INSERT INTO OARMS.SYS_PERMISSION (id, perm_code, perm_name, module, create_by, create_time, create_name) VALUES ('perm_evidence_view', 'evidence:view', '查看取证', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_evidence_create', 'evidence:create', '固化取证', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_relation_view', 'evidence-relation:view', '查看规则关联', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_relation_bind', 'evidence-relation:bind', '关联规则', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_clue_view', 'monitoring-clue:view', '查看线索', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_clue_create', 'monitoring-clue:create', '生成线索', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_transfer_view', 'clue-transfer:view', '查看转办', 'CW', 'system', CURRENT_TIMESTAMP, '系统'), ('perm_transfer_create', 'clue-transfer:create', '发起转办', 'CW', 'system', CURRENT_TIMESTAMP, '系统'); -- ---------------------------------------------------------------------------- -- 3. 角色权限映射 -- ---------------------------------------------------------------------------- -- 市局广告监管人员(全部权限) INSERT INTO OARMS.SYS_ROLE_PERMISSION (id, role_id, perm_id, create_by, create_time, create_name) VALUES ('rp_city_01', 'role_city_supervisor', 'perm_screen_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_02', 'role_city_supervisor', 'perm_screen_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_03', 'role_city_supervisor', 'perm_screen_edit', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_04', 'role_city_supervisor', 'perm_screen_remove', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_05', 'role_city_supervisor', 'perm_screen_export', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_06', 'role_city_supervisor', 'perm_law_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_07', 'role_city_supervisor', 'perm_law_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_08', 'role_city_supervisor', 'perm_law_edit', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_09', 'role_city_supervisor', 'perm_law_remove', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_10', 'role_city_supervisor', 'perm_rule_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_11', 'role_city_supervisor', 'perm_rule_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_12', 'role_city_supervisor', 'perm_rule_edit', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_13', 'role_city_supervisor', 'perm_rule_remove', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_14', 'role_city_supervisor', 'perm_config_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_15', 'role_city_supervisor', 'perm_config_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_16', 'role_city_supervisor', 'perm_config_edit', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_17', 'role_city_supervisor', 'perm_task_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_18', 'role_city_supervisor', 'perm_record_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_19', 'role_city_supervisor', 'perm_record_handle', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_20', 'role_city_supervisor', 'perm_evidence_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_21', 'role_city_supervisor', 'perm_evidence_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_22', 'role_city_supervisor', 'perm_relation_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_23', 'role_city_supervisor', 'perm_relation_bind', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_24', 'role_city_supervisor', 'perm_clue_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_25', 'role_city_supervisor', 'perm_clue_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_26', 'role_city_supervisor', 'perm_transfer_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_city_27', 'role_city_supervisor', 'perm_transfer_create', 'system', CURRENT_TIMESTAMP, '系统'); -- 区局广告监管人员(监控/取证/规则只读) INSERT INTO OARMS.SYS_ROLE_PERMISSION (id, role_id, perm_id, create_by, create_time, create_name) VALUES ('rp_dist_01', 'role_district_supervisor', 'perm_screen_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_02', 'role_district_supervisor', 'perm_screen_export', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_03', 'role_district_supervisor', 'perm_law_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_04', 'role_district_supervisor', 'perm_rule_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_05', 'role_district_supervisor', 'perm_config_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_06', 'role_district_supervisor', 'perm_task_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_07', 'role_district_supervisor', 'perm_record_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_08', 'role_district_supervisor', 'perm_record_handle', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_09', 'role_district_supervisor', 'perm_evidence_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_10', 'role_district_supervisor', 'perm_evidence_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_11', 'role_district_supervisor', 'perm_relation_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_12', 'role_district_supervisor', 'perm_relation_bind', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_13', 'role_district_supervisor', 'perm_clue_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_14', 'role_district_supervisor', 'perm_clue_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_15', 'role_district_supervisor', 'perm_transfer_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_dist_16', 'role_district_supervisor', 'perm_transfer_create', 'system', CURRENT_TIMESTAMP, '系统'); -- 广告大屏运营商(大屏维护/录屏查看) INSERT INTO OARMS.SYS_ROLE_PERMISSION (id, role_id, perm_id, create_by, create_time, create_name) VALUES ('rp_oper_01', 'role_operator', 'perm_screen_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_oper_02', 'role_operator', 'perm_screen_create', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_oper_03', 'role_operator', 'perm_screen_edit', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_oper_04', 'role_operator', 'perm_law_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_oper_05', 'role_operator', 'perm_config_view', 'system', CURRENT_TIMESTAMP, '系统'), ('rp_oper_06', 'role_operator', 'perm_task_view', 'system', CURRENT_TIMESTAMP, '系统'); -- ---------------------------------------------------------------------------- -- 4. 初始用户(3 个,密码均为 123456 的 BCrypt) -- BCrypt hash of '123456': $2a$10$h4yKk0mn.Uad15AOE9IFwuSDC9XeuNxqZkrZ.Y2YLuk9KurltER1i -- 注意:BCrypt 哈希每次生成不同,此为当前可用值。如需重新生成请使用 BCryptPasswordEncoder -- 实际部署前请修改密码 -- ---------------------------------------------------------------------------- INSERT INTO OARMS.SYS_USER (id, username, password, real_name, phone, org_name, district_code, status, create_by, create_time, create_name) VALUES ('user_city_admin', 'city_admin', '$2a$10$h4yKk0mn.Uad15AOE9IFwuSDC9XeuNxqZkrZ.Y2YLuk9KurltER1i', '市局管理员', '13800000001', '广州市市场监督管理局', NULL, 1, 'system', CURRENT_TIMESTAMP, '系统'), ('user_district_admin', 'district_admin', '$2a$10$h4yKk0mn.Uad15AOE9IFwuSDC9XeuNxqZkrZ.Y2YLuk9KurltER1i', '天河区管理员', '13800000002', '广州市天河区市场监督管理局', '440106', 1, 'system', CURRENT_TIMESTAMP, '系统'), ('user_operator', 'operator', '$2a$10$h4yKk0mn.Uad15AOE9IFwuSDC9XeuNxqZkrZ.Y2YLuk9KurltER1i', '运营商管理员', '13800000003', '广州文化传媒有限公司', '440106', 1, 'system', CURRENT_TIMESTAMP, '系统'); -- 用户角色关联 INSERT INTO OARMS.SYS_USER_ROLE (id, user_id, role_id, create_by, create_time, create_name) VALUES ('ur_01', 'user_city_admin', 'role_city_supervisor', 'system', CURRENT_TIMESTAMP, '系统'), ('ur_02', 'user_district_admin', 'role_district_supervisor', 'system', CURRENT_TIMESTAMP, '系统'), ('ur_03', 'user_operator', 'role_operator', 'system', CURRENT_TIMESTAMP, '系统');