Browse Source

修改分页

rsbi 4 years ago
parent
commit
84a84236e6

+ 2 - 2
pom.xml

@@ -81,8 +81,8 @@
         <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
         <dependency>
             <groupId>com.github.pagehelper</groupId>
-            <artifactId>pagehelper</artifactId>
-            <version>5.0.1</version>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.12</version>
         </dependency>
         <!-- https://mvnrepository.com/artifact/net.sourceforge.jexcelapi/jxl -->
         <dependency>

+ 7 - 1
src/main/java/com/ruisitech/bi/entity/common/PageParam.java

@@ -6,7 +6,7 @@ public class PageParam {
 	 * 分页参数
 	 */
 	private Integer total;
-	private Integer page;
+	private Integer page;  //页数, 从1开始
 	private Integer rows;
 
 	//搜索
@@ -23,12 +23,18 @@ public class PageParam {
 	}
 	
 	public Integer getPage() {
+		if(page == null){
+			page = 1;
+		}
 		return page;
 	}
 	public void setPage(Integer page) {
 		this.page = page;
 	}
 	public Integer getRows() {
+		if(rows == null){
+			rows = 10;
+		}
 		return rows;
 	}
 	public void setRows(Integer rows) {

+ 0 - 30
src/main/java/com/ruisitech/bi/service/frame/SpringSessionConfig.java

@@ -1,30 +0,0 @@
-/*
- * Copyright 2018 本系统版权归成都睿思商智科技有限公司所有
- * 用户不能删除系统源码上的版权信息, 使用许可证地址:
- * https://www.ruisitech.com/licenses/index.html
- */
-package com.ruisitech.bi.service.frame;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.session.web.http.CookieSerializer;
-import org.springframework.session.web.http.DefaultCookieSerializer;
-
-/**
- * cookie跨域携带和samesite的问题处理
- * @Author huangqin
- * @Date 2020/12/9 8:26 下午
- */
-@Configuration
-public class SpringSessionConfig {
-
-    @Bean
-    public CookieSerializer httpSessionIdResolver() {
-        DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer();
-        cookieSerializer.setUseHttpOnlyCookie(false);
-        cookieSerializer.setSameSite("None");
-        cookieSerializer.setCookiePath("/");
-        cookieSerializer.setUseSecureCookie(true);
-        return cookieSerializer;
-    }
-}

+ 18 - 11
src/main/resources/application.yml

@@ -1,18 +1,25 @@
 #数据库连接 mysql
-#spring:
-#  datasource:
-#    url: jdbc:mysql://localhost:3306/rs_report?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
-#    username: root
-#    password: 12345678
-#    driver-class-name: com.mysql.cj.jdbc.Driver
 spring:
   datasource:
-    url: jdbc:sqlite::resource:rsreport.sqlite3
-    username:
-    password:
-    driver-class-name: org.sqlite.JDBC
+    url: jdbc:mysql://localhost:3306/rs_report?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
+    username: root
+    password: 12345678
+    driver-class-name: com.mysql.cj.jdbc.Driver
+#spring:
+#  datasource:
+#    url: jdbc:sqlite::resource:rsreport.sqlite3
+#    username:
+#    password:
+#    driver-class-name: org.sqlite.JDBC
 mybatis:
   #mapper配置文件
   mapper-locations: classpath:mybatis/*.xml
 #logging:
-#  config: classpath:log4j.properties
+#  config: classpath:log4j.properties
+
+pagehelper:
+  helperDialect: mysql
+  reasonable: false  #开启优化,如果开启优化,在分页页码结果没有数据的时候,会显示有数据的页码数据
+  supportMethodsArguments: true #是否支持接口参数来传递分页参数,默认false
+  pageSizeZero: true #pageSize=0 返回所有
+  params: count=countSql

+ 1 - 1
src/main/webapp/WEB-INF/ext2/ext-config/ext-config.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ext-config>
 	<constant name="devMode" value="true" />
-	<constant name="dbName" value="sqlite" />
+	<constant name="dbName" value="mysql" />
 	<!-- 关闭在多维分析中显示节日 -->
 	<constant name="closeFestival" value="true" />