From 9d55d7102ff7d54228e6a598ef234dcb6c0ad293 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期二, 28 十一月 2023 11:31:29 +0800
Subject: [PATCH] 优化代码生成和接口顺序

---
 ruoyi-generator/src/main/resources/vm/sql/sql.vm                                  |   42 ++++++++++++--------
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java |    5 ++
 ruoyi-generator/src/main/resources/vm/vue/index.vue.vm                            |   14 +++---
 3 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index 497f239..94b9e87 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -3,6 +3,8 @@
 import java.util.List;
 import java.util.Set;
 
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.github.xiaoymin.knife4j.annotations.ApiSort;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.system.service.ISysConfigService;
@@ -30,6 +32,7 @@
  */
 @RestController
 @Api(tags = "鐧诲綍楠岃瘉鎺ュ彛")
+@ApiSort(1)
 @Anonymous
 public class SysLoginController {
     @Autowired
@@ -49,6 +52,7 @@
      */
     @PostMapping("/login")
     @ApiOperation(value = "鐧诲綍")
+    @ApiOperationSupport(order = 1)
     public AjaxResult login(@RequestBody LoginBody loginBody) {
         AjaxResult ajax = AjaxResult.success();
         // 鐢熸垚浠ょ墝
@@ -65,6 +69,7 @@
      */
     @GetMapping("getInfo")
     @ApiOperation(value = "鑾峰彇鐢ㄦ埛淇℃伅")
+    @ApiOperationSupport(order = 2)
     public AjaxResult getInfo() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         // 璧嬪�艰瀺浜憈oken鍒扮敤鎴蜂俊鎭�
diff --git a/ruoyi-generator/src/main/resources/vm/sql/sql.vm b/ruoyi-generator/src/main/resources/vm/sql/sql.vm
index f132158..60bfcc1 100644
--- a/ruoyi-generator/src/main/resources/vm/sql/sql.vm
+++ b/ruoyi-generator/src/main/resources/vm/sql/sql.vm
@@ -1,22 +1,30 @@
 -- 鑿滃崟 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', now(), '', null, '${functionName}鑿滃崟');
+insert into sys_menu (menu_name,menu_name_i18n,  parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values('${functionName}','', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', now(), '', null, '${functionName}鑿滃崟');
 
 -- 鎸夐挳鐖惰彍鍗旾D
-SELECT @parentId := LAST_INSERT_ID();
-
+-- SELECT @parentId := LAST_INSERT_ID();
+with parentId as (select lastval() seq )
 -- 鎸夐挳 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鏌ヨ', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query',        '#', 'admin', now(), '', null, '');
+insert into sys_menu (menu_name,menu_name_i18n, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+values
+('${functionName}鏌ヨ','query',  (select seq from parentId), '1',  '#',  '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query',        '#', 'admin', now(), '', null, ''),
+('${functionName}鏂板','add',    (select seq from parentId), '2',  '#',  '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add',          '#', 'admin', now(), '', null, ''),
+('${functionName}淇敼','edit',   (select seq from parentId), '3',  '#',  '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit',         '#', 'admin', now(), '', null, ''),
+('${functionName}鍒犻櫎','remove', (select seq from parentId), '4',  '#',  '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove',       '#', 'admin', now(), '', null, ''),
+('${functionName}瀵煎嚭','export', (select seq from parentId), '5',  '#',  '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export',       '#', 'admin', now(), '', null, '');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鏂板', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add',          '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}淇敼', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit',         '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}鍒犻櫎', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove',       '#', 'admin', now(), '', null, '');
-
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}瀵煎嚭', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export',       '#', 'admin', now(), '', null, '');
\ No newline at end of file
+##insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+##values('${functionName}鏌ヨ', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query',        '#', 'admin', now(), '', null, '');
+##
+##insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+##values('${functionName}鏂板', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add',          '#', 'admin', now(), '', null, '');
+##
+##insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+##values('${functionName}淇敼', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit',         '#', 'admin', now(), '', null, '');
+##
+##insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+##values('${functionName}鍒犻櫎', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove',       '#', 'admin', now(), '', null, '');
+##
+##insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
+##values('${functionName}瀵煎嚭', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export',       '#', 'admin', now(), '', null, '');
\ No newline at end of file
diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
index 6296014..7e5a458 100644
--- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
@@ -139,13 +139,13 @@
       </el-table-column>
 #elseif($column.list && "" != $column.dictType)
       <el-table-column label="${comment}" align="center" prop="${javaField}">
-        <template slot-scope="scope">
-#if($column.htmlType == "checkbox")
-          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
-#else
-          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
-#end
-        </template>
+##        <template slot-scope="scope">
+###if($column.htmlType == "checkbox")
+##          <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
+###else
+##         <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
+###end
+##        </template>
       </el-table-column>
 #elseif($column.list && "" != $javaField)
       <el-table-column label="${comment}" align="center" prop="${javaField}" />

--
Gitblit v1.9.3