Commit a9cb90a9 by stylefeng

代码生成完善

parent af53b9bf
...@@ -7,11 +7,25 @@ ...@@ -7,11 +7,25 @@
<div class="row"> <div class="row">
<div class="col-sm-6 b-r"> <div class="col-sm-6 b-r">
<% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %>
<% var rightSize = tool.toInt(table.fields.~size - leftSize); %>
<% for(var i=0;i<leftSize;i++){ %>
<% if(i != (leftSize-1) ){ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/>
<% }else{ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/>
<% } %>
<% } %>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<% for(var i=leftSize;i<table.fields.~size;i++){ %>
<% if(i != (rightSize-1) ){ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" underline="true"/>
<% }else{ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}"/>
<% } %>
<% } %>
</div> </div>
</div> </div>
......
...@@ -3,15 +3,29 @@ ...@@ -3,15 +3,29 @@
<div class="ibox-content"> <div class="ibox-content">
<div class="form-horizontal"> <div class="form-horizontal">
<input type="hidden" id="id" value="\${${context.bizEnName}.id}"> <input type="hidden" id="id" value="\${item.id}">
<div class="row"> <div class="row">
<div class="col-sm-6 b-r"> <div class="col-sm-6 b-r">
<% var leftSize = tool.toInt((table.fields.~size + 1) / 2); %>
<% var rightSize = tool.toInt(table.fields.~size - leftSize); %>
<% for(var i=0;i<leftSize;i++){ %>
<% if(i != (leftSize-1) ){ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/>
<% }else{ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" />
<% } %>
<% } %>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<% for(var i=leftSize;i<table.fields.~size;i++){ %>
<% if(i != (table.fields.~size-1) ){ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" underline="true"/>
<% }else{ %>
<#input id="${table.fields[i].propertyName}" name="${table.fields[i].comment}" value="\${item.${table.fields[i].propertyName}}" />
<% } %>
<% } %>
</div> </div>
</div> </div>
......
...@@ -44,7 +44,13 @@ ${context.bizEnBigName}InfoDlg.close = function() { ...@@ -44,7 +44,13 @@ ${context.bizEnBigName}InfoDlg.close = function() {
* 收集数据 * 收集数据
*/ */
${context.bizEnBigName}InfoDlg.collectData = function() { ${context.bizEnBigName}InfoDlg.collectData = function() {
this.set('id'); this
<% for(item in table.fields!){ %>
<% if(itemLP.last != true){ %>
.set('${item.propertyName}')
<% }else{ %>
;
<% }} %>
} }
/** /**
......
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
...@@ -45,17 +46,17 @@ public class ToolUtil { ...@@ -45,17 +46,17 @@ public class ToolUtil {
} }
return sb.toString(); return sb.toString();
} }
/** /**
* 判断一个对象是否是时间类型 * 判断一个对象是否是时间类型
* *
* @author stylefeng * @author stylefeng
* @Date 2017/4/18 12:55 * @Date 2017/4/18 12:55
*/ */
public static String dateType(Object o){ public static String dateType(Object o) {
if(o instanceof Date){ if (o instanceof Date) {
return DateUtil.getDay((Date) o); return DateUtil.getDay((Date) o);
}else{ } else {
return o.toString(); return o.toString();
} }
} }
...@@ -69,16 +70,16 @@ public class ToolUtil { ...@@ -69,16 +70,16 @@ public class ToolUtil {
*/ */
public static String getExceptionMsg(Exception e) { public static String getExceptionMsg(Exception e) {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try{ try {
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
}finally { } finally {
try { try {
sw.close(); sw.close();
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
} }
return sw.getBuffer().toString().replaceAll("\\$","T"); return sw.getBuffer().toString().replaceAll("\\$", "T");
} }
/** /**
...@@ -483,7 +484,7 @@ public class ToolUtil { ...@@ -483,7 +484,7 @@ public class ToolUtil {
* @author stylefeng * @author stylefeng
* @Date 2017/5/7 21:56 * @Date 2017/5/7 21:56
*/ */
public static String currentTime(){ public static String currentTime() {
return DateUtil.getTime(); return DateUtil.getTime();
} }
...@@ -493,7 +494,7 @@ public class ToolUtil { ...@@ -493,7 +494,7 @@ public class ToolUtil {
* @author stylefeng * @author stylefeng
* @Date 2017/5/7 22:01 * @Date 2017/5/7 22:01
*/ */
public static String firstLetterToUpper(String val){ public static String firstLetterToUpper(String val) {
return StrKit.firstCharToUpperCase(val); return StrKit.firstCharToUpperCase(val);
} }
...@@ -503,7 +504,7 @@ public class ToolUtil { ...@@ -503,7 +504,7 @@ public class ToolUtil {
* @author stylefeng * @author stylefeng
* @Date 2017/5/7 22:02 * @Date 2017/5/7 22:02
*/ */
public static String firstLetterToLower(String val){ public static String firstLetterToLower(String val) {
return StrKit.firstCharToLowerCase(val); return StrKit.firstCharToLowerCase(val);
} }
...@@ -513,11 +514,11 @@ public class ToolUtil { ...@@ -513,11 +514,11 @@ public class ToolUtil {
* @author stylefeng * @author stylefeng
* @Date 2017/5/24 22:34 * @Date 2017/5/24 22:34
*/ */
public static Boolean isWinOs(){ public static Boolean isWinOs() {
String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
if(os.toLowerCase().startsWith("win")){ if (os.toLowerCase().startsWith("win")) {
return true; return true;
}else{ } else {
return false; return false;
} }
} }
...@@ -528,7 +529,23 @@ public class ToolUtil { ...@@ -528,7 +529,23 @@ public class ToolUtil {
* @author stylefeng * @author stylefeng
* @Date 2017/5/24 22:35 * @Date 2017/5/24 22:35
*/ */
public static String getTempPath(){ public static String getTempPath() {
return System.getProperty("java.io.tmpdir"); return System.getProperty("java.io.tmpdir");
} }
/**
* 把一个数转化为int
*
* @author fengshuonan
* @Date 2017/11/15 下午11:10
*/
public static Integer toInt(Object val) {
if (val instanceof Double) {
BigDecimal bigDecimal = new BigDecimal((Double) val);
return bigDecimal.intValue();
} else {
return (Integer) val;
}
}
} }
\ No newline at end of file
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