Skip to content

[BUG] tag_relation updateByPrimaryKeySelective sets non-existent name column instead of api_id #6830

Description

@Aias00

Description

tag_relation updateByPrimaryKeySelective contains <if test="apiId != null"> name = #{apiId, jdbcType=VARCHAR}, </if>. The tag_relation table has columns id, api_id, tag_id, date_created, date_updated — there is no name column. When apiId is non-null, the generated SQL is UPDATE tag_relation SET name = ? ...Unknown column 'name' SQL error. Reachable: TagRelationServiceImpl.update() calls tagRelationMapper.updateByPrimaryKeySelective(tagRelationDO), and TagRelationDO.buildTagRelationDO populates apiId from the DTO.

Location

  • shenyu-admin/src/main/resources/mappers/tag-relation-sqlmap.xml:125
  • shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/TagRelationServiceImpl.java:54

Impact

Updating a tag-relation whose apiId is set throws a runtime SQL exception (HTTP 500) rather than performing the update; the tag-relation edit path is broken whenever apiId is supplied.

Suggested fix

Change line 125 to api_id = #{apiId, jdbcType=VARCHAR},.

Related existing

Distinct from N23 (#6692, TagServiceImpl.delete no cascade) and N55 (TagDTO validation). This is a wrong-column SQL defect in tag-relation-sqlmap.

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