config.py 922 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. # @Author : YY
  3. # @FileName: config.py
  4. import os
  5. import yaml
  6. class GeneratorConfig:
  7. # 作者
  8. author = "YY"
  9. # 默认包名
  10. package_name = "com.yy.project"
  11. # 自动移除表前缀
  12. auto_remove_pre = True
  13. # 表前缀
  14. table_prefix = "sys_"
  15. # 读取配置文件
  16. config_file = os.path.join(os.path.dirname(__file__), "config", "generator.yml")
  17. if os.path.exists(config_file):
  18. with open(config_file, 'r', encoding='utf-8') as f:
  19. config_data = yaml.load(f, Loader=yaml.FullLoader)
  20. gen_config = config_data.get("gen", {})
  21. author = gen_config.get("author", author)
  22. package_name = gen_config.get("packageName", package_name)
  23. auto_remove_pre = gen_config.get("autoRemovePre", auto_remove_pre)
  24. table_prefix = gen_config.get("tablePrefix", table_prefix)