浏览代码

模板修改

master
郑根木 2 年前
父节点
当前提交
701ab73efd
共有 3 个文件被更改,包括 25 次插入14 次删除
  1. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java
  2. +2
    -2
      smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_model.ftl
  3. +22
    -11
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/FileUtil.java

+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java 查看文件

@@ -94,7 +94,7 @@ public class DynPageHelper {
sqlNamedPara.sql = sql.toString() + " from (" + sqlNamedPara.sql + ") xxxxa";
return sqlNamedPara;
}
private static String buildSelFieldsSql(PageDataset dataSet, SqlNamedPara sqlNamedPara) {
StringBuilder sql = new StringBuilder(512);
//主表


+ 2
- 2
smtweb-framework/bpm/src/main/resources/static/template/incModel/inc_model.ftl 查看文件

@@ -5,7 +5,7 @@
<#list dataset.fields as field>
{
"id": "${field.id}",
"field": "${field.field}"<#if field.widget gt 0>,
"field": "${field.name}"<#if field.widget gt 0>,
"lookup": {
"widgetId": "${field.widget?c}",
"widgetId_text": "${field.widgetText}",
@@ -19,7 +19,7 @@
<#list dataset.filters as field>
{
"id": "${field.id}",
"field": "${field.field!0}",
"field": "${field.name!0}",
"required": ${field.required?string ("true","false")},
"type": "input"
}<#if field_has_next>,</#if>


+ 22
- 11
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/FileUtil.java 查看文件

@@ -1,10 +1,13 @@
package cc.smtweb.framework.core.util;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
@@ -14,18 +17,26 @@ import java.nio.charset.StandardCharsets;
@Slf4j
public class FileUtil {
/**
* 文件fn是否存在
*
* @param fn fileName
* @return boolean
*/
public static boolean isFileExist(String fn) {
return !(fn == null || fn.length() < 1) && (new File(fn)).exists();
}

/**
* 从fn中读取所有内容
*
* @param fn 源文件名
* @return byte[]
*/
public static byte[] readFileByte(String fn) {
File f = new File(fn);
if (!f.exists()) return null;
try {
FileInputStream fis = new FileInputStream(fn);
byte[] data = new byte[fis.available()];
fis.read(data, 0, data.length);
fis.close();
return data;
return FileUtils.readFileToByteArray(f);
} catch (IOException e) {
log.error(e.getMessage(), e);
return null;
@@ -33,15 +44,15 @@ public class FileUtil {
}

public static String readFileStr(String fn) {
return readFileStr(fn, StandardCharsets.UTF_8.toString());
return readFileStr(fn, StandardCharsets.UTF_8);
}

public static String readFileStr(String fn, String encode) {
byte[] bytes = readFileByte(fn);
if (bytes == null) return null;
public static String readFileStr(String fn, Charset encode) {
File f = new File(fn);
if (!f.exists()) return null;
try {
return new String(bytes, encode);
} catch (UnsupportedEncodingException e) {
return FileUtils.readFileToString(f, encode);
} catch (IOException e) {
log.error(e.getMessage(), e);
return null;
}


正在加载...
取消
保存