Browse Source

格式化

James 1 year ago
parent
commit
90ecffb844

+ 6 - 10
src/main/java/com/jfinal/plugin/activerecord/sql/NameSpaceDirective.java

@@ -30,11 +30,11 @@ import com.jfinal.template.stat.Scope;
  * NameSpaceDirective
  * NameSpaceDirective
  */
  */
 public class NameSpaceDirective extends Directive {
 public class NameSpaceDirective extends Directive {
-	
+
 	static final String NAME_SPACE_KEY = "_NAME_SPACE_";
 	static final String NAME_SPACE_KEY = "_NAME_SPACE_";
-	
+
 	private String nameSpace;
 	private String nameSpace;
-	
+
 	public void setExprList(ExprList exprList) {
 	public void setExprList(ExprList exprList) {
 		if (exprList.length() == 0) {
 		if (exprList.length() == 0) {
 			throw new ParseException("The parameter of #namespace directive can not be blank", location);
 			throw new ParseException("The parameter of #namespace directive can not be blank", location);
@@ -47,10 +47,10 @@ public class NameSpaceDirective extends Directive {
 		} else {
 		} else {
 			throw new ParseException("The parameter of #namespace directive must be String", location);
 			throw new ParseException("The parameter of #namespace directive must be String", location);
 		}
 		}
-		
+
 		this.nameSpace = ((Const)expr).getStr();
 		this.nameSpace = ((Const)expr).getStr();
 	}
 	}
-	
+
 	public void exec(Env env, Scope scope, Writer writer) {
 	public void exec(Env env, Scope scope, Writer writer) {
 		if (scope.get(NAME_SPACE_KEY) != null) {
 		if (scope.get(NAME_SPACE_KEY) != null) {
 			throw new TemplateException("#namespace directive can not be nested", location);
 			throw new TemplateException("#namespace directive can not be nested", location);
@@ -62,13 +62,9 @@ public class NameSpaceDirective extends Directive {
 			scope.remove(NAME_SPACE_KEY);
 			scope.remove(NAME_SPACE_KEY);
 		}
 		}
 	}
 	}
-	
+
 	public boolean hasEnd() {
 	public boolean hasEnd() {
 		return true;
 		return true;
 	}
 	}
 }
 }
 
 
-
-
-
-

+ 27 - 29
src/main/java/com/jfinal/plugin/activerecord/sql/ParaDirective.java

@@ -32,74 +32,74 @@ import com.jfinal.template.stat.Scope;
 
 
 /**
 /**
  * #para 指令用于在 sql 模板中根据参数名生成问号占位以及查询参数
  * #para 指令用于在 sql 模板中根据参数名生成问号占位以及查询参数
- * 
+ *
  * <pre>
  * <pre>
  * 一、参数为表达式的用法
  * 一、参数为表达式的用法
  * 1:模板内容
  * 1:模板内容
  *   #sql("find")
  *   #sql("find")
  *     select * from user where nickName = #para(nickName) and age > #para(age)
  *     select * from user where nickName = #para(nickName) and age > #para(age)
  *   #end
  *   #end
- *   
+ *
  * 2: java 代码
  * 2: java 代码
  *   user.template("find", Kv.of("nickName", "prettyGirl").set("age", 18)).find();
  *   user.template("find", Kv.of("nickName", "prettyGirl").set("age", 18)).find();
- * 
+ *
  * 3:以上用法会在 #para(expr) 处生成问号占位字符,并且实际的参数放入 SqlPara 对象的参数列表中
  * 3:以上用法会在 #para(expr) 处生成问号占位字符,并且实际的参数放入 SqlPara 对象的参数列表中
- * 
- * 
+ *
+ *
  * 二、参数为 int 型数字的用法
  * 二、参数为 int 型数字的用法
  * 1:模板内容
  * 1:模板内容
  *   #sql("find")
  *   #sql("find")
  *     select * from user where id > #para(0) and id < #para(1)
  *     select * from user where id > #para(0) and id < #para(1)
  *   #end
  *   #end
- *   
+ *
  * 2: java 代码
  * 2: java 代码
  *   user.template("find", 10, 100).find();
  *   user.template("find", 10, 100).find();
- * 
+ *
  * 3:以上用法会在 #para(0) 与 #para(1) 处生成问号占位字符,并且将 10、100 这两个参数放入
  * 3:以上用法会在 #para(0) 与 #para(1) 处生成问号占位字符,并且将 10、100 这两个参数放入
  *    SqlPara 对象的参数列表中
  *    SqlPara 对象的参数列表中
- * 
+ *
  * 三、4.9.23 新增支持 like、in 子句
  * 三、4.9.23 新增支持 like、in 子句
  *    ### 一般用法,第二个参数传入 "like"、"in" 参数即可
  *    ### 一般用法,第二个参数传入 "like"、"in" 参数即可
  *    select * from t title like #para(title, "like")
  *    select * from t title like #para(title, "like")
  *    select * from t title like #para(title, "in")
  *    select * from t title like #para(title, "in")
- *    
+ *
  *    ### like 类型第一个参数支持 int 类型
  *    ### like 类型第一个参数支持 int 类型
  *    select * from t title like #para(0, "like")
  *    select * from t title like #para(0, "like")
- *    
+ *
  *    ### like 支持左侧与右侧百分号用法
  *    ### like 支持左侧与右侧百分号用法
  *    select * from t title like #para(title, "%like")
  *    select * from t title like #para(title, "%like")
  *    select * from t title like #para(title, "like%")
  *    select * from t title like #para(title, "like%")
- *    
+ *
  *    ### 警告:对于 in 子句,如果 #para 第一个参数是 int 型,并且 java 代码针对 Object... 参数传入的是数组
  *    ### 警告:对于 in 子句,如果 #para 第一个参数是 int 型,并且 java 代码针对 Object... 参数传入的是数组
  *    select * from t id in #para(0, "in")
  *    select * from t id in #para(0, "in")
  *    ### 那么 java 代码中要将 Object... 处的参数强制转成 Object,否则参数传递不正确
  *    ### 那么 java 代码中要将 Object... 处的参数强制转成 Object,否则参数传递不正确
  *    Integer[] idArray = {1, 2, 3};
  *    Integer[] idArray = {1, 2, 3};
       Db.template("findByIdArray", (Object)idArray).find();
       Db.template("findByIdArray", (Object)idArray).find();
- * 
+ *
  * </pre>
  * </pre>
  */
  */
 public class ParaDirective extends Directive {
 public class ParaDirective extends Directive {
-	
+
 	private int index = -1;
 	private int index = -1;
 	private String paraName = null;
 	private String paraName = null;
 	private static boolean checkParaAssigned = true;
 	private static boolean checkParaAssigned = true;
-	
+
 	// 支持 like、in 子句
 	// 支持 like、in 子句
 	private int type = 0;
 	private int type = 0;
 	private static final int TYPE_LIKE = 1;
 	private static final int TYPE_LIKE = 1;
 	private static final int TYPE_LIKE_LEFT = 2;
 	private static final int TYPE_LIKE_LEFT = 2;
 	private static final int TYPE_LIKE_RIGHT = 3;
 	private static final int TYPE_LIKE_RIGHT = 3;
 	private static final int TYPE_IN = 4;
 	private static final int TYPE_IN = 4;
-	
+
 	public static void setCheckParaAssigned(boolean checkParaAssigned) {
 	public static void setCheckParaAssigned(boolean checkParaAssigned) {
 		ParaDirective.checkParaAssigned = checkParaAssigned;
 		ParaDirective.checkParaAssigned = checkParaAssigned;
 	}
 	}
-	
+
 	public void setExprList(ExprList exprList) {
 	public void setExprList(ExprList exprList) {
 		if (exprList.length() == 0) {
 		if (exprList.length() == 0) {
 			throw new ParseException("The parameter of #para directive can not be blank", location);
 			throw new ParseException("The parameter of #para directive can not be blank", location);
 		}
 		}
-		
+
 		Expr expr = exprList.getExpr(0);
 		Expr expr = exprList.getExpr(0);
 		if (expr instanceof Const && ((Const)expr).isInt()) {
 		if (expr instanceof Const && ((Const)expr).isInt()) {
 			index = ((Const)expr).getInt();
 			index = ((Const)expr).getInt();
@@ -107,7 +107,7 @@ public class ParaDirective extends Directive {
 				throw new ParseException("The index of para array must greater than -1", location);
 				throw new ParseException("The index of para array must greater than -1", location);
 			}
 			}
 		}
 		}
-		
+
         if (exprList.length() > 1) {
         if (exprList.length() > 1) {
             expr = exprList.getExpr(1);
             expr = exprList.getExpr(1);
             if (expr instanceof Const && ((Const)expr).isStr()) {
             if (expr instanceof Const && ((Const)expr).isStr()) {
@@ -125,28 +125,28 @@ public class ParaDirective extends Directive {
                 }
                 }
             }
             }
         }
         }
-		
+
 		if (checkParaAssigned && exprList.getExpr(0) instanceof Id) {
 		if (checkParaAssigned && exprList.getExpr(0) instanceof Id) {
 			Id id = (Id)exprList.getExpr(0);
 			Id id = (Id)exprList.getExpr(0);
 			paraName = id.getId();
 			paraName = id.getId();
 		}
 		}
-		
+
 		this.exprList = exprList;
 		this.exprList = exprList;
 	}
 	}
-	
+
 	public void exec(Env env, Scope scope, Writer writer) {
 	public void exec(Env env, Scope scope, Writer writer) {
 		SqlPara sqlPara = (SqlPara)scope.get(SqlKit.SQL_PARA_KEY);
 		SqlPara sqlPara = (SqlPara)scope.get(SqlKit.SQL_PARA_KEY);
 		if (sqlPara == null) {
 		if (sqlPara == null) {
 			throw new TemplateException("#para directive invoked by getSqlPara(...) method only", location);
 			throw new TemplateException("#para directive invoked by getSqlPara(...) method only", location);
 		}
 		}
-		
+
 		if (index == -1) {
 		if (index == -1) {
 			// #para(paraName) 中的 paraName 没有赋值时抛出异常
 			// #para(paraName) 中的 paraName 没有赋值时抛出异常
 			// issue: https://jfinal.com/feedback/1832
 			// issue: https://jfinal.com/feedback/1832
 			if (checkParaAssigned && paraName != null && !scope.exists(paraName)) {
 			if (checkParaAssigned && paraName != null && !scope.exists(paraName)) {
 				throw new TemplateException("The parameter \""+ paraName +"\" must be assigned", location);
 				throw new TemplateException("The parameter \""+ paraName +"\" must be assigned", location);
 			}
 			}
-			
+
 			handleSqlPara(writer, sqlPara, exprList.getExpr(0).eval(scope));
 			handleSqlPara(writer, sqlPara, exprList.getExpr(0).eval(scope));
 		} else {
 		} else {
 			Object[] paras = (Object[])scope.get(SqlKit.PARA_ARRAY_KEY);
 			Object[] paras = (Object[])scope.get(SqlKit.PARA_ARRAY_KEY);
@@ -156,11 +156,11 @@ public class ParaDirective extends Directive {
 			if (index >= paras.length) {
 			if (index >= paras.length) {
 				throw new TemplateException("The index of #para directive is out of bounds: " + index, location);
 				throw new TemplateException("The index of #para directive is out of bounds: " + index, location);
 			}
 			}
-			
+
 			handleSqlPara(writer, sqlPara, paras[index]);
 			handleSqlPara(writer, sqlPara, paras[index]);
 		}
 		}
 	}
 	}
-	
+
     private void handleSqlPara(Writer writer, SqlPara sqlPara, Object value) {
     private void handleSqlPara(Writer writer, SqlPara sqlPara, Object value) {
         if (type == 0) {
         if (type == 0) {
             write(writer, "?");
             write(writer, "?");
@@ -185,7 +185,7 @@ public class ParaDirective extends Directive {
             }
             }
         }
         }
     }
     }
-    
+
     private void handleCollection(Writer writer, SqlPara sqlPara, Collection<?> collection) {
     private void handleCollection(Writer writer, SqlPara sqlPara, Collection<?> collection) {
         write(writer, "(");
         write(writer, "(");
         boolean first = true;
         boolean first = true;
@@ -200,7 +200,7 @@ public class ParaDirective extends Directive {
         }
         }
         write(writer, ")");
         write(writer, ")");
     }
     }
-    
+
     private void handleArray(Writer writer, SqlPara sqlPara, Object array) {
     private void handleArray(Writer writer, SqlPara sqlPara, Object array) {
         write(writer, "(");
         write(writer, "(");
         int size = Array.getLength(array);
         int size = Array.getLength(array);
@@ -216,5 +216,3 @@ public class ParaDirective extends Directive {
     }
     }
 }
 }
 
 
