Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

实现 URL 存储/取出数据库时自动转换的注解 #73

Description

@AK47are

背景

数据库仅存储图片的 ObjectName,而前端需要 URL,这代表:

  • 当前端向后端保存文件 URL 时,需要将 URL 转成 ObjectName
  • 当后端向前端提供文件 URL 时,需要将 ObjectName 转成 URL

数据库很多表字段都涉及 URL,每次在后端都需要自行转换,既麻烦还容易忘记,因此可以利用字段类型处理器 | MyBatis-Plus 自动转换,只需在对应 PO 类添加注解。

改动

  1. 自定义字段类型处理器并封装成注解
  2. 对涉及 URL 的 PO 类的字段添加实现的注解
  3. 重构现有自行转换 URL 的代码

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions