Browse Source

系统:增加SwConsts.SysParam.RUN_PROJECTS,启动时只读取指定项目的表定义

4.0
郑根木 2 years ago
parent
commit
9401b1c32b
5 changed files with 25 additions and 12 deletions
  1. +4
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java
  2. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/ListSQLParaHelper.java
  3. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/MathUtil.java
  4. +18
    -9
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/NumberUtil.java
  5. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/PubUtil.java

+ 4
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java View File

@@ -1,5 +1,6 @@
package cc.smtweb.framework.core.common; package cc.smtweb.framework.core.common;


import cc.smtweb.framework.core.util.NumberUtil;
import cc.smtweb.framework.core.util.PubUtil; import cc.smtweb.framework.core.util.PubUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;


@@ -174,11 +175,11 @@ public interface SwEnum {
if (dataType == null) return fieldValue; if (dataType == null) return fieldValue;
switch (dataType.javaType) { switch (dataType.javaType) {
case JAVA_TYPE_LONG: case JAVA_TYPE_LONG:
return PubUtil.getLongIgnoreErr(fieldValue);
return NumberUtil.getLongIgnoreErr(fieldValue);
case JAVA_TYPE_INT: case JAVA_TYPE_INT:
return PubUtil.getIntIgnoreErr(fieldValue);
return NumberUtil.getIntIgnoreErr(fieldValue);
case JAVA_TYPE_BOOL: case JAVA_TYPE_BOOL:
return PubUtil.getBool(fieldValue);
return NumberUtil.getBoolValue(fieldValue);
default: default:
return fieldValue; return fieldValue;
} }


+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/ListSQLParaHelper.java View File

@@ -14,6 +14,7 @@ import java.util.List;
* @version : $Revision:$ * @version : $Revision:$
*/ */
@SuppressWarnings("UnusedDeclaration") @SuppressWarnings("UnusedDeclaration")
@Deprecated
public abstract class ListSQLParaHelper { public abstract class ListSQLParaHelper {






+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/MathUtil.java View File

@@ -10,6 +10,7 @@ import java.text.DecimalFormat;
* Date: 12-12-25 下午1:02 * Date: 12-12-25 下午1:02
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
@Deprecated
public class MathUtil { public class MathUtil {
//整数 //整数
private static DecimalFormat dfLng = new DecimalFormat("##############0"); private static DecimalFormat dfLng = new DecimalFormat("##############0");


+ 18
- 9
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/NumberUtil.java View File

@@ -12,7 +12,8 @@ import java.text.DecimalFormat;
import java.util.Map; import java.util.Map;


public class NumberUtil { public class NumberUtil {
private NumberUtil() {}
private NumberUtil() {
}


//整数 //整数
private static DecimalFormat dfLng = new DecimalFormat("##############0"); private static DecimalFormat dfLng = new DecimalFormat("##############0");
@@ -271,7 +272,7 @@ public class NumberUtil {
*/ */
public static String toStdNumberString(double d, boolean isZeroToEmpty) { public static String toStdNumberString(double d, boolean isZeroToEmpty) {
if (isEqualsZero(d)) { if (isEqualsZero(d)) {
return isZeroToEmpty ? "" : "0.00";
return isZeroToEmpty ? "": "0.00";
} }
return stdNumberFormat.format(d); return stdNumberFormat.format(d);
} }
@@ -304,7 +305,7 @@ public class NumberUtil {
*/ */
public static String toStdPercentNumberStr(double d, boolean isZeroToEmpty) { public static String toStdPercentNumberStr(double d, boolean isZeroToEmpty) {
if (d > -0.00000000001 && d < 0.00000000001) { if (d > -0.00000000001 && d < 0.00000000001) {
return isZeroToEmpty ? "" : "0.00%";
return isZeroToEmpty ? "": "0.00%";
} }
return toStdNumberString(d * 100) + "%"; return toStdNumberString(d * 100) + "%";
} }
@@ -323,7 +324,7 @@ public class NumberUtil {
*/ */
public static String toStdAmountString(double d, boolean isZeroToEmpty) { public static String toStdAmountString(double d, boolean isZeroToEmpty) {
if (isEqualsZero(d)) { if (isEqualsZero(d)) {
return isZeroToEmpty ? "" : "0.00";
return isZeroToEmpty ? "": "0.00";
} }
return stdAmountFormat.format(d); return stdAmountFormat.format(d);
} }
@@ -410,15 +411,15 @@ public class NumberUtil {




public static double chkDbNull(Double v) { public static double chkDbNull(Double v) {
return v == null ? 0 : v;
return v == null ? 0: v;
} }


public static double max(double d1, double d2) { public static double max(double d1, double d2) {
return compare(d1, d2) < 0 ? d2 : d1;
return compare(d1, d2) < 0 ? d2: d1;
} }


public static double min(double d1, double d2) { public static double min(double d1, double d2) {
return compare(d1, d2) < 0 ? d1 : d2;
return compare(d1, d2) < 0 ? d1: d2;
} }


/** /**
@@ -465,6 +466,14 @@ public class NumberUtil {
} }
} }


public static int getBoolValue(String s) {
String value = s.toLowerCase();
if ("true".equalsIgnoreCase(value) || "1".equals(value) || "y".equalsIgnoreCase(value)) {
return 1;
}
return 0;
}

/** /**
* 计算公式 参数以Map方式传入 * 计算公式 参数以Map方式传入
* *
@@ -523,13 +532,13 @@ public class NumberUtil {


public static boolean calcExprMapBool(String expr, Map<String, Object> mapVar) { public static boolean calcExprMapBool(String expr, Map<String, Object> mapVar) {
Object o = calcExprMapObject(expr, mapVar); Object o = calcExprMapObject(expr, mapVar);
if (o != null) return (Boolean)o;
if (o != null) return (Boolean) o;
return false; return false;
} }


public static boolean calcExprBoolEx(String expr, Object... vars) { public static boolean calcExprBoolEx(String expr, Object... vars) {
Object o = calcExprObjectEx(expr, vars); Object o = calcExprObjectEx(expr, vars);
if (o != null) return (Boolean)o;
if (o != null) return (Boolean) o;
return false; return false;
} }




+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/PubUtil.java View File

@@ -23,6 +23,7 @@ import java.util.regex.Pattern;
*/ */
@SuppressWarnings("UnusedDeclaration") @SuppressWarnings("UnusedDeclaration")
@Slf4j @Slf4j
@Deprecated
public class PubUtil { public class PubUtil {
private static SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd"); private static SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd");
private static SimpleDateFormat tFormat = new SimpleDateFormat("HH:mm:ss"); private static SimpleDateFormat tFormat = new SimpleDateFormat("HH:mm:ss");


Loading…
Cancel
Save