GenTableColumn.java 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. package com.ruoyi.gen.domain;
  2. import javax.validation.constraints.NotBlank;
  3. import com.ruoyi.common.core.utils.StringUtils;
  4. import com.ruoyi.common.core.web.domain.BaseEntity;
  5. /**
  6. * 代码生成业务字段表 gen_table_column
  7. *
  8. * @author ruoyi
  9. */
  10. public class GenTableColumn extends BaseEntity
  11. {
  12. private static final long serialVersionUID = 1L;
  13. /** 编号 */
  14. private Long columnId;
  15. /** 归属表编号 */
  16. private Long tableId;
  17. /** 列名称 */
  18. private String columnName;
  19. /** 列描述 */
  20. private String columnComment;
  21. /** 列类型 */
  22. private String columnType;
  23. /** JAVA类型 */
  24. private String javaType;
  25. /** JAVA字段名 */
  26. @NotBlank(message = "Java属性不能为空")
  27. private String javaField;
  28. /** 是否主键(1是) */
  29. private String isPk;
  30. /** 是否自增(1是) */
  31. private String isIncrement;
  32. /** 是否必填(1是) */
  33. private String isRequired;
  34. /** 是否为插入字段(1是) */
  35. private String isInsert;
  36. /** 是否编辑字段(1是) */
  37. private String isEdit;
  38. /** 是否列表字段(1是) */
  39. private String isList;
  40. /** 是否查询字段(1是) */
  41. private String isQuery;
  42. /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
  43. private String queryType;
  44. /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */
  45. private String htmlType;
  46. /** 字典类型 */
  47. private String dictType;
  48. /** 排序 */
  49. private Integer sort;
  50. public void setColumnId(Long columnId)
  51. {
  52. this.columnId = columnId;
  53. }
  54. public Long getColumnId()
  55. {
  56. return columnId;
  57. }
  58. public void setTableId(Long tableId)
  59. {
  60. this.tableId = tableId;
  61. }
  62. public Long getTableId()
  63. {
  64. return tableId;
  65. }
  66. public void setColumnName(String columnName)
  67. {
  68. this.columnName = columnName;
  69. }
  70. public String getColumnName()
  71. {
  72. return columnName;
  73. }
  74. public void setColumnComment(String columnComment)
  75. {
  76. this.columnComment = columnComment;
  77. }
  78. public String getColumnComment()
  79. {
  80. return columnComment;
  81. }
  82. public void setColumnType(String columnType)
  83. {
  84. this.columnType = columnType;
  85. }
  86. public String getColumnType()
  87. {
  88. return columnType;
  89. }
  90. public void setJavaType(String javaType)
  91. {
  92. this.javaType = javaType;
  93. }
  94. public String getJavaType()
  95. {
  96. return javaType;
  97. }
  98. public void setJavaField(String javaField)
  99. {
  100. this.javaField = javaField;
  101. }
  102. public String getJavaField()
  103. {
  104. return javaField;
  105. }
  106. public String getCapJavaField()
  107. {
  108. return StringUtils.capitalize(javaField);
  109. }
  110. public void setIsPk(String isPk)
  111. {
  112. this.isPk = isPk;
  113. }
  114. public String getIsPk()
  115. {
  116. return isPk;
  117. }
  118. public boolean isPk()
  119. {
  120. return isPk(this.isPk);
  121. }
  122. public boolean isPk(String isPk)
  123. {
  124. return isPk != null && StringUtils.equals("1", isPk);
  125. }
  126. public String getIsIncrement()
  127. {
  128. return isIncrement;
  129. }
  130. public void setIsIncrement(String isIncrement)
  131. {
  132. this.isIncrement = isIncrement;
  133. }
  134. public boolean isIncrement()
  135. {
  136. return isIncrement(this.isIncrement);
  137. }
  138. public boolean isIncrement(String isIncrement)
  139. {
  140. return isIncrement != null && StringUtils.equals("1", isIncrement);
  141. }
  142. public void setIsRequired(String isRequired)
  143. {
  144. this.isRequired = isRequired;
  145. }
  146. public String getIsRequired()
  147. {
  148. return isRequired;
  149. }
  150. public boolean isRequired()
  151. {
  152. return isRequired(this.isRequired);
  153. }
  154. public boolean isRequired(String isRequired)
  155. {
  156. return isRequired != null && StringUtils.equals("1", isRequired);
  157. }
  158. public void setIsInsert(String isInsert)
  159. {
  160. this.isInsert = isInsert;
  161. }
  162. public String getIsInsert()
  163. {
  164. return isInsert;
  165. }
  166. public boolean isInsert()
  167. {
  168. return isInsert(this.isInsert);
  169. }
  170. public boolean isInsert(String isInsert)
  171. {
  172. return isInsert != null && StringUtils.equals("1", isInsert);
  173. }
  174. public void setIsEdit(String isEdit)
  175. {
  176. this.isEdit = isEdit;
  177. }
  178. public String getIsEdit()
  179. {
  180. return isEdit;
  181. }
  182. public boolean isEdit()
  183. {
  184. return isInsert(this.isEdit);
  185. }
  186. public boolean isEdit(String isEdit)
  187. {
  188. return isEdit != null && StringUtils.equals("1", isEdit);
  189. }
  190. public void setIsList(String isList)
  191. {
  192. this.isList = isList;
  193. }
  194. public String getIsList()
  195. {
  196. return isList;
  197. }
  198. public boolean isList()
  199. {
  200. return isList(this.isList);
  201. }
  202. public boolean isList(String isList)
  203. {
  204. return isList != null && StringUtils.equals("1", isList);
  205. }
  206. public void setIsQuery(String isQuery)
  207. {
  208. this.isQuery = isQuery;
  209. }
  210. public String getIsQuery()
  211. {
  212. return isQuery;
  213. }
  214. public boolean isQuery()
  215. {
  216. return isQuery(this.isQuery);
  217. }
  218. public boolean isQuery(String isQuery)
  219. {
  220. return isQuery != null && StringUtils.equals("1", isQuery);
  221. }
  222. public void setQueryType(String queryType)
  223. {
  224. this.queryType = queryType;
  225. }
  226. public String getQueryType()
  227. {
  228. return queryType;
  229. }
  230. public String getHtmlType()
  231. {
  232. return htmlType;
  233. }
  234. public void setHtmlType(String htmlType)
  235. {
  236. this.htmlType = htmlType;
  237. }
  238. public void setDictType(String dictType)
  239. {
  240. this.dictType = dictType;
  241. }
  242. public String getDictType()
  243. {
  244. return dictType;
  245. }
  246. public void setSort(Integer sort)
  247. {
  248. this.sort = sort;
  249. }
  250. public Integer getSort()
  251. {
  252. return sort;
  253. }
  254. public boolean isSuperColumn()
  255. {
  256. return isSuperColumn(this.javaField);
  257. }
  258. public static boolean isSuperColumn(String javaField)
  259. {
  260. return StringUtils.equalsAnyIgnoreCase(javaField,
  261. // BaseEntity
  262. "createBy", "createTime", "updateBy", "updateTime", "remark",
  263. // TreeEntity
  264. "parentName", "parentId", "orderNum", "ancestors");
  265. }
  266. public boolean isUsableColumn()
  267. {
  268. return isUsableColumn(javaField);
  269. }
  270. public static boolean isUsableColumn(String javaField)
  271. {
  272. // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单
  273. return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
  274. }
  275. public String readConverterExp()
  276. {
  277. String remarks = StringUtils.substringBetween(this.columnComment, "(", ")");
  278. StringBuffer sb = new StringBuffer();
  279. if (StringUtils.isNotEmpty(remarks))
  280. {
  281. for (String value : remarks.split(" "))
  282. {
  283. if (StringUtils.isNotEmpty(value))
  284. {
  285. Object startStr = value.subSequence(0, 1);
  286. String endStr = value.substring(1);
  287. sb.append("").append(startStr).append("=").append(endStr).append(",");
  288. }
  289. }
  290. return sb.deleteCharAt(sb.length() - 1).toString();
  291. }
  292. else
  293. {
  294. return this.columnComment;
  295. }
  296. }
  297. }