瀏覽代碼

修改常量生成工具类

Heyuan 11 月之前
父節點
當前提交
8414005f8f

+ 8 - 3
cosmic/base/q1k2-base-common/src/main/java/q1k2/base/common/plugin/formplugin/GenMetaConstantPlugin.java

@@ -85,7 +85,7 @@ public class GenMetaConstantPlugin extends AbstractFormPlugin {
         DataEntityPropertyCollection mainEntityProperties = mainEntityType.getProperties();
 
         // 创建前缀代码
-        this.createPrefixCode(content, javaName, entityName);
+        this.createPrefixCode(content, entityNumber, entityName);
         String annotation = "    /**" + entityName + "**/" + LINEFEED;
         String code = "    public static final String " + entityNumber.toUpperCase() + " = \"" + entityNumber + "\";" + LINEFEED;
         content.append(annotation + code);
@@ -161,7 +161,11 @@ public class GenMetaConstantPlugin extends AbstractFormPlugin {
         content.append("}" + LINEFEED);
     }
 
-    protected void createPrefixCode(StringBuilder content, String javaName, String entityName) {
+    protected void createPrefixCode(StringBuilder content, String entityNumber, String entityName) {
+        // 生成常量类名
+        String javaName = entityNumber + "Constant";
+        javaName = this.rename(javaName);
+
         String packageName = "kd.constant";
         Object packageNameValue = this.getModel().getValue(PACKAGENAME);
         if (packageNameValue != null && !packageNameValue.toString().isEmpty()) {
@@ -173,7 +177,8 @@ public class GenMetaConstantPlugin extends AbstractFormPlugin {
         String dateStr = this.formatter.format(new Date());
         String prefixCode = "package " + packageName + ";" + LINEFEED + LINEFEED + "/**" + LINEFEED + " * "
                 + entityName + "常量类" + LINEFEED + " *" + LINEFEED + " * @author " + rdNumber + LINEFEED + " * @version 1.0"
-                + LINEFEED + " * @date " + dateStr + LINEFEED + " */" + LINEFEED + "public class " + javaName + " {" + LINEFEED;
+                + LINEFEED + " * @date " + dateStr + LINEFEED + " */" + LINEFEED + "public class " + javaName + " {" + LINEFEED + LINEFEED
+                + "    public static final String FORMBILLID = \"" + entityNumber + "\";" + LINEFEED;
         content.append(prefixCode);
     }