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