diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java
index e73a0e0..e0b84ce 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysUser.java
@@ -7,7 +7,6 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
@@ -198,7 +197,6 @@ public class SysUser extends BaseEntity
this.avatar = avatar;
}
- @JsonIgnore
@JsonProperty
public String getPassword()
{
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/GenConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/GenConstants.java
index 5b0a2c9..a917875 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/GenConstants.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/GenConstants.java
@@ -22,6 +22,12 @@ public class GenConstants
/** 树名称字段 */
public static final String TREE_NAME = "treeName";
+ /** 上级菜单ID字段 */
+ public static final String PARENT_MENU_ID = "parentMenuId";
+
+ /** 上级菜单名称字段 */
+ public static final String PARENT_MENU_NAME = "parentMenuName";
+
/** 数据库字符串类型 */
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "narchar", "varchar2", "tinytext", "text",
"mediumtext", "longtext" };
diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/RuoYiGatewayApplication.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/RuoYiGatewayApplication.java
index d1f6ec1..af0fcc8 100644
--- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/RuoYiGatewayApplication.java
+++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/RuoYiGatewayApplication.java
@@ -28,4 +28,4 @@ public class RuoYiGatewayApplication
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
-}
\ No newline at end of file
+}
diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/domain/GenTable.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/domain/GenTable.java
index 86fc86a..cba6c5a 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/domain/GenTable.java
+++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/domain/GenTable.java
@@ -74,6 +74,12 @@ public class GenTable extends BaseEntity
/** 树名称字段 */
private String treeName;
+ /** 上级菜单ID字段 */
+ private String parentMenuId;
+
+ /** 上级菜单名称字段 */
+ private String parentMenuName;
+
public Long getTableId()
{
return tableId;
@@ -234,6 +240,26 @@ public class GenTable extends BaseEntity
this.treeName = treeName;
}
+ public String getParentMenuId()
+ {
+ return parentMenuId;
+ }
+
+ public void setParentMenuId(String parentMenuId)
+ {
+ this.parentMenuId = parentMenuId;
+ }
+
+ public String getParentMenuName()
+ {
+ return parentMenuName;
+ }
+
+ public void setParentMenuName(String parentMenuName)
+ {
+ this.parentMenuName = parentMenuName;
+ }
+
public boolean isTree()
{
return isTree(this.tplCategory);
@@ -268,4 +294,4 @@ public class GenTable extends BaseEntity
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}
-}
\ No newline at end of file
+}
diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
index 817dd3a..cb87a6f 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
+++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java
@@ -336,9 +336,14 @@ public class GenTableServiceImpl implements IGenTableService
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
+ String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
+ String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
+
genTable.setTreeCode(treeCode);
genTable.setTreeParentCode(treeParentCode);
genTable.setTreeName(treeName);
+ genTable.setParentMenuId(parentMenuId);
+ genTable.setParentMenuName(parentMenuName);
}
}
}
\ No newline at end of file
diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/util/VelocityUtils.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/util/VelocityUtils.java
index 6902e62..fc78c33 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/util/VelocityUtils.java
+++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/util/VelocityUtils.java
@@ -23,6 +23,9 @@ public class VelocityUtils
/** mybatis空间路径 */
private static final String MYBATIS_PATH = "main/resources/mapper";
+
+ /** 默认上级菜单,系统工具 */
+ private static final String DEFAULT_PARENT_MENU_ID = "3";
/**
* 设置模板变量信息
@@ -55,12 +58,21 @@ public class VelocityUtils
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
velocityContext.put("columns", genTable.getColumns());
velocityContext.put("table", genTable);
+ setMenuVelocityContext(velocityContext, genTable);
if (GenConstants.TPL_TREE.equals(tplCategory))
{
setTreeVelocityContext(velocityContext, genTable);
}
return velocityContext;
}
+
+ public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
+ {
+ String options = genTable.getOptions();
+ JSONObject paramsObj = JSONObject.parseObject(options);
+ String parentMenuId = getParentMenuId(paramsObj);
+ context.put("parentMenuId", parentMenuId);
+ }
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable)
{
@@ -221,7 +233,21 @@ public class VelocityUtils
public static String getPermissionPrefix(String moduleName, String businessName)
{
return StringUtils.format("{}:{}", moduleName, businessName);
+ }
+ /**
+ * 获取上级菜单ID字段
+ *
+ * @param options 生成其他选项
+ * @return 上级菜单ID字段
+ */
+ public static String getParentMenuId(JSONObject paramsObj)
+ {
+ if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID))
+ {
+ return paramsObj.getString(GenConstants.PARENT_MENU_ID);
+ }
+ return DEFAULT_PARENT_MENU_ID;
}
/**
@@ -236,7 +262,7 @@ public class VelocityUtils
{
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
}
- return "";
+ return StringUtils.EMPTY;
}
/**
@@ -251,7 +277,7 @@ public class VelocityUtils
{
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
}
- return "";
+ return StringUtils.EMPTY;
}
/**
@@ -266,7 +292,7 @@ public class VelocityUtils
{
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
}
- return "";
+ return StringUtils.EMPTY;
}
/**
@@ -295,4 +321,4 @@ public class VelocityUtils
}
return num;
}
-}
\ No newline at end of file
+}
diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/sql/sql.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/sql/sql.vm
index ab17d1b..5e3c682 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/sql/sql.vm
+++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/sql/sql.vm
@@ -1,6 +1,6 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('${functionName}', '3', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '${functionName}菜单');
+values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '${functionName}菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue
index fb1bba1..38cbd55 100644
--- a/ruoyi-ui/src/views/tool/gen/editTable.vue
+++ b/ruoyi-ui/src/views/tool/gen/editTable.vue
@@ -110,7 +110,7 @@
-
+
@@ -124,9 +124,11 @@
diff --git a/ruoyi-ui/src/views/tool/gen/importTable.vue b/ruoyi-ui/src/views/tool/gen/importTable.vue
index 6c56c77..e48a5f3 100644
--- a/ruoyi-ui/src/views/tool/gen/importTable.vue
+++ b/ruoyi-ui/src/views/tool/gen/importTable.vue
@@ -28,8 +28,8 @@
-
-
+
+