mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-01-18 19:42:49 +08:00
升级magic-api最新版,读取菜单分layout和notLayout
This commit is contained in:
parent
326d3caa10
commit
c21e31fd33
@ -5,7 +5,7 @@
|
||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1646552467748,
|
||||
"updateTime" : 1681528279822,
|
||||
"lock" : "0",
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -116,8 +116,8 @@
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
}
|
||||
================================
|
||||
return db.page("""
|
||||
select
|
||||
distinct
|
||||
@ -128,6 +128,7 @@ return db.page("""
|
||||
su.phone,
|
||||
su.create_date,
|
||||
su.office_id,
|
||||
su.head_portrait,
|
||||
so.name office_name,
|
||||
(select group_concat(sr.name) from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sr.is_del = 0 and sur.user_id = su.id) roles
|
||||
from sys_user su
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,203 +0,0 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "2da55da9c28c441ebfdef412e7004cd0",
|
||||
"script" : null,
|
||||
"groupId" : "67b2ce258e24491194b74992958c74aa",
|
||||
"name" : "当前用户隐藏菜单路由",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1660381679813,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : "guyi",
|
||||
"path" : "/current/hidden/menus",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [{\n \"componentName\": \"\",\n \"name\": \"创建售后单\",\n \"path\": \"order/aftersales/after-sales\",\n \"subCount\": 0,\n \"keepAlive\": 1,\n \"openMode\": \"0\"\n }],\n \"timestamp\": 1660381448247,\n \"executeTime\": 41\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "200",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "success",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "componentName",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "name",
|
||||
"value" : "创建售后单",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "path",
|
||||
"value" : "order/aftersales/after-sales",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "subCount",
|
||||
"value" : "0",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "keepAlive",
|
||||
"value" : "1",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "openMode",
|
||||
"value" : "0",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1660381448247",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "41",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
import cn.dev33.satoken.stp.StpUtil
|
||||
|
||||
var userId = StpUtil.getLoginId()
|
||||
return db.select("""
|
||||
select * from (
|
||||
select
|
||||
component_name,
|
||||
name,
|
||||
url as path,
|
||||
(select count(1) from sys_menu where is_del = 0 and pid = sm.id) sub_count,
|
||||
sm.keep_alive
|
||||
from sys_menu sm
|
||||
where ((component_name is not null and component_name != '') or (url is not null and url != ''))
|
||||
and is_show = 0 and is_del = 0
|
||||
?{userId != '1',
|
||||
and sm.id in (
|
||||
select menu_id from sys_role_menu where role_id in (
|
||||
select role_id from sys_user_role where user_id = #{userId}
|
||||
)
|
||||
)
|
||||
}
|
||||
) sm where sub_count = 0
|
||||
""")
|
@ -14,7 +14,7 @@
|
||||
<description>magic-boot</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<magic-api.version>2.0.2</magic-api.version>
|
||||
<magic-api.version>2.1.1</magic-api.version>
|
||||
<druid.version>1.1.10</druid.version>
|
||||
<hutool-all.version>5.7.22</hutool-all.version>
|
||||
<sa-token.version>1.26.0</sa-token.version>
|
||||
|
@ -5,6 +5,7 @@ import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.ssssssss.magicapi.core.context.RequestContext;
|
||||
import org.ssssssss.magicapi.core.servlet.MagicHttpServletRequest;
|
||||
import org.ssssssss.magicapi.modules.servlet.ResponseModule;
|
||||
import org.ssssssss.script.annotation.Comment;
|
||||
import org.ssssssss.script.functions.ExtensionMethod;
|
||||
@ -32,7 +33,8 @@ public class ResponseFunctionExtension implements ExtensionMethod {
|
||||
|
||||
@Comment("转发")
|
||||
public ResponseModule.NullValue dispatcher(ResponseModule responseModule, String url) throws ServletException, IOException {
|
||||
HttpServletRequest request = RequestContext.getHttpServletRequest();
|
||||
MagicHttpServletRequest magicHttpServletRequest = RequestContext.getHttpServletRequest();
|
||||
HttpServletRequest request = magicHttpServletRequest.getRequest();
|
||||
request.getRequestDispatcher(url).forward(request, getResponse());
|
||||
return responseModule.end();
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ import org.ssssssss.magicapi.core.model.ApiInfo;
|
||||
import org.ssssssss.magicapi.core.model.Options;
|
||||
import org.ssssssss.magicapi.core.service.MagicAPIService;
|
||||
import org.ssssssss.magicapi.core.service.MagicResourceService;
|
||||
import org.ssssssss.magicapi.core.servlet.MagicHttpServletRequest;
|
||||
import org.ssssssss.magicapi.core.servlet.MagicHttpServletResponse;
|
||||
import org.ssssssss.magicapi.utils.PathUtils;
|
||||
import org.ssssssss.magicboot.model.StatusCode;
|
||||
import org.ssssssss.script.MagicScriptContext;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -42,7 +43,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
|
||||
* 当返回对象时,直接将此对象返回到页面,返回null时,继续执行后续操作
|
||||
*/
|
||||
@Override
|
||||
public Object preHandle(ApiInfo info, MagicScriptContext context, HttpServletRequest request, HttpServletResponse response) {
|
||||
public Object preHandle(ApiInfo info, MagicScriptContext context, MagicHttpServletRequest request, MagicHttpServletResponse response) {
|
||||
String requireLogin = Objects.toString(info.getOptionValue(Options.REQUIRE_LOGIN), "");
|
||||
if(requireLogin.equals("false")){
|
||||
return null;
|
||||
@ -64,7 +65,7 @@ public class PermissionInterceptor implements RequestInterceptor, HandlerInterce
|
||||
public Object postHandle(RequestEntity requestEntity, Object returnValue) throws Exception {
|
||||
if(StpUtil.isLogin()){
|
||||
try {
|
||||
HttpServletRequest request = requestEntity.getRequest();
|
||||
HttpServletRequest request = requestEntity.getRequest().getRequest();
|
||||
ApiInfo info = requestEntity.getApiInfo();
|
||||
template.update("insert into sys_oper_log(api_name, api_path, api_method, cost_time, create_by, create_date, user_agent, user_ip) values(?,?,?,?,?,?,?,?)",
|
||||
// PathUtils.replaceSlash(groupServiceProvider.getFullName(info.getGroupId()) + "/" + info.getName()).replace("/","-"),
|
||||
|
Loading…
Reference in New Issue
Block a user