diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/hasor/HasorModule.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/hasor/HasorModule.java index 48b35011..1459ff91 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/hasor/HasorModule.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/hasor/HasorModule.java @@ -1,5 +1,7 @@ package com.yanzhu.manage.hasor; +import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.system.api.domain.SysUser; import net.hasor.core.ApiBinder; import net.hasor.core.DimModule; import net.hasor.dataql.DataQL; @@ -33,13 +35,16 @@ public class HasorModule implements SpringModule { public void loadModule(ApiBinder apiBinder) throws Throwable { // .DataSource form Spring boot into Hasor apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource)); - InterfaceApiFilter f; apiBinder.bindSpiListener(PreExecuteChainSpi.class, (apiInfo, future) -> { try{ - Method method = apiInfo.getClass().getMethod("getObj"); - Map obj=(Map)method.invoke(apiInfo); - Object a=obj; + + SysUser user = SecurityUtils.getLoginUser().getSysUser(); + if(user!=null) { + apiInfo.getParameterMap().put("currentUser", user.getUserName() + " " + user.getPhonenumber()); + }else{ + apiInfo.getParameterMap().put("currentUser", "system"); + } }catch (Exception ex){ } @@ -55,7 +60,7 @@ public class HasorModule implements SpringModule { apiBinder.bindSpiListener(CompilerSpiListener.class, new CompilerSpiListener() { @Override public QIL compiler(ApiInfo apiInfo, String query, DataQL dataQL) throws IOException { - query = "hint FRAGMENT_SQL_COLUMN_CASE=\"hump\"\n hint FRAGMENT_SQL_QUERY_BY_PAGE_NUMBER_OFFSET = 1 \n" + query; + query = "hint FRAGMENT_SQL_COLUMN_CASE=\"hump\"\n hint FRAGMENT_SQL_QUERY_BY_PAGE_NUMBER_OFFSET = 1 \n hint FRAGMENT_SQL_OPEN_PACKAGE = 'off' \n" + query; return CompilerSpiListener.super.compiler(apiInfo, query, dataQL); } });