|
|
-- 创建 sys_user 表
CREATE TABLE IF NOT EXISTS sys_user ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, nickname TEXT, password TEXT NOT NULL, role_id INTEGER, is_deleted TINYINT DEFAULT 0, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 插入测试数据
INSERT INTO sys_user (username, nickname, password, role_id, is_deleted) VALUES ('admin', 'Admin', '12345', 1, 0), ('john_doe', 'John Doe', 'password123', 2, 0), ('test', 'test', 'test123', 3, 0);
-- 创建 sys_role 表
CREATE TABLE IF NOT EXISTS sys_role ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, code TEXT NOT NULL, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 插入角色数据
INSERT INTO sys_role (name, code) VALUES ('管理员', 'ADMIN'), ('普通用户', 'USER'), ('测试用户', 'TEST');
-- 创建 matrix 基质类型表
CREATE TABLE IF NOT EXISTS matrix ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 创建 matrix_craft 基质工艺表
CREATE TABLE IF NOT EXISTS matrix_craft ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, matrix_id INTEGER NOT NULL, matrix_path_type TEXT NOT NULL, motor_z_height INTEGER, gas_pressure INTEGER, volume INTEGER, matrix_flow_velocity INTEGER, high_voltage BOOLEAN, high_voltage_value INTEGER, spacing INTEGER, moving_speed INTEGER, times INTEGER, create_user INTEGER, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 创建 operation_log 操作记录表
CREATE TABLE IF NOT EXISTS operation_log ( id INTEGER PRIMARY KEY AUTOINCREMENT, matrix_id INTEGER, matrix_info TEXT, status INTEGER, create_user INTEGER, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-- 创建 sys_settings 系统配置表
CREATE TABLE IF NOT EXISTS sys_settings ( id INTEGER PRIMARY KEY AUTOINCREMENT, parent_id INTEGER, name TEXT NOT NULL, code TEXT, value TEXT
);
-- 插入 sys_settings 表数据
INSERT INTO sys_settings (id, parent_id, name, code, value) VALUES (1, NULL, '玻片位置', 'slide_position', NULL), (2, 1, '玻片1位置', 'slide_position1', '1,2,3'), (3, 1, '玻片2位置', 'slide_position2', '1,2,3'), (4, 1, '玻片3位置', 'slide_position3', '1,2,3'), (5, 1, '玻片4位置', 'slide_position4', '1,2,3'), (6, NULL, '电机电流', 'current', NULL), (7, 6, 'x轴电流', 'x_current', 2), (8, 6, 'y轴电流', 'y_current', 3), (9, 6, 'z轴电流', 'z_current', 4), (10, NULL, '电机运行速度', 'speed', NULL), (11, 10, 'x轴速度', 'x_speed', 10), (12, 10, 'y轴速度', 'y_speed', 10), (13, 10, 'z轴速度', 'z_speed', 10), (14, NULL, '废液桶位置','waste_liquor', '173.08,75,70' );
-- 位置表,用来存储设备固定点位
CREATE TABLE IF NOT EXISTS position ( id INTEGER PRIMARY KEY AUTOINCREMENT, point_name TEXT NOT NULL, x REAL NOT NULL, y REAL NOT NULL, z REAL NOT NULL, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
|