This is an automated email from the ASF dual-hosted git repository.

dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new f6c55fd843 fix(admin): tag_relation updateByPrimaryKeySelective sets 
non-existent name column (#6907)
f6c55fd843 is described below

commit f6c55fd843e811032fa87f35f168bf97dd583e13
Author: redyyang <[email protected]>
AuthorDate: Wed Sep 16 10:46:26 2026 +0800

    fix(admin): tag_relation updateByPrimaryKeySelective sets non-existent name 
column (#6907)
    
    The apiId branch emitted `name = #{apiId}`, but tag_relation only has
    id, api_id, tag_id, date_created and date_updated. Updating a tag
    relation with an apiId therefore failed with a SQL grammar error
    instead of performing the update. The sibling updateByPrimaryKey
    already uses api_id.
    
    Add a TagRelationMapperTest case for updateByPrimaryKeySelective, which
    was the only mapper method left uncovered by that test class.
    
    Fixes #6830
    
    Co-authored-by: Cursor <[email protected]>
    Co-authored-by: aias00 <[email protected]>
    Co-authored-by: Liming Deng <[email protected]>
---
 .../src/main/resources/mappers/tag-relation-sqlmap.xml  |  2 +-
 .../shenyu/admin/mapper/TagRelationMapperTest.java      | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/shenyu-admin/src/main/resources/mappers/tag-relation-sqlmap.xml 
b/shenyu-admin/src/main/resources/mappers/tag-relation-sqlmap.xml
index 13e973fbe4..647ef5154c 100644
--- a/shenyu-admin/src/main/resources/mappers/tag-relation-sqlmap.xml
+++ b/shenyu-admin/src/main/resources/mappers/tag-relation-sqlmap.xml
@@ -122,7 +122,7 @@
                 date_updated = #{dateUpdated, jdbcType=TIMESTAMP},
             </if>
             <if test="apiId != null">
-                name = #{apiId, jdbcType=VARCHAR},
+                api_id = #{apiId, jdbcType=VARCHAR},
             </if>
             <if test="tagId != null">
                 tag_id = #{tagId, jdbcType=VARCHAR},
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/TagRelationMapperTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/TagRelationMapperTest.java
index a66b59b425..33a203137d 100644
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/TagRelationMapperTest.java
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/TagRelationMapperTest.java
@@ -86,6 +86,23 @@ public class TagRelationMapperTest extends 
AbstractSpringIntegrationTest {
         assertThat(tagRelationDO.getTagId().equals("2222222"), equalTo(true));
     }
 
+    @Test
+    public void testUpdateByPrimaryKeySelective() {
+        TagRelationDO record = buildTagRelationDO();
+        int count = tagRelationMapper.insertSelective(record);
+        assertThat(count, greaterThan(0));
+
+        record.setApiId("456");
+        int updateCount = 
tagRelationMapper.updateByPrimaryKeySelective(record);
+        assertThat(updateCount, greaterThan(0));
+
+        TagRelationDO tagRelationDO = 
tagRelationMapper.selectByPrimaryKey(record.getId());
+        assertThat(tagRelationDO.getApiId(), equalTo("456"));
+
+        int delete = tagRelationMapper.deleteByPrimaryKey(record.getId());
+        assertThat(delete, equalTo(1));
+    }
+
     @Test
     public void testSelectByQuery() {
         TagRelationDO record = buildTagRelationDO();

Reply via email to