Commit 87c096d0 authored by yanzg's avatar yanzg

Excel导出功能

parent d11ca8a5
......@@ -422,9 +422,12 @@ public abstract class BaseDaoSql {
sql += code;
}
}
// 代码片段缓存
Map<String, List<String>> codeMap = new HashMap<>(DaoConst.COLLECTION_INIT_SIZE);
// 代码片段处理
sql = handleCodeMap(sql, sqlData, model);
// 处理字段以及代码片段
sql = handleCodeRelease(sql, sqlData, model, codeMap);
sql = handleCodeReplace(sql, codeMap);
// 通过正则表达式处理参数 @name 并替换SQL语句成 ?
sql = handlePara(sql, paras, model);
......@@ -439,7 +442,7 @@ public abstract class BaseDaoSql {
* @param codeMap 替换内容
* @return Sql语句值
*/
protected String handleCodeRepalce(String sql, Map<String, List<String>> codeMap) {
protected String handleCodeReplace(String sql, Map<String, List<String>> codeMap) {
// 正则表达式匹配代码片段,并根据代码片段获取数组进行增加
String regex = "\\{.*?\\}";
Pattern p = Pattern.compile(regex);
......@@ -458,15 +461,15 @@ public abstract class BaseDaoSql {
}
/**
* 代码片段处理
* 生成代码片段缓存
*
* @param sql sql语句
* @param sqlData sql语句实体
* @param model  实体参数
* @param codeMap  缓存对象
* @return
*/
private String handleCodeMap(String sql, SqlData sqlData, Object model) {
// 处理字段以及代码片段
// 代码片段缓存
Map<String, List<String>> codeMap = new HashMap<>(DaoConst.COLLECTION_INIT_SIZE);
private String handleCodeRelease(String sql, SqlData sqlData, Object model, Map<String, List<String>> codeMap) {
// 循环处理字段
for (SqlDataField field : sqlData.getSqlDataFields()) {
// 获取值
......@@ -500,8 +503,6 @@ public abstract class BaseDaoSql {
addCodeMap(codeMap, codeName, codeValue);
}
}
sql = handleCodeRepalce(sql, codeMap);
return sql;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment