mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-06 12:28:10 +00:00
update 优化代码与注释
This commit is contained in:
@@ -5,6 +5,8 @@ import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.gen.config.GenConfig;
|
||||
import com.ruoyi.gen.domain.GenTable;
|
||||
import com.ruoyi.gen.domain.GenTableColumn;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.RegExUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -14,6 +16,7 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class GenUtils {
|
||||
/**
|
||||
* 初始化表信息
|
||||
|
@@ -1,30 +1,33 @@
|
||||
package com.ruoyi.gen.util;
|
||||
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* VelocityEngine工厂
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class VelocityInitializer {
|
||||
/**
|
||||
* 初始化vm方法
|
||||
*/
|
||||
public static void initVelocity() {
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
// 加载classpath目录下的vm文件
|
||||
p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||
// 定义字符集
|
||||
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
|
||||
// 初始化Velocity引擎,指定配置Properties
|
||||
Velocity.init(p);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.ruoyi.gen.util;
|
||||
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* VelocityEngine工厂
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class VelocityInitializer {
|
||||
/**
|
||||
* 初始化vm方法
|
||||
*/
|
||||
public static void initVelocity() {
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
// 加载classpath目录下的vm文件
|
||||
p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||
// 定义字符集
|
||||
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
|
||||
// 初始化Velocity引擎,指定配置Properties
|
||||
Velocity.init(p);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,8 @@ import com.ruoyi.common.core.utils.JsonUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.gen.domain.GenTable;
|
||||
import com.ruoyi.gen.domain.GenTableColumn;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
|
||||
import java.util.*;
|
||||
@@ -19,6 +21,7 @@ import java.util.*;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class VelocityUtils {
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user