Skip to content

[BUG] namespace-user-rel batchSave foreach references wrong item variable (namespacePluginRelDO) #6870

Description

@Aias00

Description

countByQuery is select count(*) from scale_rule <if test="metricName != null"> and metric_name = #{metricName} </if> with no <where> element and no leading WHERE. When metricName is non-null the rendered SQL is select count(*) from scale_rule and metric_name = ? → syntax error. (When null it runs as an unbounded full count.) Additionally selectByQuery uses metric_name LIKE '%...%' while countByQuery uses metric_name = — a count/list predicate mismatch. Currently no caller in ScaleRuleServiceImpl.

Location

  • shenyu-admin/src/main/resources/mappers/scale-rule-sqlmap.xml:157-162

Impact

Latent broken SQL + count/list divergence; wiring scale-rule pagination would throw on any name filter.

Suggested fix

Wrap in <where> and use LIKE CONCAT('%', #{metricName}, '%') to match selectByQuery.

Related existing

Distinct from N22 (#6691, DataPermission selector/rule count-vs-list) — this is scale_rule, a different mapper and statement, and additionally has the missing-WHERE syntax error which N22 does not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions