Pārlūkot izejas kodu

模板修改

master
郑根木 pirms 2 gadiem
vecāks
revīzija
701ab73efd
3 mainītis faili ar 25 papildinājumiem un 14 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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;
}


Notiek ielāde…
Atcelt
Saglabāt