department.sql 872 B

123456789101112131415161718192021222324
  1. drop table if exists hx_department;
  2. CREATE Table hx_department (
  3. id INTEGER PRIMARY KEY AUTO_INCREMENT,
  4. name VARCHAR(128) NOT NULL COMMENT `部门名称`,
  5. status TINYINT DEFAULT 0 COMMENT `状态备用`,
  6. parent_id INTEGER NOT NULL COMMENT `上一级部门id,无上级为0`,
  7. root_node_id INTEGER NOT NULL COMMENT `所在部门树中根部门的id`,
  8. depth TINYINT not NULL COMMENT `所在部门树中的深度`,
  9. sort INTEGER DEFAULT 0 COMMENT `部门排序`,
  10. deleted_at DATETIME COMMENT `删除时间`
  11. ) COMMENT `部门、组织架构`;
  12. CREATE Table hx_department_user (
  13. id BIGINT PRIMARY KEY AUTO_INCREMENT,
  14. user_id BIGINT NOT NULL COMMENT `用户id`,
  15. dept_id INTEGER not NULL COMMENT `部门id`,
  16. created_by BIGINT not NULL,
  17. created_at DATETIME NOT NULL,
  18. deleted_at DATETIME
  19. ) COMMENT `用户-部门关系表`;