KANLON opened a new issue, #6422:
URL: https://github.com/apache/shenyu/issues/6422
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current Behavior
The `GET /appAuth/updateSk` endpoint always fails validation with the error
`updateSk.appKey: app key not existed`, regardless of whether the provided
`appKey` actually exists in the database.
**Root cause:** The `@Existed` validation on the `appKey` parameter uses
`AppKeyProvider`, whose `existed()` method calls `appAuthMapper.existed(key)`.
However, `AppAuthMapper.existed()` queries the `id` (primary key) column
instead of the `app_key` column:
```xml
<!-- Currently used (WRONG) - queries by id -->
<select id="existed" resultType="java.lang.Boolean">
SELECT true FROM app_auth WHERE id = #{id} LIMIT 1
</select>
<!-- Should use this - queries by app_key -->
<select id="appKeyExisted" resultType="java.lang.Boolean">
SELECT true FROM app_auth WHERE app_key = #{appKey} LIMIT 1
</select>
```
Since the passed `appKey` value is checked against the `id` column, the
query never matches, so the validation always fails.
**Fix:** In `AppKeyProvider.existed()`, call
`appAuthMapper.appKeyExisted(key)` instead of `appAuthMapper.existed(key)`.
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Environment
```markdown
ShenYu version(s):
```
### Debug logs
_No response_
### Anything else?
_No response_
--
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]