-- ----------------------------
-- 岗位信息表
-- ----------------------------
DROP TABLE IF EXISTS sys_post;

CREATE TABLE sys_post
(
    post_id     BIGSERIAL PRIMARY KEY,     -- 岗位ID，自增字段，主键
    post_code   VARCHAR(64) NOT NULL,      -- 岗位编码
    post_name   VARCHAR(50) NOT NULL,      -- 岗位名称
    post_sort   INT         NOT NULL,      -- 显示顺序
    status      CHAR(1)     NOT NULL,      -- 状态（0正常 1停用）
    create_by   VARCHAR(64)  DEFAULT '',   -- 创建者
    create_time TIMESTAMP,                 -- 创建时间
    update_by   VARCHAR(64)  DEFAULT '',   -- 更新者
    update_time TIMESTAMP,                 -- 更新时间
    remark      VARCHAR(500) DEFAULT NULL, -- 备注
);

COMMENT ON TABLE sys_post IS '岗位信息表';
COMMENT ON COLUMN sys_post.post_id IS '岗位ID';
COMMENT ON COLUMN sys_post.post_code IS '岗位编码';
COMMENT ON COLUMN sys_post.post_name IS '岗位名称';
COMMENT ON COLUMN sys_post.post_sort IS '显示顺序';
COMMENT ON COLUMN sys_post.status IS '状态（0正常 1停用）';
COMMENT ON COLUMN sys_post.create_by IS '创建者';
COMMENT ON COLUMN sys_post.create_time IS '创建时间';
COMMENT ON COLUMN sys_post.update_by IS '更新者';
COMMENT ON COLUMN sys_post.update_time IS '更新时间';
COMMENT ON COLUMN sys_post.remark IS '备注';

-- 初始化-岗位信息表数据
INSERT INTO sys_post (post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark)
VALUES ('ceo', '董事长', 1, '0', 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, ''),
       ('se', '项目经理', 2, '0', 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, ''),
       ('hr', '人力资源', 3, '0', 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, ''),
       ('user', '普通员工', 4, '0', 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, '');















