GenTable.java 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. package com.ruoyi.gen.domain;
  2. import java.util.List;
  3. import javax.validation.Valid;
  4. import javax.validation.constraints.NotBlank;
  5. import org.apache.commons.lang3.ArrayUtils;
  6. import com.ruoyi.common.core.constant.GenConstants;
  7. import com.ruoyi.common.core.utils.StringUtils;
  8. import com.ruoyi.common.core.web.domain.BaseEntity;
  9. /**
  10. * 业务表 gen_table
  11. *
  12. * @author ruoyi
  13. */
  14. public class GenTable extends BaseEntity
  15. {
  16. private static final long serialVersionUID = 1L;
  17. /** 编号 */
  18. private Long tableId;
  19. /** 表名称 */
  20. @NotBlank(message = "表名称不能为空")
  21. private String tableName;
  22. /** 表描述 */
  23. @NotBlank(message = "表描述不能为空")
  24. private String tableComment;
  25. /** 关联父表的表名 */
  26. private String subTableName;
  27. /** 本表关联父表的外键名 */
  28. private String subTableFkName;
  29. /** 实体类名称(首字母大写) */
  30. @NotBlank(message = "实体类名称不能为空")
  31. private String className;
  32. /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */
  33. private String tplCategory;
  34. /** 生成包路径 */
  35. @NotBlank(message = "生成包路径不能为空")
  36. private String packageName;
  37. /** 生成模块名 */
  38. @NotBlank(message = "生成模块名不能为空")
  39. private String moduleName;
  40. /** 生成业务名 */
  41. @NotBlank(message = "生成业务名不能为空")
  42. private String businessName;
  43. /** 生成功能名 */
  44. @NotBlank(message = "生成功能名不能为空")
  45. private String functionName;
  46. /** 生成作者 */
  47. @NotBlank(message = "作者不能为空")
  48. private String functionAuthor;
  49. /** 生成代码方式(0zip压缩包 1自定义路径) */
  50. private String genType;
  51. /** 生成路径(不填默认项目路径) */
  52. private String genPath;
  53. /** 主键信息 */
  54. private GenTableColumn pkColumn;
  55. /** 子表信息 */
  56. private GenTable subTable;
  57. /** 表列信息 */
  58. @Valid
  59. private List<GenTableColumn> columns;
  60. /** 其它生成选项 */
  61. private String options;
  62. /** 树编码字段 */
  63. private String treeCode;
  64. /** 树父编码字段 */
  65. private String treeParentCode;
  66. /** 树名称字段 */
  67. private String treeName;
  68. /** 上级菜单ID字段 */
  69. private String parentMenuId;
  70. /** 上级菜单名称字段 */
  71. private String parentMenuName;
  72. public Long getTableId()
  73. {
  74. return tableId;
  75. }
  76. public void setTableId(Long tableId)
  77. {
  78. this.tableId = tableId;
  79. }
  80. public String getTableName()
  81. {
  82. return tableName;
  83. }
  84. public void setTableName(String tableName)
  85. {
  86. this.tableName = tableName;
  87. }
  88. public String getTableComment()
  89. {
  90. return tableComment;
  91. }
  92. public void setTableComment(String tableComment)
  93. {
  94. this.tableComment = tableComment;
  95. }
  96. public String getSubTableName()
  97. {
  98. return subTableName;
  99. }
  100. public void setSubTableName(String subTableName)
  101. {
  102. this.subTableName = subTableName;
  103. }
  104. public String getSubTableFkName()
  105. {
  106. return subTableFkName;
  107. }
  108. public void setSubTableFkName(String subTableFkName)
  109. {
  110. this.subTableFkName = subTableFkName;
  111. }
  112. public String getClassName()
  113. {
  114. return className;
  115. }
  116. public void setClassName(String className)
  117. {
  118. this.className = className;
  119. }
  120. public String getTplCategory()
  121. {
  122. return tplCategory;
  123. }
  124. public void setTplCategory(String tplCategory)
  125. {
  126. this.tplCategory = tplCategory;
  127. }
  128. public String getPackageName()
  129. {
  130. return packageName;
  131. }
  132. public void setPackageName(String packageName)
  133. {
  134. this.packageName = packageName;
  135. }
  136. public String getModuleName()
  137. {
  138. return moduleName;
  139. }
  140. public void setModuleName(String moduleName)
  141. {
  142. this.moduleName = moduleName;
  143. }
  144. public String getBusinessName()
  145. {
  146. return businessName;
  147. }
  148. public void setBusinessName(String businessName)
  149. {
  150. this.businessName = businessName;
  151. }
  152. public String getFunctionName()
  153. {
  154. return functionName;
  155. }
  156. public void setFunctionName(String functionName)
  157. {
  158. this.functionName = functionName;
  159. }
  160. public String getFunctionAuthor()
  161. {
  162. return functionAuthor;
  163. }
  164. public void setFunctionAuthor(String functionAuthor)
  165. {
  166. this.functionAuthor = functionAuthor;
  167. }
  168. public String getGenType()
  169. {
  170. return genType;
  171. }
  172. public void setGenType(String genType)
  173. {
  174. this.genType = genType;
  175. }
  176. public String getGenPath()
  177. {
  178. return genPath;
  179. }
  180. public void setGenPath(String genPath)
  181. {
  182. this.genPath = genPath;
  183. }
  184. public GenTableColumn getPkColumn()
  185. {
  186. return pkColumn;
  187. }
  188. public void setPkColumn(GenTableColumn pkColumn)
  189. {
  190. this.pkColumn = pkColumn;
  191. }
  192. public GenTable getSubTable()
  193. {
  194. return subTable;
  195. }
  196. public void setSubTable(GenTable subTable)
  197. {
  198. this.subTable = subTable;
  199. }
  200. public List<GenTableColumn> getColumns()
  201. {
  202. return columns;
  203. }
  204. public void setColumns(List<GenTableColumn> columns)
  205. {
  206. this.columns = columns;
  207. }
  208. public String getOptions()
  209. {
  210. return options;
  211. }
  212. public void setOptions(String options)
  213. {
  214. this.options = options;
  215. }
  216. public String getTreeCode()
  217. {
  218. return treeCode;
  219. }
  220. public void setTreeCode(String treeCode)
  221. {
  222. this.treeCode = treeCode;
  223. }
  224. public String getTreeParentCode()
  225. {
  226. return treeParentCode;
  227. }
  228. public void setTreeParentCode(String treeParentCode)
  229. {
  230. this.treeParentCode = treeParentCode;
  231. }
  232. public String getTreeName()
  233. {
  234. return treeName;
  235. }
  236. public void setTreeName(String treeName)
  237. {
  238. this.treeName = treeName;
  239. }
  240. public String getParentMenuId()
  241. {
  242. return parentMenuId;
  243. }
  244. public void setParentMenuId(String parentMenuId)
  245. {
  246. this.parentMenuId = parentMenuId;
  247. }
  248. public String getParentMenuName()
  249. {
  250. return parentMenuName;
  251. }
  252. public void setParentMenuName(String parentMenuName)
  253. {
  254. this.parentMenuName = parentMenuName;
  255. }
  256. public boolean isSub()
  257. {
  258. return isSub(this.tplCategory);
  259. }
  260. public static boolean isSub(String tplCategory)
  261. {
  262. return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
  263. }
  264. public boolean isTree()
  265. {
  266. return isTree(this.tplCategory);
  267. }
  268. public static boolean isTree(String tplCategory)
  269. {
  270. return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
  271. }
  272. public boolean isCrud()
  273. {
  274. return isCrud(this.tplCategory);
  275. }
  276. public static boolean isCrud(String tplCategory)
  277. {
  278. return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
  279. }
  280. public boolean isSuperColumn(String javaField)
  281. {
  282. return isSuperColumn(this.tplCategory, javaField);
  283. }
  284. public static boolean isSuperColumn(String tplCategory, String javaField)
  285. {
  286. if (isTree(tplCategory))
  287. {
  288. return StringUtils.equalsAnyIgnoreCase(javaField,
  289. ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
  290. }
  291. return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
  292. }
  293. }