漫游功能开发
parent
1003b4ea23
commit
7a90768240
|
@ -1,5 +1,7 @@
|
||||||
package com.yanzhu.manage.hasor;
|
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.ApiBinder;
|
||||||
import net.hasor.core.DimModule;
|
import net.hasor.core.DimModule;
|
||||||
import net.hasor.dataql.DataQL;
|
import net.hasor.dataql.DataQL;
|
||||||
|
@ -33,13 +35,16 @@ public class HasorModule implements SpringModule {
|
||||||
public void loadModule(ApiBinder apiBinder) throws Throwable {
|
public void loadModule(ApiBinder apiBinder) throws Throwable {
|
||||||
// .DataSource form Spring boot into Hasor
|
// .DataSource form Spring boot into Hasor
|
||||||
apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource));
|
apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource));
|
||||||
|
|
||||||
InterfaceApiFilter f;
|
InterfaceApiFilter f;
|
||||||
apiBinder.bindSpiListener(PreExecuteChainSpi.class, (apiInfo, future) -> {
|
apiBinder.bindSpiListener(PreExecuteChainSpi.class, (apiInfo, future) -> {
|
||||||
try{
|
try{
|
||||||
Method method = apiInfo.getClass().getMethod("getObj");
|
|
||||||
Map<FieldDef, String> obj=(Map<FieldDef, String>)method.invoke(apiInfo);
|
SysUser user = SecurityUtils.getLoginUser().getSysUser();
|
||||||
Object a=obj;
|
if(user!=null) {
|
||||||
|
apiInfo.getParameterMap().put("currentUser", user.getUserName() + " " + user.getPhonenumber());
|
||||||
|
}else{
|
||||||
|
apiInfo.getParameterMap().put("currentUser", "system");
|
||||||
|
}
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +60,7 @@ public class HasorModule implements SpringModule {
|
||||||
apiBinder.bindSpiListener(CompilerSpiListener.class, new CompilerSpiListener() {
|
apiBinder.bindSpiListener(CompilerSpiListener.class, new CompilerSpiListener() {
|
||||||
@Override
|
@Override
|
||||||
public QIL compiler(ApiInfo apiInfo, String query, DataQL dataQL) throws IOException {
|
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);
|
return CompilerSpiListener.super.compiler(apiInfo, query, dataQL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue