Module bus.mapper

Class KeySqlRegistry

java.lang.Object
org.miaixz.bus.mapper.support.keysql.KeySqlRegistry
All Implemented Interfaces:
Registry

public class KeySqlRegistry extends Object implements Registry
处理实体类上的主键策略,自动配置主键生成逻辑。

如果方法通过 MyBatis 注解(如 @Options 或 @SelectKey)配置了主键策略,将记录警告信息并跳过实体类上的主键策略配置。

Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields inherited from interface org.miaixz.bus.mapper.Registry

    SPI
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    customize(TableMeta entity, org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.builder.annotation.ProviderContext context)
    自定义主键策略,检查并应用实体类上的主键生成策略。

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeySqlRegistry

      public KeySqlRegistry()
  • Method Details

    • customize

      public void customize(TableMeta entity, org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.builder.annotation.ProviderContext context)
      自定义主键策略,检查并应用实体类上的主键生成策略。
      Specified by:
      customize in interface Registry
      Parameters:
      entity - 实体表信息
      ms - MappedStatement 对象
      context - 提供者上下文,包含方法和接口信息
      Throws:
      RuntimeException - 如果存在多个字段配置了主键策略