Aias00 opened a new issue, #6870:
URL: https://github.com/apache/shenyu/issues/6870

   ## 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to