yunzer_go/server/database/yz_positions.sql

33 lines
1.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 创建职位表
-- 创建时间: 2025
-- 描述: OA系统职位管理表
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- 检查并创建租户职位表(如果不存在)
CREATE TABLE IF NOT EXISTS yz_tenant_positions (
id INT PRIMARY KEY AUTO_INCREMENT COMMENT '职位ID',
tenant_id INT NOT NULL DEFAULT 0 COMMENT '租户ID',
name VARCHAR(100) NOT NULL COMMENT '职位名称',
code VARCHAR(50) DEFAULT NULL COMMENT '职位编码',
department_id INT DEFAULT NULL COMMENT '所属部门ID',
level INT DEFAULT 0 COMMENT '职位级别',
description TEXT DEFAULT NULL COMMENT '职位描述',
sort_order INT DEFAULT 0 COMMENT '排序序号',
status TINYINT DEFAULT 1 COMMENT '状态1-启用0-禁用',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
delete_time DATETIME DEFAULT NULL COMMENT '删除时间(软删除)',
-- 索引
INDEX idx_tenant_id (tenant_id),
INDEX idx_code (code),
INDEX idx_department_id (department_id),
INDEX idx_status (status),
INDEX idx_sort_order (sort_order)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='租户职位表';
SET FOREIGN_KEY_CHECKS = 1;