Jelajahi Sumber

自动生成代码模板修改

Wang Zi Wen 2 tahun lalu
induk
melakukan
c97577ca53

+ 2 - 2
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java

@@ -63,12 +63,12 @@ public class GenController extends BaseController
     public AjaxResult getInfo(@PathVariable Long tableId)
     {
         GenTable table = genTableService.selectGenTableById(tableId);
-        List<GenTable> tables = genTableService.selectGenTableAll();
+//        List<GenTable> tables = genTableService.selectGenTableAll();
         List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("info", table);
         map.put("rows", list);
-        map.put("tables", tables);
+//        map.put("tables", tables);
         return success(map);
     }
 

+ 1 - 1
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             is_required = #{isRequired,jdbcType=CHAR},
             query_type = #{queryType},
             html_type = #{htmlType},
-            dict_type = #{dictType},
+            <if test="dictType != null">dict_type = #{dictType},</if>
             sort = #{sort},
             update_by = #{updateBy,jdbcType=VARCHAR},
             update_time = sysdate

+ 1 - 0
ruoyi-generator/src/main/resources/vm/java/domain.java.vm

@@ -71,6 +71,7 @@ public class ${ClassName} extends ${Entity}
     {
         return $column.javaField;
     }
+
 #end
 #end
 

+ 55 - 60
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm

@@ -263,36 +263,36 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
-      <!-- 用户导入对话框 -->
-      <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
-          <el-upload
-                  ref="upload"
-                  :limit="1"
-                  accept=".xlsx, .xls"
-                  :headers="upload.headers"
-                  :action="upload.url + '?updateSupport=' + upload.updateSupport"
-                  :disabled="upload.isUploading"
-                  :on-progress="handleFileUploadProgress"
-                  :on-success="handleFileSuccess"
-                  :auto-upload="false"
-                  drag
-          >
-              <i class="el-icon-upload"></i>
-              <div class="el-upload__text">
-                  将文件拖到此处,或
-                  <em>点击上传</em>
-              </div>
-              <div class="el-upload__tip" slot="tip">
-                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
-              </div>
-              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
-          </el-upload>
-          <div slot="footer" class="dialog-footer">
-              <el-button type="primary" @click="submitFileForm">确 定</el-button>
-              <el-button @click="upload.open = false">取 消</el-button>
-          </div>
-      </el-dialog>
+    <!-- 用户导入对话框 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+        <el-upload
+                ref="upload"
+                :limit="1"
+                accept=".xlsx, .xls"
+                :headers="upload.headers"
+                :action="upload.url + '?updateSupport=' + upload.updateSupport"
+                :disabled="upload.isUploading"
+                :on-progress="handleFileUploadProgress"
+                :on-success="handleFileSuccess"
+                :auto-upload="false"
+                drag
+        >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+                将文件拖到此处,或
+                <em>点击上传</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+                <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
+                <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+            </div>
+            <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+        </el-upload>
+        <div slot="footer" class="dialog-footer">
+            <el-button type="primary" @click="submitFileForm">确 定</el-button>
+            <el-button @click="upload.open = false">取 消</el-button>
+        </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -348,10 +348,10 @@ export default {
 #else
 #set($comment=$column.columnComment)
 #end
-###if(${column.dictType} != '')
-##      // $comment字典
-##      ${column.javaField}Options: [],
-###end
+#if(${column.dictType} != '')
+      // $comment字典
+      ${column.javaField}Options: [],
+#end
 #end
         // 用户导入参数
         upload: {
@@ -375,7 +375,6 @@ export default {
 #foreach ($column in $columns)
 #if($column.query)
         $column.javaField: null#if($velocityCount != $columns.size()),#end
-
 #end
 #end
       },
@@ -394,7 +393,6 @@ export default {
         $column.javaField: [
           { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
         ]#if($velocityCount != $columns.size()),#end
-
 #end
 #end
       }
@@ -413,13 +411,13 @@ export default {
       })
     this.getList();
     this.getTreeselect();
-###foreach ($column in $columns)
-###if(${column.dictType} != '')
-##    this.getDicts("${column.dictType}").then(response => {
-##      this.${column.javaField}Options = response.data;
-##    });
-###end
-###end
+#foreach ($column in $columns)
+#if(${column.dictType} != '')
+    this.getDicts("${column.dictType}").then(response => {
+      this.${column.javaField}Options = response.data;
+    });
+#end
+#end
   },
   methods: {
     /** 查询${functionName}列表 */
@@ -437,20 +435,20 @@ export default {
               this.deptOptions = response.data;
           });
      },
-###foreach ($column in $columns)
-###if(${column.dictType} != '')
-###set($parentheseIndex=$column.columnComment.indexOf("("))
-###if($parentheseIndex != -1)
-###set($comment=$column.columnComment.substring(0, $parentheseIndex))
-###else
-###set($comment=$column.columnComment)
-###end
-##    // $comment字典翻译
-##    ${column.javaField}Format(row, column) {
-##      return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
-##    },
-###end
-###end
+#foreach ($column in $columns)
+#if(${column.dictType} != '')
+#set($parentheseIndex=$column.columnComment.indexOf("("))
+#if($parentheseIndex != -1)
+#set($comment=$column.columnComment.substring(0, $parentheseIndex))
+#else
+#set($comment=$column.columnComment)
+#end
+    // $comment字典翻译
+    ${column.javaField}Format(row, column) {
+      return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
+    },
+#end
+#end
     // 取消按钮
     cancel() {
       this.open = false;
@@ -462,13 +460,10 @@ export default {
 #foreach ($column in $columns)
 #if($column.htmlType == "radio")
         $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end
-
 #elseif($column.htmlType == "checkbox")
         $column.javaField: []#if($velocityCount != $columns.size()),#end
-
 #else
         $column.javaField: null#if($velocityCount != $columns.size()),#end
-
 #end
 #end
       };