浏览代码

extraParam

shiqian 3 年之前
父节点
当前提交
f176226f16

+ 13 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/SysMenu.java

@@ -85,6 +85,19 @@ public class SysMenu extends BaseEntity
      */
     private List<Map<String, Object>> containsHead;
 
+    /*
+     * 额外的参数
+     */
+    private String extraParam;
+
+    public String getExtraParam() {
+        return extraParam;
+    }
+
+    public void setExtraParam(String extraParam) {
+        this.extraParam = extraParam;
+    }
+
     public List<Map<String, Object>> getContainsHead() {
         return containsHead;
     }

+ 13 - 1
boman-modules/boman-system/src/main/java/com/boman/system/domain/vo/RouterVo.java

@@ -8,7 +8,6 @@ import java.util.List;
  * 
  * @author ruoyi
  */
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
 public class RouterVo
 {
     /**
@@ -56,6 +55,19 @@ public class RouterVo
      */
     private List<RouterVo> children;
 
+    /*
+     * 额外的参数
+     */
+    private String extraParam;
+
+    public String getExtraParam() {
+        return extraParam;
+    }
+
+    public void setExtraParam(String extraParam) {
+        this.extraParam = extraParam;
+    }
+
     public String getSysTableName() {
         return sysTableName;
     }

+ 13 - 1
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysMenuServiceImpl.java

@@ -204,7 +204,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
             router.setName(getRouteName(menu));
             router.setPath(getRouterPath(menu));
             router.setComponent(getComponent(menu));
-            router.setExtraParam("{\"username\": \"张三\"}");
+            router.setExtraParam(getExtraParam(menu));
             router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
             if (menu.getSysTableName() != null) {
                 router.setSysTableName(menu.getSysTableName());
@@ -221,6 +221,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
                 children.setComponent(menu.getComponent());
                 children.setName(StringUtils.capitalize(menu.getPath()));
                 children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache())));
+                children.setExtraParam(getExtraParam(menu));
                 if (menu.getSysTableName() != null) {
                     children.setSysTableName(menu.getSysTableName());
                 }
@@ -436,6 +437,17 @@ public class SysMenuServiceImpl implements ISysMenuService {
         return routerName;
     }
 
+
+    /**
+     * 获取路由名称
+     *
+     * @param menu 菜单信息
+     * @return 路由名称
+     */
+    public String getExtraParam(SysMenu menu) {
+        return menu.getExtraParam();
+    }
+
     /**
      * 获取路由地址
      *

+ 13 - 4
boman-modules/boman-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -25,10 +25,13 @@
 		<result property="updateBy"       column="update_by"      />
 		<result property="remark"         column="remark"         />
 		<result property="sysTableName"   column="sys_table_name" />
+		<result property="extraParam"   column="extra_param" />
 	</resultMap>
 
 	<sql id="selectMenuVo">
-        select id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time, create_by, update_by, update_time, remark, sys_table_name
+        select id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible
+             , status, ifnull(perms,'') as perms, icon, create_time, create_by, update_by, update_time, remark
+             , sys_table_name, extra_param
 		from sys_menu
     </sql>
     
@@ -58,7 +61,10 @@
 	</select>
 	
 	<select id="selectMenuTreeAll" resultMap="SysMenuResult">
-		select distinct m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.create_by, m.update_by, m.update_time, m.remark, m.sys_table_name
+		select distinct m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status
+		              , ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon
+		              , m.order_num, m.create_time, m.create_by, m.update_by, m.update_time
+		              , m.remark, m.sys_table_name, m.extra_param
 		from sys_menu m where m.menu_type in ('M', 'C') and m.status = '0'
 		order by m.parent_id, m.order_num
 	</select>
@@ -85,7 +91,7 @@
     <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
 		select distinct m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms
 		              , m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.create_by, m.update_by
-		              , m.update_time, m.remark, m.sys_table_name
+		              , m.update_time, m.remark, m.sys_table_name, m.extra_param
 		from sys_menu m
 			 left join sys_role_menu rm on m.id = rm.menu_id
 			 left join sys_user_role ur on rm.role_id = ur.role_id
@@ -95,7 +101,7 @@
 	    union
 		select distinct m.id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms
 					  , m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.create_by, m.update_by
-					  , m.update_time, m.remark, m.sys_table_name
+					  , m.update_time, m.remark, m.sys_table_name, m.extra_param
 		from sys_menu m
 				 left join sys_role_menu rm on m.id = rm.menu_id
 				 left join sys_user_role ur on rm.role_id = ur.role_id
@@ -202,6 +208,7 @@
 			<if test="remark != null and remark != ''">remark = #{remark},</if>
 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
 			<if test="sysTableName != null and sysTableName != ''">sys_table_name = #{sysTableName},</if>
+			<if test="extraParam != null and extraParam != ''">extra_param = #{extraParam},</if>
 			update_time = sysdate()
 		</set>
 		where id = #{id}
@@ -226,6 +233,7 @@
 		<if test="updateBy != null and updateBy != ''">update_by,</if>
 		<if test="updateTime != null and updateTime != ''">update_time,</if>
 		<if test="sysTableName != null and sysTableName != ''">sys_table_name,</if>
+		<if test="extraParam != null and extraParam != ''">extra_param,</if>
 		create_time
 		)values(
 		<if test="parentId != null and parentId != 0">#{parentId},</if>
@@ -245,6 +253,7 @@
 		<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
 		<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
 		<if test="sysTableName != null and sysTableName != ''">#{sysTableName},</if>
+		<if test="extraParam != null and extraParam != ''">#{extraParam},</if>
 		sysdate()
 		)
 	</insert>