GeneratorEnum.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\enum;
  15. class GeneratorEnum
  16. {
  17. // 模板类型
  18. const TEMPLATE_TYPE_SINGLE = 0;// 单表
  19. const TEMPLATE_TYPE_TREE = 1; // 树表
  20. // 生成方式
  21. const GENERATE_TYPE_ZIP = 0; // 压缩包下载
  22. const GENERATE_TYPE_MODULE = 1; // 生成到模块
  23. // 删除方式
  24. const DELETE_TRUE = 0; // 真实删除
  25. const DELETE_SOFT = 1; // 软删除
  26. // 删除字段名 (默认名称)
  27. const DELETE_NAME = 'delete_time';
  28. // 菜单创建类型
  29. const GEN_SELF = 0; // 手动添加
  30. const GEN_AUTO = 1; // 自动添加
  31. // 关联模型类型relations
  32. const RELATION_HAS_ONE = 'has_one';
  33. const RELATION_HAS_MANY = 'has_many';
  34. /**
  35. * @notes 获取模板类型描述
  36. * @param bool $value
  37. * @return string|string[]
  38. * @author 段誉
  39. * @date 2022/6/14 11:24
  40. */
  41. public static function getTemplateTypeDesc($value = true)
  42. {
  43. $data = [
  44. self::TEMPLATE_TYPE_SINGLE => '单表(增删改查)',
  45. self::TEMPLATE_TYPE_TREE => '树表(增删改查)',
  46. ];
  47. if ($value === true) {
  48. return $data;
  49. }
  50. return $data[$value] ?? '';
  51. }
  52. }