Commit a9cb90a9 by stylefeng

代码生成完善

parent af53b9bf
......@@ -7,11 +7,25 @@
<div class="row">
<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 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>
......
......@@ -3,15 +3,29 @@
<div class="ibox-content">
<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="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 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>
......
......@@ -44,7 +44,13 @@ ${context.bizEnBigName}InfoDlg.close = 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;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.*;
import java.util.Map.Entry;
......@@ -52,10 +53,10 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/4/18 12:55
*/
public static String dateType(Object o){
if(o instanceof Date){
public static String dateType(Object o) {
if (o instanceof Date) {
return DateUtil.getDay((Date) o);
}else{
} else {
return o.toString();
}
}
......@@ -69,16 +70,16 @@ public class ToolUtil {
*/
public static String getExceptionMsg(Exception e) {
StringWriter sw = new StringWriter();
try{
try {
e.printStackTrace(new PrintWriter(sw));
}finally {
} finally {
try {
sw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
return sw.getBuffer().toString().replaceAll("\\$","T");
return sw.getBuffer().toString().replaceAll("\\$", "T");
}
/**
......@@ -483,7 +484,7 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/5/7 21:56
*/
public static String currentTime(){
public static String currentTime() {
return DateUtil.getTime();
}
......@@ -493,7 +494,7 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/5/7 22:01
*/
public static String firstLetterToUpper(String val){
public static String firstLetterToUpper(String val) {
return StrKit.firstCharToUpperCase(val);
}
......@@ -503,7 +504,7 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/5/7 22:02
*/
public static String firstLetterToLower(String val){
public static String firstLetterToLower(String val) {
return StrKit.firstCharToLowerCase(val);
}
......@@ -513,11 +514,11 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/5/24 22:34
*/
public static Boolean isWinOs(){
public static Boolean isWinOs() {
String os = System.getProperty("os.name");
if(os.toLowerCase().startsWith("win")){
if (os.toLowerCase().startsWith("win")) {
return true;
}else{
} else {
return false;
}
}
......@@ -528,7 +529,23 @@ public class ToolUtil {
* @author stylefeng
* @Date 2017/5/24 22:35
*/
public static String getTempPath(){
public static String getTempPath() {
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