diff --git a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/AbstractMapper.java b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/AbstractMapper.java index f61db2a97fd..81c9adc8a87 100644 --- a/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/AbstractMapper.java +++ b/plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/mapper/AbstractMapper.java @@ -113,10 +113,8 @@ public String update(List columns, List where) { public String delete(List params) { StringBuilder sql = new StringBuilder(); String method = "DELETE "; - sql.append(method).append("FROM ").append(getTableName()).append(" "); + sql.append(method).append("FROM ").append(getTableName()); appendWhereClause(params, sql); - sql.append(method).append("FROM ").append(getTableName()).append(" ").append("WHERE "); - sql.append(params.stream().map(str -> (str + " = ?")).collect(Collectors.joining(" AND "))); return sql.toString(); } @@ -143,14 +141,6 @@ public String[] getPrimaryKeyGeneratedKeys() { return new String[]{"id"}; } - protected void appendWhereClause(List where, StringBuilder sql) { - sql.append("WHERE "); - for (int i = 0; i < where.size(); i++) { - sql.append(where.get(i)).append(" = ").append("?"); - if (i != where.size() - 1) { - sql.append(" AND "); - } - } private void appendWhereClause(List where, StringBuilder sql) { sql.append(" WHERE "); sql.append(where.stream().map(str -> (str + " = ?")).collect(Collectors.joining(" AND ")));