use of com.github.pagehelper.PageHelper in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
use of com.github.pagehelper.PageHelper in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
use of com.github.pagehelper.PageHelper in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
use of com.github.pagehelper.PageHelper in project jim-framework by jiangmin168168.
the class MyBatisConfig method sqlSessionFactoryBean.
@Bean(name = "sqlSessionFactory")
public SqlSessionFactory sqlSessionFactoryBean() {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage("com.jim.dao.generated.entity");
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("dialect", "postgresql");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
use of com.github.pagehelper.PageHelper in project new-cloud by xie-summer.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(MybatisConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
pageHelper.setProperties(properties);
/**
*abel533通用mapper
*/
// MapperInterceptor mapperInterceptor = new MapperInterceptor();
// Properties props = new Properties();
// /**--主键自增回写方法,默认值MYSQL,详细说明请看文档 -->*/
// props.setProperty("IDENTITY","MYSQL");
// /**<!--通用Mapper接口,多个通用接口用逗号隔开 -->*/
// props.setProperty("mappers", "com.github.abel533.mapper.IMapper");
// mapperInterceptor.setProperties(props);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// bean.setPlugins(new Interceptor[]{mapperInterceptor});
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/**.xml"));
return bean.getObject();
}
Aggregations