漫游功能开发

dev_xd
haha 2025-05-31 13:29:44 +08:00
parent 1003b4ea23
commit 7a90768240
1 changed files with 10 additions and 5 deletions

View File

@ -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<FieldDef, String> obj=(Map<FieldDef, String>)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);
}
});