-
-

+ 6 - 8
src/main/java/com/jfinal/plugin/activerecord/sql/SqlDirective.java

@@ -32,9 +32,9 @@ import com.jfinal.template.stat.Scope;
  * SqlDirective
  * SqlDirective
  */
  */
 public class SqlDirective extends Directive {
 public class SqlDirective extends Directive {
-	
+
 	private String id;
 	private String id;
-	
+
 	public void setExprList(ExprList exprList) {
 	public void setExprList(ExprList exprList) {
 		if (exprList.length() == 0) {
 		if (exprList.length() == 0) {
 			throw new ParseException("The parameter of #sql directive can not be blank", location);
 			throw new ParseException("The parameter of #sql directive can not be blank", location);
@@ -47,10 +47,10 @@ public class SqlDirective extends Directive {
 		} else {
 		} else {
 			throw new ParseException("The parameter of #sql directive must be String", location);
 			throw new ParseException("The parameter of #sql directive must be String", location);
 		}
 		}
-		
+
 		this.id = ((Const)expr).getStr();
 		this.id = ((Const)expr).getStr();
 	}
 	}
-	
+
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
 	public void exec(Env env, Scope scope, Writer writer) {
 	public void exec(Env env, Scope scope, Writer writer) {
 		String nameSpace = (String)scope.get(NameSpaceDirective.NAME_SPACE_KEY);
 		String nameSpace = (String)scope.get(NameSpaceDirective.NAME_SPACE_KEY);
@@ -59,14 +59,12 @@ public class SqlDirective extends Directive {
 		if (sqlTemplateMap.containsKey(key)) {
 		if (sqlTemplateMap.containsKey(key)) {
 			throw new ParseException("Sql already exists with key : " + key, location);
 			throw new ParseException("Sql already exists with key : " + key, location);
 		}
 		}
-		
+
 		sqlTemplateMap.put(key, new Template(env, stat));
 		sqlTemplateMap.put(key, new Template(env, stat));
 	}
 	}
-	
+
 	public boolean hasEnd() {
 	public boolean hasEnd() {
 		return true;
 		return true;
 	}
 	}
 }
 }
 
 
-
-

+ 34 - 35
src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java

@@ -31,63 +31,63 @@ import com.jfinal.template.source.ISource;
  */
  */
 @SuppressWarnings({"unchecked", "rawtypes"})
 @SuppressWarnings({"unchecked", "rawtypes"})
 public class SqlKit {
 public class SqlKit {
-	
+
 	static final String SQL_TEMPLATE_MAP_KEY = "_SQL_TEMPLATE_MAP_";
 	static final String SQL_TEMPLATE_MAP_KEY = "_SQL_TEMPLATE_MAP_";
 	static final String SQL_PARA_KEY = "_SQL_PARA_";
 	static final String SQL_PARA_KEY = "_SQL_PARA_";
 	static final String PARA_ARRAY_KEY = "_PARA_ARRAY_"; // 此参数保持不动,已被用于模板取值 _PARA_ARRAY_[n]
 	static final String PARA_ARRAY_KEY = "_PARA_ARRAY_"; // 此参数保持不动,已被用于模板取值 _PARA_ARRAY_[n]
-	
+
 	private String configName;
 	private String configName;
 	private boolean devMode;
 	private boolean devMode;
 	private Engine engine;
 	private Engine engine;
 	private List<SqlSource> sqlSourceList = new ArrayList<SqlSource>();
 	private List<SqlSource> sqlSourceList = new ArrayList<SqlSource>();
 	private Map<String, Template> sqlTemplateMap;
 	private Map<String, Template> sqlTemplateMap;
-	
+
 	public SqlKit(String configName, boolean devMode) {
 	public SqlKit(String configName, boolean devMode) {
 		this.configName = configName;
 		this.configName = configName;
 		this.devMode = devMode;
 		this.devMode = devMode;
-		
+
 		engine = new Engine(configName);
 		engine = new Engine(configName);
 		engine.setDevMode(devMode);
 		engine.setDevMode(devMode);
 		engine.setToClassPathSourceFactory();
 		engine.setToClassPathSourceFactory();
-		
+
 		engine.addDirective("namespace", NameSpaceDirective.class);
 		engine.addDirective("namespace", NameSpaceDirective.class);
 		engine.addDirective("sql", SqlDirective.class);
 		engine.addDirective("sql", SqlDirective.class);
-		
+
 		engine.addDirective("para", ParaDirective.class, true);
 		engine.addDirective("para", ParaDirective.class, true);
 		engine.addDirective("p", ParaDirective.class, true);		// 配置 #para 指令的别名指令 #p,不建议使用,在此仅为兼容 3.0 版本
 		engine.addDirective("p", ParaDirective.class, true);		// 配置 #para 指令的别名指令 #p,不建议使用,在此仅为兼容 3.0 版本
 	}
 	}
-	
+
 	public SqlKit(String configName) {
 	public SqlKit(String configName) {
 		this(configName, false);
 		this(configName, false);
 	}
 	}
-	
+
 	public Engine getEngine() {
 	public Engine getEngine() {
 		return engine;
 		return engine;
 	}
 	}
-	
+
 	public void setDevMode(boolean devMode) {
 	public void setDevMode(boolean devMode) {
 		this.devMode = devMode;
 		this.devMode = devMode;
 		engine.setDevMode(devMode);
 		engine.setDevMode(devMode);
 	}
 	}
-	
+
 	public void setBaseSqlTemplatePath(String baseSqlTemplatePath) {
 	public void setBaseSqlTemplatePath(String baseSqlTemplatePath) {
 		engine.setBaseTemplatePath(baseSqlTemplatePath);
 		engine.setBaseTemplatePath(baseSqlTemplatePath);
 	}
 	}
-	
+
 	public void addSqlTemplate(String sqlTemplate) {
 	public void addSqlTemplate(String sqlTemplate) {
 		if (StrKit.isBlank(sqlTemplate)) {
 		if (StrKit.isBlank(sqlTemplate)) {
 			throw new IllegalArgumentException("sqlTemplate can not be blank");
 			throw new IllegalArgumentException("sqlTemplate can not be blank");
 		}
 		}
 		sqlSourceList.add(new SqlSource(sqlTemplate));
 		sqlSourceList.add(new SqlSource(sqlTemplate));
 	}
 	}
-	
+
 	public void addSqlTemplate(ISource sqlTemplate) {
 	public void addSqlTemplate(ISource sqlTemplate) {
 		if (sqlTemplate == null) {
 		if (sqlTemplate == null) {
 			throw new IllegalArgumentException("sqlTemplate can not be null");
 			throw new IllegalArgumentException("sqlTemplate can not be null");
 		}
 		}
 		sqlSourceList.add(new SqlSource(sqlTemplate));
 		sqlSourceList.add(new SqlSource(sqlTemplate));
 	}
 	}
-	
+
 	public synchronized void parseSqlTemplate() {
 	public synchronized void parseSqlTemplate() {
 		Map<String, Template> sqlTemplateMap = new HashMap<String, Template>(512, 0.5F);
 		Map<String, Template> sqlTemplateMap = new HashMap<String, Template>(512, 0.5F);
 		for (SqlSource ss : sqlSourceList) {
 		for (SqlSource ss : sqlSourceList) {
@@ -98,12 +98,12 @@ public class SqlKit {
 		}
 		}
 		this.sqlTemplateMap = sqlTemplateMap;
 		this.sqlTemplateMap = sqlTemplateMap;
 	}
 	}
-	
+
 	private void reloadModifiedSqlTemplate() {
 	private void reloadModifiedSqlTemplate() {
 		engine.removeAllTemplateCache();	// 去除 Engine 中的缓存,以免 get 出来后重新判断 isModified
 		engine.removeAllTemplateCache();	// 去除 Engine 中的缓存,以免 get 出来后重新判断 isModified
 		parseSqlTemplate();
 		parseSqlTemplate();
 	}
 	}
-	
+
 	private boolean isSqlTemplateModified() {
 	private boolean isSqlTemplateModified() {
 		for (Template template : sqlTemplateMap.values()) {
 		for (Template template : sqlTemplateMap.values()) {
 			if (template.isModified()) {
 			if (template.isModified()) {
@@ -112,7 +112,7 @@ public class SqlKit {
 		}
 		}
 		return false;
 		return false;
 	}
 	}
-	
+
 	public Template getSqlTemplate(String key) {
 	public Template getSqlTemplate(String key) {
 		Template template = sqlTemplateMap.get(key);
 		Template template = sqlTemplateMap.get(key);
 		if (template == null) {	// 此 if 分支,处理起初没有定义,但后续不断追加 sql 的情况
 		if (template == null) {	// 此 if 分支,处理起初没有定义,但后续不断追加 sql 的情况
@@ -129,7 +129,7 @@ public class SqlKit {
 			}
 			}
 			return template;
 			return template;
 		}
 		}
-		
+
 		if (devMode && template.isModified()) {
 		if (devMode && template.isModified()) {
 			synchronized (this) {
 			synchronized (this) {
 				template = sqlTemplateMap.get(key);
 				template = sqlTemplateMap.get(key);
@@ -141,14 +141,14 @@ public class SqlKit {
 		}
 		}
 		return template;
 		return template;
 	}
 	}
-	
+
 	/**
 	/**
      * 通过 key 获取 sql
      * 通过 key 获取 sql
      */
      */
 	public String getSql(String key) {
 	public String getSql(String key) {
 		return getSql(key, null);
 		return getSql(key, null);
 	}
 	}
-	
+
 	/**
 	/**
 	 * 通过 key 获取 sql
 	 * 通过 key 获取 sql
 	 * 传入变量 Map data 参与 sql 生成
 	 * 传入变量 Map data 参与 sql 生成
@@ -158,7 +158,7 @@ public class SqlKit {
         Template template = getSqlTemplate(key);
         Template template = getSqlTemplate(key);
         return template != null ? template.renderToString(data) : null;
         return template != null ? template.renderToString(data) : null;
     }
     }
-	
+
 	/**
 	/**
 	 * 示例:
 	 * 示例:
 	 * 1:sql 定义
 	 * 1:sql 定义
@@ -175,14 +175,14 @@ public class SqlKit {
 		if (template == null) {
 		if (template == null) {
 			return null;
 			return null;
 		}
 		}
-		
+
 		SqlPara sqlPara = new SqlPara();
 		SqlPara sqlPara = new SqlPara();
 		data.put(SQL_PARA_KEY, sqlPara);
 		data.put(SQL_PARA_KEY, sqlPara);
 		sqlPara.setSql(template.renderToString(data));
 		sqlPara.setSql(template.renderToString(data));
 		data.remove(SQL_PARA_KEY);	// 避免污染传入的 Map
 		data.remove(SQL_PARA_KEY);	// 避免污染传入的 Map
 		return sqlPara;
 		return sqlPara;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 示例:
 	 * 示例:
 	 * 1:sql 定义
 	 * 1:sql 定义
@@ -198,7 +198,7 @@ public class SqlKit {
 		if (template == null) {
 		if (template == null) {
 			return null;
 			return null;
 		}
 		}
-		
+
 		SqlPara sqlPara = new SqlPara();
 		SqlPara sqlPara = new SqlPara();
 		Map data = new HashMap();
 		Map data = new HashMap();
 		data.put(SQL_PARA_KEY, sqlPara);
 		data.put(SQL_PARA_KEY, sqlPara);
@@ -207,52 +207,52 @@ public class SqlKit {
 		// data 为本方法中创建,不会污染用户数据,无需移除 SQL_PARA_KEY、PARA_ARRAY_KEY
 		// data 为本方法中创建,不会污染用户数据,无需移除 SQL_PARA_KEY、PARA_ARRAY_KEY
 		return sqlPara;
 		return sqlPara;
 	}
 	}
-	
+
 	public java.util.Set<java.util.Map.Entry<String, Template>> getSqlMapEntrySet() {
 	public java.util.Set<java.util.Map.Entry<String, Template>> getSqlMapEntrySet() {
 		return sqlTemplateMap.entrySet();
 		return sqlTemplateMap.entrySet();
 	}
 	}
-	
+
 	public String toString() {
 	public String toString() {
 		return "SqlKit for config : " + configName;
 		return "SqlKit for config : " + configName;
 	}
 	}
-	
+
 	// ---------
 	// ---------
-	
+
 	/**
 	/**
 	 * 通过 String 内容获取 SqlPara 对象
 	 * 通过 String 内容获取 SqlPara 对象
-	 * 
+	 *
 	 * <pre>
 	 * <pre>
 	 * 例子:
 	 * 例子:
 	 *     String content = "select * from user where id = #para(id)";
 	 *     String content = "select * from user where id = #para(id)";
 	 *     SqlPara sqlPara = getSqlParaByString(content, Kv.of("id", 123));
 	 *     SqlPara sqlPara = getSqlParaByString(content, Kv.of("id", 123));
-	 * 
+	 *
 	 * 特别注意:content 参数中不能包含 #sql 指令
 	 * 特别注意:content 参数中不能包含 #sql 指令
 	 * </pre>
 	 * </pre>
 	 */
 	 */
 	public SqlPara getSqlParaByString(String content, Map data) {
 	public SqlPara getSqlParaByString(String content, Map data) {
 		Template template = engine.getTemplateByString(content);
 		Template template = engine.getTemplateByString(content);
-		
+
 		SqlPara sqlPara = new SqlPara();
 		SqlPara sqlPara = new SqlPara();
 		data.put(SQL_PARA_KEY, sqlPara);
 		data.put(SQL_PARA_KEY, sqlPara);
 		sqlPara.setSql(template.renderToString(data));
 		sqlPara.setSql(template.renderToString(data));
 		data.remove(SQL_PARA_KEY);	// 避免污染传入的 Map
 		data.remove(SQL_PARA_KEY);	// 避免污染传入的 Map
 		return sqlPara;
 		return sqlPara;
 	}
 	}
-	
+
 	/**
 	/**
 	 * 通过 String 内容获取 SqlPara 对象
 	 * 通过 String 内容获取 SqlPara 对象
-	 * 
+	 *
 	 * <pre>
 	 * <pre>
 	 * 例子:
 	 * 例子:
 	 *     String content = "select * from user where id = #para(0)";
 	 *     String content = "select * from user where id = #para(0)";
 	 *     SqlPara sqlPara = getSqlParaByString(content, 123);
 	 *     SqlPara sqlPara = getSqlParaByString(content, 123);
-	 * 
+	 *
 	 * 特别注意:content 参数中不能包含 #sql 指令
 	 * 特别注意:content 参数中不能包含 #sql 指令
 	 * </pre>
 	 * </pre>
 	 */
 	 */
 	public SqlPara getSqlParaByString(String content, Object... paras) {
 	public SqlPara getSqlParaByString(String content, Object... paras) {
 		Template template = engine.getTemplateByString(content);
 		Template template = engine.getTemplateByString(content);
-		
+
 		SqlPara sqlPara = new SqlPara();
 		SqlPara sqlPara = new SqlPara();
 		Map data = new HashMap();
 		Map data = new HashMap();
 		data.put(SQL_PARA_KEY, sqlPara);
 		data.put(SQL_PARA_KEY, sqlPara);
@@ -265,4 +265,3 @@ public class SqlKit {
 
 
 
 
 
 
-

+ 0 - 1
src/main/java/com/jfinal/plugin/activerecord/sql/SqlSource.java

@@ -42,4 +42,3 @@ class SqlSource {
 }
 }
 
 
 
 
-