c65c2d2108f922aaf82acf26b422ddc5a7aeddd9.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package org.jeecg.common.constant.enums;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.List;
  5. import java.util.Map;
  6. /**
  7. * online表单枚举 代码生成器用到
  8. */
  9. public enum CgformEnum {
  10. /**
  11. * 单表
  12. */
  13. ONE(1, "one", "/jeecg/code-template-online", "default.one", "经典风格"),
  14. /**
  15. * 多表
  16. */
  17. MANY(2, "many", "/jeecg/code-template-online", "default.onetomany", "经典风格"),
  18. /**
  19. * 多表
  20. */
  21. ERP(2, "erp", "/jeecg/code-template-online", "erp.onetomany", "ERP风格"),
  22. /**
  23. * 多表(jvxe风格)
  24. * */
  25. JVXE_TABLE(2, "jvxe", "/jeecg/code-template-online", "jvxe.onetomany", "JVXE风格"),
  26. /**
  27. * 多表(内嵌子表风格)
  28. */
  29. INNER_TABLE(2, "innerTable", "/jeecg/code-template-online", "inner-table.onetomany", "内嵌子表风格"),
  30. /**
  31. * 多表(tab风格)
  32. * */
  33. TAB(2, "tab", "/jeecg/code-template-online", "tab.onetomany", "Tab风格"),
  34. /**
  35. * 树形列表
  36. */
  37. TREE(3, "tree", "/jeecg/code-template-online", "default.tree", "树形列表");
  38. /**
  39. * 类型 1/单表 2/一对多 3/树
  40. */
  41. int type;
  42. /**
  43. * 编码标识
  44. */
  45. String code;
  46. /**
  47. * 代码生成器模板路径
  48. */
  49. String templatePath;
  50. /**
  51. * 代码生成器模板路径
  52. */
  53. String stylePath;
  54. /**
  55. * 模板风格名称
  56. */
  57. String note;
  58. /**
  59. * 构造器
  60. *
  61. * @param type 类型 1/单表 2/一对多 3/树
  62. * @param code 模板编码
  63. * @param templatePath 模板路径
  64. * @param stylePath 模板子路径
  65. * @param note
  66. */
  67. CgformEnum(int type, String code, String templatePath, String stylePath, String note) {
  68. this.type = type;
  69. this.code = code;
  70. this.templatePath = templatePath;
  71. this.stylePath = stylePath;
  72. this.note = note;
  73. }
  74. /**
  75. * 根据code获取模板路径
  76. *
  77. * @param code
  78. * @return
  79. */
  80. public static String getTemplatePathByConfig(String code) {
  81. return getCgformEnumByConfig(code).templatePath;
  82. }
  83. public int getType() {
  84. return type;
  85. }
  86. public void setType(int type) {
  87. this.type = type;
  88. }
  89. public String getTemplatePath() {
  90. return templatePath;
  91. }
  92. public void setTemplatePath(String templatePath) {
  93. this.templatePath = templatePath;
  94. }
  95. public String getStylePath() {
  96. return stylePath;
  97. }
  98. public void setStylePath(String stylePath) {
  99. this.stylePath = stylePath;
  100. }
  101. /**
  102. * 根据code找枚举
  103. *
  104. * @param code
  105. * @return
  106. */
  107. public static CgformEnum getCgformEnumByConfig(String code) {
  108. for (CgformEnum e : CgformEnum.values()) {
  109. if (e.code.equals(code)) {
  110. return e;
  111. }
  112. }
  113. return null;
  114. }
  115. /**
  116. * 根据类型找所有
  117. *
  118. * @param type
  119. * @return
  120. */
  121. public static List<Map<String, Object>> getJspModelList(int type) {
  122. List<Map<String, Object>> ls = new ArrayList<Map<String, Object>>();
  123. for (CgformEnum e : CgformEnum.values()) {
  124. if (e.type == type) {
  125. Map<String, Object> map = new HashMap<String, Object>();
  126. map.put("code", e.code);
  127. map.put("note", e.note);
  128. ls.add(map);
  129. }
  130. }
  131. return ls;
  132. }
  133. }