提交 92a45904 编写于 作者: zhouweidong's avatar zhouweidong

支持表格不分页

上级 213321de
...@@ -23,6 +23,7 @@ import org.mybatis.spring.annotation.MapperScan; ...@@ -23,6 +23,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
...@@ -55,6 +56,9 @@ import java.util.List; ...@@ -55,6 +56,9 @@ import java.util.List;
}) })
public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{ public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(${app.getPKGCodeName()}Application.class,args); SpringApplication.run(${app.getPKGCodeName()}Application.class,args);
} }
...@@ -62,6 +66,6 @@ public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{ ...@@ -62,6 +66,6 @@ public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{
@Override @Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers); super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver()); argumentResolvers.add(resolver);
} }
} }
...@@ -24,6 +24,7 @@ import org.springframework.context.annotation.ComponentScan; ...@@ -24,6 +24,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import java.util.List; import java.util.List;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
@Slf4j @Slf4j
@EnableDiscoveryClient @EnableDiscoveryClient
...@@ -59,6 +60,9 @@ import java.util.List; ...@@ -59,6 +60,9 @@ import java.util.List;
@EnableScheduling @EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter{ public class DevBootApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class,args); SpringApplication.run(DevBootApplication.class,args);
} }
...@@ -66,6 +70,6 @@ public class DevBootApplication extends WebMvcConfigurerAdapter{ ...@@ -66,6 +70,6 @@ public class DevBootApplication extends WebMvcConfigurerAdapter{
@Override @Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers); super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver()); argumentResolvers.add(resolver);
} }
} }
...@@ -25,6 +25,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter ...@@ -25,6 +25,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
...@@ -64,6 +65,9 @@ import java.util.List; ...@@ -64,6 +65,9 @@ import java.util.List;
@EnableScheduling @EnableScheduling
public class ${sys.codeName}${item.codeName}Application extends WebMvcConfigurerAdapter{ public class ${sys.codeName}${item.codeName}Application extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(${sys.codeName}${item.codeName}Application.class, args); SpringApplication.run(${sys.codeName}${item.codeName}Application.class, args);
} }
...@@ -71,6 +75,6 @@ public class ${sys.codeName}${item.codeName}Application extends WebMvcConfigurer ...@@ -71,6 +75,6 @@ public class ${sys.codeName}${item.codeName}Application extends WebMvcConfigurer
@Override @Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers); super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver()); argumentResolvers.add(resolver);
} }
} }
...@@ -13,10 +13,16 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; ...@@ -13,10 +13,16 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer; import org.springframework.web.method.support.ModelAndViewContainer;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Slf4j @Slf4j
@Configuration
public class SearchContextHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { public class SearchContextHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Value("${r'${ibiz.pageLimit:1000}'}")
private int pageLimit=1000;
private static ObjectMapper objectMapper=new ObjectMapper(); private static ObjectMapper objectMapper=new ObjectMapper();
@Override @Override
...@@ -32,6 +38,9 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod ...@@ -32,6 +38,9 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
for (String key : params.keySet()) { for (String key : params.keySet()) {
set.put(key,params.get(key)[0]); set.put(key,params.get(key)[0]);
} }
if((!set.containsKey("size")) ){
set.put("size",pageLimit);
}
String json=objectMapper.writeValueAsString(set); String json=objectMapper.writeValueAsString(set);
return objectMapper.readValue(json,parameter.getParameterType()); return objectMapper.readValue(json,parameter.getParameterType());
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册