|
@@ -3,12 +3,21 @@ package com.gitee.gen.gen;
|
|
import com.gitee.gen.util.FieldUtil;
|
|
import com.gitee.gen.util.FieldUtil;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* SQL上下文,这里可以取到表,字段信息<br>
|
|
* SQL上下文,这里可以取到表,字段信息<br>
|
|
* 最终会把SQL上下文信息放到velocity中
|
|
* 最终会把SQL上下文信息放到velocity中
|
|
*/
|
|
*/
|
|
public class SQLContext {
|
|
public class SQLContext {
|
|
|
|
|
|
|
|
+ private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
|
|
|
|
+
|
|
|
|
+ private final LocalDateTime localDateTime = LocalDateTime.now();
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 表结构定义
|
|
* 表结构定义
|
|
*/
|
|
*/
|
|
@@ -36,6 +45,18 @@ public class SQLContext {
|
|
this.javaPkColumn = (JavaColumnDefinition) this.tableDefinition.getPkColumn();
|
|
this.javaPkColumn = (JavaColumnDefinition) this.tableDefinition.getPkColumn();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public String getDatetime() {
|
|
|
|
+ return localDateTime.format(DATE_TIME_FORMATTER);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getDate() {
|
|
|
|
+ return localDateTime.format(DATE_FORMATTER);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getTime() {
|
|
|
|
+ return localDateTime.format(TIME_FORMATTER);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 返回Java类名
|
|
* 返回Java类名
|
|
*
|
|
*
|