mirror of
https://gitee.com/ssssssss-team/magic-api.git
synced 2026-06-09 18:32:16 +08:00
兼容1.2.0版本
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.http.ResponseEntity;
|
||||
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.context.RequestContext;
|
||||
import org.ssssssss.magicapi.provider.ResultProvider;
|
||||
import org.ssssssss.script.annotation.Comment;
|
||||
import org.ssssssss.script.functions.ObjectConvertExtension;
|
||||
@@ -50,7 +51,7 @@ public class ResponseModule {
|
||||
*/
|
||||
@Comment("返回自定义分页结果")
|
||||
public Object page(@Comment("总条数") long total, @Comment("当前结果集") List<Map<String, Object>> values) {
|
||||
return resultProvider.buildPageResult(total, values);
|
||||
return resultProvider.buildPageResult(RequestContext.getRequestEntity(),null, total, values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -281,7 +281,7 @@ public class SQLModule extends HashMap<String, SQLModule> implements MagicModule
|
||||
|
||||
@UnableCall
|
||||
public int update(BoundSql boundSql) {
|
||||
sqlInterceptors.forEach(sqlInterceptor -> sqlInterceptor.preHandle(boundSql));
|
||||
sqlInterceptors.forEach(sqlInterceptor -> sqlInterceptor.preHandle(boundSql, RequestContext.getRequestEntity()));
|
||||
int value = dataSourceNode.getJdbcTemplate().update(boundSql.getSql(), boundSql.getParameters());
|
||||
if (this.cacheName != null) {
|
||||
this.sqlCache.delete(this.cacheName);
|
||||
@@ -308,7 +308,7 @@ public class SQLModule extends HashMap<String, SQLModule> implements MagicModule
|
||||
}
|
||||
|
||||
void insert(BoundSql boundSql, MagicKeyHolder keyHolder) {
|
||||
sqlInterceptors.forEach(sqlInterceptor -> sqlInterceptor.preHandle(boundSql));
|
||||
sqlInterceptors.forEach(sqlInterceptor -> sqlInterceptor.preHandle(boundSql, RequestContext.getRequestEntity()));
|
||||
dataSourceNode.getJdbcTemplate().update(con -> {
|
||||
PreparedStatement ps = keyHolder.createPrepareStatement(con, boundSql.getSql());
|
||||
new ArgumentPreparedStatementSetter(boundSql.getParameters()).setValues(ps);
|
||||
|
||||
Reference in New Issue
Block a user