diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java index c8eca2e82..18306c693 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/embedded/EmbeddedStoragePersistServiceImpl.java @@ -1427,9 +1427,8 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService { String sqlCountRows = configInfoBetaMapper.count(null); String sqlFetchRows = configInfoBetaMapper.findAllConfigInfoBetaForDumpAllFetchRows(startRow, pageSize); PaginationHelper helper = createPaginationHelper(); - return helper - .fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, pageNo, - pageSize, CONFIG_INFO_BETA_WRAPPER_ROW_MAPPER); + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {}, pageNo, pageSize, + CONFIG_INFO_BETA_WRAPPER_ROW_MAPPER); } @@ -1441,9 +1440,8 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService { String sqlFetchRows = configInfoTagMapper.findAllConfigInfoTagForDumpAllFetchRows(startRow, pageSize); PaginationHelper helper = createPaginationHelper(); - return helper - .fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, pageNo, - pageSize, CONFIG_INFO_TAG_WRAPPER_ROW_MAPPER); + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {}, pageNo, pageSize, + CONFIG_INFO_TAG_WRAPPER_ROW_MAPPER); } @@ -1743,9 +1741,7 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService { PaginationHelper helper = createPaginationHelper(); return helper.fetchPageLimit(sqlCountRows, new Object[] {dataId, group, tenantTmp}, sqlFetchRows, - new Object[] {dataId, group, tenantTmp, (pageNo - 1) * pageSize, pageSize}, pageNo, pageSize, - CONFIG_INFO_AGGR_ROW_MAPPER); - + new Object[] {dataId, group, tenantTmp}, pageNo, pageSize, CONFIG_INFO_AGGR_ROW_MAPPER); } @Override diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java index 6ec131716..eb2ad1353 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/repository/extrnal/ExternalStoragePersistServiceImpl.java @@ -1400,8 +1400,8 @@ public class ExternalStoragePersistServiceImpl implements PersistService { configInfoBetaMapper.findAllConfigInfoBetaForDumpAllFetchRows(startRow, pageSize); PaginationHelper helper = createPaginationHelper(); try { - return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, - pageNo, pageSize, CONFIG_INFO_BETA_WRAPPER_ROW_MAPPER); + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {}, pageNo, pageSize, + CONFIG_INFO_BETA_WRAPPER_ROW_MAPPER); } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); @@ -1417,8 +1417,8 @@ public class ExternalStoragePersistServiceImpl implements PersistService { String sqlFetchRows = configInfoTagMapper.findAllConfigInfoTagForDumpAllFetchRows(startRow, pageSize); PaginationHelper helper = createPaginationHelper(); try { - return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {(pageNo - 1) * pageSize, pageSize}, - pageNo, pageSize, CONFIG_INFO_TAG_WRAPPER_ROW_MAPPER); + return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] {}, pageNo, pageSize, + CONFIG_INFO_TAG_WRAPPER_ROW_MAPPER); } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); @@ -1760,8 +1760,7 @@ public class ExternalStoragePersistServiceImpl implements PersistService { PaginationHelper helper = createPaginationHelper(); try { return helper.fetchPageLimit(sqlCountRows, new Object[] {dataId, group, tenantTmp}, sqlFetchRows, - new Object[] {dataId, group, tenantTmp, (pageNo - 1) * pageSize, pageSize}, pageNo, pageSize, - CONFIG_INFO_AGGR_ROW_MAPPER); + new Object[] {dataId, group, tenantTmp}, pageNo, pageSize, CONFIG_INFO_AGGR_ROW_MAPPER); } catch (CannotGetJdbcConnectionException e) { LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e); diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoAggrMapperByDerby.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoAggrMapperByDerby.java index af5d3e82d..492a70e26 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoAggrMapperByDerby.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoAggrMapperByDerby.java @@ -39,7 +39,7 @@ public class ConfigInfoAggrMapperByDerby extends AbstractMapper implements Confi } datumString.deleteCharAt(datumString.length() - 1); return "DELETE FROM config_info_aggr WHERE data_id = ? AND group_id = ? AND tenant_id = ? AND datum_id IN (" - + datumString.toString() + ")"; + + datumString + ")"; } @Override @@ -71,7 +71,8 @@ public class ConfigInfoAggrMapperByDerby extends AbstractMapper implements Confi @Override public String findConfigInfoAggrByPageFetchRows(int startRow, int pageSize) { return "SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id=? AND " - + "group_id=? AND tenant_id=? ORDER BY datum_id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "group_id=? AND tenant_id=? ORDER BY datum_id OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + + " ROWS ONLY"; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoBetaMapperByDerby.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoBetaMapperByDerby.java index f845b7f57..d9f95ce05 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoBetaMapperByDerby.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoBetaMapperByDerby.java @@ -38,8 +38,8 @@ public class ConfigInfoBetaMapperByDerby extends AbstractMapper implements Confi @Override public String findAllConfigInfoBetaForDumpAllFetchRows(int startRow, int pageSize) { return " SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,beta_ips " - + " FROM ( SELECT id FROM config_info_beta ORDER BY id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY )" - + " g, config_info_beta t WHERE g.id = t.id "; + + " FROM ( SELECT id FROM config_info_beta ORDER BY id OFFSET " + startRow + " ROWS FETCH NEXT " + + pageSize + " ROWS ONLY )" + " g, config_info_beta t WHERE g.id = t.id "; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagMapperByDerby.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagMapperByDerby.java index c3a5dcb87..6862dbc4d 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagMapperByDerby.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagMapperByDerby.java @@ -38,8 +38,8 @@ public class ConfigInfoTagMapperByDerby extends AbstractMapper implements Config @Override public String findAllConfigInfoTagForDumpAllFetchRows(int startRow, int pageSize) { return " SELECT t.id,data_id,group_id,tenant_id,tag_id,app_name,content,md5,gmt_modified " - + " FROM ( SELECT id FROM config_info_tag ORDER BY id OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ) " - + " g, config_info_tag t WHERE g.id = t.id "; + + " FROM ( SELECT id FROM config_info_tag ORDER BY id OFFSET " + startRow + " ROWS FETCH NEXT " + + pageSize + " ROWS ONLY ) " + " g, config_info_tag t WHERE g.id = t.id "; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagsRelationMapperByDerby.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagsRelationMapperByDerby.java index 9562e4042..c2bf91674 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagsRelationMapperByDerby.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/derby/ConfigInfoTagsRelationMapperByDerby.java @@ -92,7 +92,7 @@ public class ConfigInfoTagsRelationMapperByDerby extends AbstractMapper implemen if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; + return sql + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } @Override @@ -196,7 +196,7 @@ public class ConfigInfoTagsRelationMapperByDerby extends AbstractMapper implemen if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; + return sql + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } @Override @@ -307,7 +307,7 @@ public class ConfigInfoTagsRelationMapperByDerby extends AbstractMapper implemen if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; + return sql + " OFFSET " + startRow + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoAggrMapperByMySql.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoAggrMapperByMySql.java index 70af5d8cc..e61af4380 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoAggrMapperByMySql.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoAggrMapperByMySql.java @@ -39,7 +39,7 @@ public class ConfigInfoAggrMapperByMySql extends AbstractMapper implements Confi } datumString.deleteCharAt(datumString.length() - 1); return "DELETE FROM config_info_aggr WHERE data_id = ? AND group_id = ? AND tenant_id = ? AND datum_id IN (" - + datumString.toString() + ")"; + + datumString + ")"; } @Override @@ -71,7 +71,7 @@ public class ConfigInfoAggrMapperByMySql extends AbstractMapper implements Confi @Override public String findConfigInfoAggrByPageFetchRows(int startRow, int pageSize) { return "SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id= ? AND " - + "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT ?,?"; + + "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + startRow + "," + pageSize; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoTagMapperByMySql.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoTagMapperByMySql.java index 59a58f254..efe929e90 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoTagMapperByMySql.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigInfoTagMapperByMySql.java @@ -38,7 +38,7 @@ public class ConfigInfoTagMapperByMySql extends AbstractMapper implements Config @Override public String findAllConfigInfoTagForDumpAllFetchRows(int startRow, int pageSize) { return " SELECT t.id,data_id,group_id,tenant_id,tag_id,app_name,content,md5,gmt_modified " - + " FROM ( SELECT id FROM config_info_tag ORDER BY id LIMIT ?,? ) " + + " FROM ( SELECT id FROM config_info_tag ORDER BY id LIMIT " + startRow + "," + pageSize + " ) " + "g, config_info_tag t WHERE g.id = t.id "; } diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigTagsRelationMapperByMySql.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigTagsRelationMapperByMySql.java index b87da28fd..813f78881 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigTagsRelationMapperByMySql.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/impl/mysql/ConfigTagsRelationMapperByMySql.java @@ -88,7 +88,7 @@ public class ConfigTagsRelationMapperByMySql extends AbstractMapper implements C if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " LIMIT " + startRow + "," + pageSize; + return sql + " LIMIT " + startRow + "," + pageSize; } @Override @@ -189,7 +189,7 @@ public class ConfigTagsRelationMapperByMySql extends AbstractMapper implements C if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " LIMIT " + startRow + "," + pageSize; + return sql + " LIMIT " + startRow + "," + pageSize; } @Override @@ -299,7 +299,7 @@ public class ConfigTagsRelationMapperByMySql extends AbstractMapper implements C if (StringUtils.isNotBlank(appName)) { sql.append(" AND a.app_name=? "); } - return sql.toString() + " LIMIT " + startRow + "," + pageSize; + return sql + " LIMIT " + startRow + "," + pageSize; } @Override diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoAggrMapper.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoAggrMapper.java index bdb279e8c..500cbaed2 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoAggrMapper.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoAggrMapper.java @@ -61,7 +61,7 @@ public interface ConfigInfoAggrMapper extends Mapper { * Query aggregation config info. * The default sql: * SELECT data_id,group_id,tenant_id,datum_id,app_name,content FROM config_info_aggr WHERE data_id=? AND - * group_id=? AND tenant_id=? ORDER BY datum_id LIMIT ?,? + * group_id=? AND tenant_id=? ORDER BY datum_id LIMIT startRow,pageSize * * @param startRow The start index. * @param pageSize The size of page. diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoBetaMapper.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoBetaMapper.java index 13df2fa50..ce55f56ac 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoBetaMapper.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoBetaMapper.java @@ -37,7 +37,7 @@ public interface ConfigInfoBetaMapper extends Mapper { * Query all beta config info for dump task. * The default sql: * SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5,gmt_modified,beta_ips,encrypted_data_key - * FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT ?,? ) g, config_info_beta t WHERE g.id = t.id + * FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT startRow,pageSize ) g, config_info_beta t WHERE g.id = t.id * * @param startRow The start index. * @param pageSize The size of page. diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoTagMapper.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoTagMapper.java index 6f2309659..76a1a9355 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoTagMapper.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/ConfigInfoTagMapper.java @@ -38,7 +38,7 @@ public interface ConfigInfoTagMapper extends Mapper { * Query all tag config info for dump task. * The default sql: * SELECT t.id,data_id,group_id,tenant_id,tag_id,app_name,content,md5,gmt_modified - * FROM ( SELECT id FROM config_info_tag ORDER BY id LIMIT ?,? ) g, + * FROM ( SELECT id FROM config_info_tag ORDER BY id LIMIT startRow,pageSize ) g, * config_info_tag t WHERE g.id = t.id * * @param startRow The start index.