Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #12625] FIX tenant_capacity query SQL dialect #12628

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public TenantCapacity getTenantCapacity(String tenantId) {
TenantCapacityMapper tenantCapacityMapper = mapperManager.findMapper(dataSourceService.getDataSourceType(),
TableConstant.TENANT_CAPACITY);
String sql = tenantCapacityMapper.select(
Arrays.asList("id", "quota", "`usage`", "`max_size`", "max_aggr_count", "max_aggr_size", "tenant_id"),
Collections.singletonList("tenant_id"));
Arrays.asList("id", "quota", "usage", "max_size",
"max_aggr_count", "max_aggr_size", "tenant_id"), Collections.singletonList("tenant_id"));
List<TenantCapacity> list = jdbcTemplate.query(sql, new Object[] {tenantId}, TENANT_CAPACITY_ROW_MAPPER);
if (list.isEmpty()) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;

import java.util.List;
import java.util.stream.Collectors;

/**
* The mysql implementation of TenantCapacityMapper.
*
* @author hyx
**/

public class TenantCapacityMapperByMySql extends AbstractMapperByMysql implements TenantCapacityMapper {


@Override
public String select(List<String> columns, List<String> where) {
columns = columns.stream().map(c -> "`" + c + "`").collect(Collectors.toList());
return super.select(columns, where);
}

@Override
public String getDataSource() {
return DataSourceConstant.MYSQL;
Expand Down
Loading