Selaa lähdekoodia

update 优化 代码生成器 自动适配oss翻译

疯狂的狮子Li 11 kuukautta sitten
vanhempi
commit
0ad52b18b8

+ 3 - 0
ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/util/VelocityUtils.java

@@ -215,6 +215,9 @@ public class VelocityUtils {
                 importList.add("com.fasterxml.jackson.annotation.JsonFormat");
             } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) {
                 importList.add("java.math.BigDecimal");
+            } else if (!column.isSuperColumn() && "imageUpload".equals(column.getHtmlType())) {
+                importList.add("org.dromara.common.translation.annotation.Translation");
+                importList.add("org.dromara.common.translation.constant.TransConstant");
             }
         }
         return importList;

+ 7 - 0
ruoyi-modules/ruoyi-generator/src/main/resources/vm/java/vo.java.vm

@@ -53,6 +53,13 @@ public class ${ClassName}Vo implements Serializable {
 #end
     private $column.javaType $column.javaField;
 
+#if($column.htmlType == "imageUpload")
+    /**
+     * ${column.columnComment}Url
+     */
+    @Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "${column.javaField}")
+    private String ${column.javaField}Url";
+#end
 #end
 #end
 

+ 6 - 0
ruoyi-modules/ruoyi-generator/src/main/resources/vm/ts/types.ts.vm

@@ -9,6 +9,12 @@ export interface ${BusinessName}VO {
                         #elseif($column.javaType == 'Boolean') boolean;
                         #else string;
                     #end
+#if($column.htmlType == "imageUpload")
+  /**
+   * ${column.columnComment}Url
+   */
+  ${column.javaField}Url: string;
+#end
 #end
 #end
 #if ($table.tree)

+ 2 - 2
ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm

@@ -101,9 +101,9 @@
           </template>
         </el-table-column>
 #elseif($column.list && $column.htmlType == "imageUpload")
-        <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
+        <el-table-column label="${comment}" align="center" prop="${javaField}Url" width="100">
           <template #default="scope">
-            <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
+            <image-preview :src="scope.row.${javaField}Url" :width="50" :height="50"/>
           </template>
         </el-table-column>
 #elseif($column.list && $column.dictType && "" != $column.dictType)