wutianbin 7 years ago
parent
commit
9d11be5f19

+ 2 - 2
src/main/java/org/geek/szbay/assistant/code/CodeHelpper.java

@@ -42,8 +42,8 @@ public class CodeHelpper {
     /** 表的前导字符 */
     //private String preTableName = "*";
     //private String preTableName = "fp_exam";
-    //private String preTableName = "fp\\_exam";
-    private String preTableName = "sys\\_";
+    private String preTableName = "fp\\_exam";
+    //private String preTableName = "sys\\_";
     
     /** 指定实体生成所在包的路径 */
     private String entityOutPath = "com.donghaiair.flyprepare.admin.domain";

+ 27 - 6
src/main/java/org/geek/szbay/assistant/code/generator/UpdateFtlMaker.java

@@ -36,18 +36,31 @@ public class UpdateFtlMaker {
 			String attrDescr = colComments.get(i);
 			String attrType = colTypes.get(i);
 
-			if (attrName.equals(keyName)) {
+			if ((attrName.contains("createdOn") || attrName.contains("modifiedOn"))
+					&& colTypes.get(i).contains("Date")) {
+				continue;
+			} else if (attrName.contains("createdBy") || attrName.contains("modifiedBy")) {
+				continue;
+			} 
+			//if (attrName.equals(keyName)) {			
+			if (attrName.equals(keyName) && "id".equals(keyName)) {
 				continue;
 			}
-
+			
 			sb1.append(String.format("\t\t\t\t\t\t\t\t\t<th>%s</th>\r\n", attrDescr));
 			if (attrType.contains("Date")) {
 				sb2.append(String.format("\t\t\t\t\t\t\t\t\t<th>${(item.%s?string('yyyy-MM-dd HH:mm:ss'))!}</th>\r\n",
 						attrName));
 			} else {
-				sb2.append(String.format(
+				if (attrType.toLowerCase().contains("int")) {
+					sb2.append(String.format(
+							"\t\t\t\t\t\t\t\t\t<td><#if globalDict['%s']?exists && globalDict['%s'][item.%s?c]?exists> ${globalDict['%s'][item.%s?c]!} <#else> ${item.%s!} </#if></td>\r\n",
+							attrName, attrName, attrName, attrName, attrName, attrName));
+				} else {
+					sb2.append(String.format(
 						"\t\t\t\t\t\t\t\t\t<td><#if globalDict['%s']?exists && globalDict['%s'][item.%s]?exists> ${globalDict['%s'][item.%s]!} <#else> ${item.%s!} </#if></td>\r\n",
 						attrName, attrName, attrName, attrName, attrName, attrName));
+				}
 			}
 		}
 		sb1.append("\t\t\t\t\t\t\t\t\t<th>操作</th>");
@@ -64,6 +77,8 @@ public class UpdateFtlMaker {
 		int size = attrNames.size();
 		for (int i = 0; i < size; i++) {
 			String attrName = attrNames.get(i);
+			String attrType = colTypes.get(i);
+			
 			if ((attrName.contains("createdOn") || attrName.contains("modifiedOn"))
 					&& colTypes.get(i).contains("Date")) {
 				continue;
@@ -85,7 +100,7 @@ public class UpdateFtlMaker {
 
 				sb.append("\t\t<div class=\"col-md-9\">\r\n");
 
-				if (colTypes.get(i).contains("Date")) {
+				if (attrType.contains("Date")) {
 					sb.append(String.format(
 							"\t\t\t<input type=\"text\" class=\"form-control\" name=\"%s\" value=\"%s\" />\r\n",
 							attrName,
@@ -97,10 +112,16 @@ public class UpdateFtlMaker {
 
 					sb.append(String.format("\t\t\t\t<#list globalDict['%s']?keys as key>\r\n", attrName));
 
-					sb.append(String.format("\t\t\t\t<option value=\"${key}\"%s>${globalDict['%s'][key]!}</option>\r\n",
+					if (attrType.toLowerCase().contains("int")) {
+						sb.append(String.format("\t\t\t\t<option value=\"${key}\"%s>${globalDict['%s'][key]!}</option>\r\n",
+								update ? (" ${(key==ret.model." + attrName + "?c)?string( 'selected=\"selected\"','')}") : "",
+								attrName));
+					} else {
+						sb.append(String.format("\t\t\t\t<option value=\"${key}\"%s>${globalDict['%s'][key]!}</option>\r\n",
 							update ? (" ${(key==ret.model." + attrName + ")?string( 'selected=\"selected\"','')}") : "",
 							attrName));
-
+					}
+					
 					sb.append("\t\t\t\t</#list>\r\n");
 
 					sb.append(String.format(