Stream-Query Stream-Query
首页
  • 项目初衷与诞生
  • 介绍
  • 快速上手
  • 目录结构
  • core模块

    • Opp
    • Sf
    • Map
    • Steam
    • TreeHelper
    • HighlightHelper
    • ReflectHelper
    • BeanHelper
  • plugin模块

    • Database
    • One
    • Many
    • OneToOne
    • OneToMany
  • 安装

    • 通过Maven安装
    • 通过Gradle安装
    • 下载jar安装
    • 通过源码编译
  • 动态mapper

    • 指定package
    • 指定注解
    • 指定接口
    • 指定实体类
  • 团队成员
  • dromara
  • 社区周边
  • 成为开发成员
  • 项目问题

    • 最新版本依赖下载失败
    • 项目编译报错
    • 如何贡献代码
    • 如何贡献文档
    • 使用本项目需要的前置知识
  • 其他问题

    • 作者是在全职维护开源吗
    • 你们这是个什么团队啊
    • 和其他类似的开源项目有什么区别
赞助
  • 1-5-0-alpha
  • 1-6-0-alpha
  • 1-7-0-alpha
  • 1-8-0
  • 1-9-0
  • 1-9-1
  • 2.0.0-alpha+001
  • 2.0.0-alpha+002
  • 2.0.2
Source (opens new window)
首页
  • 项目初衷与诞生
  • 介绍
  • 快速上手
  • 目录结构
  • core模块

    • Opp
    • Sf
    • Map
    • Steam
    • TreeHelper
    • HighlightHelper
    • ReflectHelper
    • BeanHelper
  • plugin模块

    • Database
    • One
    • Many
    • OneToOne
    • OneToMany
  • 安装

    • 通过Maven安装
    • 通过Gradle安装
    • 下载jar安装
    • 通过源码编译
  • 动态mapper

    • 指定package
    • 指定注解
    • 指定接口
    • 指定实体类
  • 团队成员
  • dromara
  • 社区周边
  • 成为开发成员
  • 项目问题

    • 最新版本依赖下载失败
    • 项目编译报错
    • 如何贡献代码
    • 如何贡献文档
    • 使用本项目需要的前置知识
  • 其他问题

    • 作者是在全职维护开源吗
    • 你们这是个什么团队啊
    • 和其他类似的开源项目有什么区别
赞助
  • 1-5-0-alpha
  • 1-6-0-alpha
  • 1-7-0-alpha
  • 1-8-0
  • 1-9-0
  • 1-9-1
  • 2.0.0-alpha+001
  • 2.0.0-alpha+002
  • 2.0.2
Source (opens new window)
  • 指南

    • 快速上手
    • 模块介绍
    • 项目初衷与诞生
  • core

    • Opp
    • Sf
    • TreeHelper
    • LighHight
    • LambdaHelper
    • Steam
    • Maps
    • ReflectHelper
    • BeanHelper
  • plugin

    • DataBase
    • One
    • Many
    • OneToOne
    • OneToMany
    • QueryCondition
    • safe-mode
  • 配置

目录

动态Mapper

# 概述

该文档描述了一个动态Mapper注解的作用和用法。该注解用于在Java代码中标记特定的实体类,并为其提供动态Mapper,无需再为每一个实体类创建Mapper接口。

# @EnableMybatisPlusPlugin

  • 描述:指定实体类生成动态Mapper接口
  • 使用位置:配置类
@SpringBootApplication
@EnableMybatisPlusPlugin
public class MybatisPlusTestApplication {}

# 使用示例

# 指定package

basePackages 指定需要增强的实体类的包路径,支持 * 通配符

@EnableMybatisPlusPlugin(basePackages = "org.dromara.streamquery.stream.plugin.**.pojo.**")
public class SpringBootApplication {}

# 指定注解

在需要增强的实体类上添加 annotation 属性指定的注解

@EnableMybatisPlusPlugin(annotation = GenerateMapper.class)
public class EnableMybatisPlusPluginByAnnotationTest {}
@Data
@GenerateMapper
public class Student {
 	private String name;
 	private int age;
 }

# 指定接口

在需要增强的实体类上实现 interfaceClass 属性指定的接口

@EnableMybatisPlusPlugin(interfaceClass = IGenerateMapper.class)
public class SpringBootApplication {}
@Data
public class Student implements IGenerateMapper {
 	private String name;
 	private int age;
 }

# 指定实体类

classes 属性指定需要增强的实体类

@EnableMybatisPlusPlugin(classes = {Student.class})
public class SpringBootApplication {}
上次更新: 2024/03/29, 09:17:32
Theme by Vdoing | Copyright © 2023-2024 阿超 | Apache License, Version 2.0
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式