Skip to content

Commit

Permalink
upgrade(version): 0.0.3 适配 nacos 2.3.2
Browse files Browse the repository at this point in the history
注意更新SQL , users 表字段不兼容
  • Loading branch information
lltx committed Aug 25, 2024
1 parent 6a8be6f commit e196290
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public MapperResult findConfigInfoAggrByPageFetchRows(MapperContext context) {
String tenantId = (String) context.getWhereParameter(FieldConstant.TENANT_ID);

String 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 " + pageSize + " offset "
+ startRow;
+ "group_id= ? AND tenant_id= ? ORDER BY datum_id LIMIT " + pageSize + " offset " + startRow;
List<Object> paramList = CollectionUtils.list(dataId, groupId, tenantId);
return new MapperResult(sql, paramList);
}
Expand All @@ -31,5 +30,4 @@ public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public MapperResult findAllConfigInfoBetaForDumpAllFetchRows(MapperContext conte
int startRow = context.getStartRow();
int pageSize = context.getPageSize();
String 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 " + pageSize + " offset "
+ startRow + " )" + " g, config_info_beta t WHERE g.id = t.id ";
+ " FROM ( SELECT id FROM config_info_beta ORDER BY id LIMIT " + pageSize + " offset " + startRow
+ " )" + " g, config_info_beta t WHERE g.id = t.id ";
List<Object> paramList = new ArrayList<>();
paramList.add(startRow);
paramList.add(pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,22 @@ public MapperResult findConfigInfoByAppFetchRows(MapperContext context) {
@Override
public MapperResult getTenantIdList(MapperContext context) {
String sql = "SELECT tenant_id FROM config_info WHERE tenant_id != '" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow();
+ "' GROUP BY tenant_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
return new MapperResult(sql, Collections.emptyList());
}

@Override
public MapperResult getGroupIdList(MapperContext context) {
String sql = "SELECT group_id FROM config_info WHERE tenant_id ='" + NamespaceUtil.getNamespaceDefaultId()
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow();
+ "' GROUP BY group_id LIMIT " + context.getPageSize() + " offset " + context.getStartRow();
return new MapperResult(sql, Collections.emptyList());
}

@Override
public MapperResult findAllConfigKey(MapperContext context) {
String sql = " SELECT data_id,group_id,app_name FROM ( "
+ " SELECT id FROM config_info WHERE tenant_id LIKE ? ORDER BY id LIMIT " + context.getPageSize()
+ " offset " + context.getStartRow() + " )"
+ " g, config_info t WHERE g.id = t.id ";
+ " offset " + context.getStartRow() + " )" + " g, config_info t WHERE g.id = t.id ";
return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.TENANT_ID)));
}

Expand Down Expand Up @@ -147,8 +144,9 @@ public MapperResult findConfigInfoBaseLikeFetchRows(MapperContext context) {
where += " AND content LIKE ? ";
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand Down Expand Up @@ -181,8 +179,8 @@ public MapperResult findConfigInfo4PageFetchRows(MapperContext context) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(sql + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand Down Expand Up @@ -225,8 +223,9 @@ public MapperResult findConfigInfoLike4PageFetchRows(MapperContext context) {
where.append(" AND content LIKE ? ");
paramList.add(content);
}
return new MapperResult(sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset "
+ context.getStartRow(), paramList);
return new MapperResult(
sqlFetchRows + where + " LIMIT " + context.getPageSize() + " offset " + context.getStartRow(),
paramList);
}

@Override
Expand All @@ -243,6 +242,4 @@ public String getDataSource() {
return DataSourceConstant.POSTGRESQL;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import com.alibaba.nacos.plugin.datasource.mapper.TenantInfoMapper;
import com.pig4cloud.plugin.constants.DataSourceConstant;

public class TenantInfoMapperByPostgresql extends com.pig4cloud.plugin.impl.postgresql.PostgresqlAbstractMapper implements TenantInfoMapper {
public class TenantInfoMapperByPostgresql extends com.pig4cloud.plugin.impl.postgresql.PostgresqlAbstractMapper
implements TenantInfoMapper {

@Override
public String getDataSource() {
Expand Down

0 comments on commit e196290

Please sign in to comment.