MyBatis-Plus(简称 MP)是一个 MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生。
官网https://mp.baomidou.com/guide/
全新的 MyBatis-Plus
3.0 版本基于 JDK8,提供了 lambda
形式的调用,所以安装集成 MP3.0 要求如下:
Spring Boot 中pom依赖
com.baomidou
mybatis-plus-boot-starter
3.0.6
Spring MVC 中pom依赖
com.baomidou
mybatis-plus
3.0.6
MyBatis-Plus
之后请不要再次引入 MyBatis
以及 MyBatis-Spring
,以避免因版本差异导致的问题。Spring Boot 工程:
配置 MapperScan 注解
@SpringBootApplication
@MapperScan("com.baomidou.mybatisplus.samples.quickstart.mapper")
public class Application {
public static void main(String[] args) {
SpringApplication.run(QuickStartApplication.class, args);
}
}
Spring MVC 工程:
配置 MapperScan
调整 SqlSessionFactory 为 MyBatis-Plus 的 SqlSessionFactory
通常来说,一般的简单工程,通过以上配置即可正常使用 MyBatis-Plus
package com.xuxu.common;
import java.util.Scanner;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
public class CodeGenerator {
// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
/**
*
* 读取控制台内容
*
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 选择 freemarker 引擎,默认 Veloctiy
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setOutputDir("C://Users/Administrator/Desktop/备份/ssm/src/main/java"); //生成文件的输出目录
gc.setAuthor("xuxu"); //作者
gc.setFileOverride(true); //是否覆蓋已有文件 默认值:false
gc.setOpen(false); //是否打开输出目录 默认值:true
// gc.setSwagger2(true); //开启 swagger2 模式 默认false
gc.setBaseColumnList(true); //开启 baseColumnList 默认false
gc.setBaseResultMap(true); //开启 BaseResultMap 默认false
gc.setEntityName("%sEntity"); //实体命名方式 默认值:null 例如:%sEntity 生成 UserEntity
gc.setMapperName("%sMapper"); //mapper 命名方式 默认值:null 例如:%sDao 生成 UserDao
gc.setXmlName("%sMapper"); //Mapper xml 命名方式 默认值:null 例如:%sDao 生成 UserDao.xml
gc.setServiceName("%sService"); //service 命名方式 默认值:null 例如:%sBusiness 生成 UserBusiness
gc.setServiceImplName("%sServiceImpl"); //service impl 命名方式 默认值:null 例如:%sBusinessImpl 生成 UserBusinessImpl
gc.setControllerName("%sController"); //controller 命名方式 默认值:null 例如:%sAction 生成 UserAction
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setDbType(DbType.MYSQL); //数据库类型 该类内置了常用的数据库类型【必须】
dsc.setUrl("jdbc:mysql://localhost:3306/mybatis?useUnicode=true&useSSL=false&characterEncoding=utf8");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("root");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
// pc.setModuleName(scanner("模块名"));
pc.setParent("com.xuxu.user");
mpg.setPackageInfo(pc);
// 自定义配置
// InjectionConfig cfg = new InjectionConfig() {
// @Override
// public void initMap() { //注入自定义 Map 对象
// // to do nothing
// }
// };
// List focList = new ArrayList<>();
// focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
// @Override
// public String outputFile(TableInfo tableInfo) {
// // 自定义输入文件名称
// return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
// + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
// }
// });
// cfg.setFileOutConfigList(focList);
// mpg.setCfg(cfg);
// mpg.setTemplate(new TemplateConfig().setXml(null));
// 策略配置 数据库表配置,通过该配置,可指定需要生成哪些表或者排除哪些表
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel); //表名生成策略
strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略, 未指定按照 naming 执行
// strategy.setCapitalMode(true); // 全局大写命名 ORACLE 注意
// strategy.setTablePrefix("prefix"); //表前缀
// strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity"); //自定义继承的Entity类全称,带包名
// strategy.setSuperEntityColumns(new String[] { "test_id", "age" }); //自定义实体,公共字段
// strategy.setEntityLombokModel(true); //【实体】是否为lombok模型(默认 false
strategy.setRestControllerStyle(true); //生成 @RestController 控制器
// strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController"); //自定义继承的Controller类全称,带包名
strategy.setInclude(scanner("表名")); //需要包含的表名,允许正则表达式(与exclude二选一配置)
// strategy.setInclude(new String[] { "user" }); // 需要生成的表可以多张表
// strategy.setExclude(new String[]{"test"}); // 排除生成的表
strategy.setControllerMappingHyphenStyle(true); //驼峰转连字符
strategy.setTablePrefix(pc.getModuleName() + "_"); //是否生成实体时,生成字段注解
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
/*
* Copyright (c) 2011-2020, hubin ([email protected]).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.baomidou.mybatisplus.core.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
*
* Mapper 继承该接口后,无需编写 mapper.xml 文件,即可获得CRUD功能
*
*
* 这个 Mapper 支持 id 泛型
*
*
* @author hubin
* @since 2016-01-23
*/
public interface BaseMapper {
/**
*
* 插入一条记录
*
*
* @param entity 实体对象
*/
int insert(T entity);
/**
*
* 根据 ID 删除
*
*
* @param id 主键ID
*/
int deleteById(Serializable id);
/**
*
* 根据 columnMap 条件,删除记录
*
*
* @param columnMap 表字段 map 对象
*/
int deleteByMap(@Param(Constants.COLUMN_MAP) Map columnMap);
/**
*
* 根据 entity 条件,删除记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
*/
int delete(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 删除(根据ID 批量删除)
*
*
* @param idList 主键ID列表(不能为 null 以及 empty)
*/
int deleteBatchIds(@Param(Constants.COLLECTION) Collection extends Serializable> idList);
/**
*
* 根据 ID 修改
*
*
* @param entity 实体对象
*/
int updateById(@Param(Constants.ENTITY) T entity);
/**
*
* 根据 whereEntity 条件,更新记录
*
*
* @param entity 实体对象 (set 条件值,不能为 null)
* @param updateWrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句)
*/
int update(@Param(Constants.ENTITY) T entity, @Param(Constants.WRAPPER) Wrapper updateWrapper);
/**
*
* 根据 ID 查询
*
*
* @param id 主键ID
*/
T selectById(Serializable id);
/**
*
* 查询(根据ID 批量查询)
*
*
* @param idList 主键ID列表(不能为 null 以及 empty)
*/
List selectBatchIds(@Param(Constants.COLLECTION) Collection extends Serializable> idList);
/**
*
* 查询(根据 columnMap 条件)
*
*
* @param columnMap 表字段 map 对象
*/
List selectByMap(@Param(Constants.COLUMN_MAP) Map columnMap);
/**
*
* 根据 entity 条件,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
*/
T selectOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询总记录数
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
*/
Integer selectCount(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 entity 条件,查询全部记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
*/
List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询全部记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
*/
List
/*
* Copyright (c) 2011-2016, hubin ([email protected]).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.baomidou.mybatisplus.extension.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
*
* 顶级 Service
*
*
* @author hubin
* @since 2018-06-23
*/
public interface IService {
/**
*
* 插入一条记录(选择字段,策略插入)
*
*
* @param entity 实体对象
*/
boolean save(T entity);
/**
*
* 插入(批量)
*
*
* @param entityList 实体对象集合
*/
default boolean saveBatch(Collection entityList) {
return saveBatch(entityList, 1000);
}
/**
*
* 插入(批量)
*
*
* @param entityList 实体对象集合
* @param batchSize 插入批次数量
*/
boolean saveBatch(Collection entityList, int batchSize);
/**
*
* 批量修改插入
*
*
* @param entityList 实体对象集合
*/
default boolean saveOrUpdateBatch(Collection entityList) {
return saveOrUpdateBatch(entityList, 1000);
}
/**
*
* 批量修改插入
*
*
* @param entityList 实体对象集合
* @param batchSize 每次的数量
*/
boolean saveOrUpdateBatch(Collection entityList, int batchSize);
/**
*
* 根据 ID 删除
*
*
* @param id 主键ID
*/
boolean removeById(Serializable id);
/**
*
* 根据 columnMap 条件,删除记录
*
*
* @param columnMap 表字段 map 对象
*/
boolean removeByMap(Map columnMap);
/**
*
* 根据 entity 条件,删除记录
*
*
* @param queryWrapper 实体包装类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
boolean remove(Wrapper queryWrapper);
/**
*
* 删除(根据ID 批量删除)
*
*
* @param idList 主键ID列表
*/
boolean removeByIds(Collection extends Serializable> idList);
/**
*
* 根据 ID 选择修改
*
*
* @param entity 实体对象
*/
boolean updateById(T entity);
/**
*
* 根据 whereEntity 条件,更新记录
*
*
* @param entity 实体对象
* @param updateWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper}
*/
boolean update(T entity, Wrapper updateWrapper);
/**
*
* 根据ID 批量更新
*
*
* @param entityList 实体对象集合
*/
default boolean updateBatchById(Collection entityList) {
return updateBatchById(entityList, 1000);
}
/**
*
* 根据ID 批量更新
*
*
* @param entityList 实体对象集合
* @param batchSize 更新批次数量
*/
boolean updateBatchById(Collection entityList, int batchSize);
/**
*
* TableId 注解存在更新记录,否插入一条记录
*
*
* @param entity 实体对象
*/
boolean saveOrUpdate(T entity);
/**
*
* 根据 ID 查询
*
*
* @param id 主键ID
*/
T getById(Serializable id);
/**
*
* 查询(根据ID 批量查询)
*
*
* @param idList 主键ID列表
*/
Collection listByIds(Collection extends Serializable> idList);
/**
*
* 查询(根据 columnMap 条件)
*
*
* @param columnMap 表字段 map 对象
*/
Collection listByMap(Map columnMap);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
default T getOne(Wrapper queryWrapper) {
return getOne(queryWrapper, false);
}
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
* @param throwEx 有多个 result 是否抛出异常
*/
T getOne(Wrapper queryWrapper, boolean throwEx);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
Map getMap(Wrapper queryWrapper);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
* @param mapper 转换函数
*/
default V getObj(Wrapper queryWrapper, Function super Object, V> mapper) {
return SqlHelper.getObject(listObjs(queryWrapper, mapper));
}
/**
*
* 根据 Wrapper 条件,查询总记录数
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
int count(Wrapper queryWrapper);
/**
*
* 查询总记录数
*
*
* @see Wrappers#emptyWrapper()
*/
default int count() {
return count(Wrappers.emptyWrapper());
}
/**
*
* 查询列表
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
List list(Wrapper queryWrapper);
/**
*
* 查询所有
*
*
* @see Wrappers#emptyWrapper()
*/
default List list() {
return list(Wrappers.emptyWrapper());
}
/**
*
* 翻页查询
*
*
* @param page 翻页对象
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
IPage page(IPage page, Wrapper queryWrapper);
/**
*
* 无条件翻页查询
*
*
* @param page 翻页对象
* @see Wrappers#emptyWrapper()
*/
default IPage page(IPage page) {
return page(page, Wrappers.emptyWrapper());
}
/**
*
* 查询列表
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
List
说明:
Mybatis-Plus
启动时自动解析实体表关系映射转换为 Mybatis
内部对象注入容器T
为任意实体对象Serializable
为任意类型主键 Mybatis-Plus
不推荐使用复合主键约定每一张表都有自己的唯一 id
主键Wrapper
为 条件构造器/**
*
* 插入一条记录
*
*
* @param entity 实体对象
* @return 插入成功记录数
*/
int insert(T entity);
/**
*
* 根据 ID 删除
*
*
* @param id 主键ID
* @return 删除成功记录数
*/
int deleteById(Serializable id);
/**
*
* 根据 columnMap 条件,删除记录
*
*
* @param columnMap 表字段 map 对象
* @return 删除成功记录数
*/
int deleteByMap(@Param(Constants.COLUMN_MAP) Map columnMap);
/**
*
* 根据 entity 条件,删除记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
* @return 删除成功记录数
*/
int delete(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 删除(根据ID 批量删除)
*
*
* @param idList 主键ID列表(不能为 null 以及 empty)
* @return 删除成功记录数
*/
int deleteBatchIds(@Param(Constants.COLLECTION) Collection extends Serializable> idList);
/**
*
* 根据 ID 修改
*
*
* @param entity 实体对象
* @return 修改成功记录数
*/
int updateById(@Param(Constants.ENTITY) T entity);
/**
*
* 根据 whereEntity 条件,更新记录
*
*
* @param entity 实体对象 (set 条件值,不能为 null)
* @param updateWrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句)
* @return 修改成功记录数
*/
int update(@Param(Constants.ENTITY) T entity, @Param(Constants.WRAPPER) Wrapper updateWrapper);
/**
*
* 根据 ID 查询
*
*
* @param id 主键ID
* @return 实体
*/
T selectById(Serializable id);
/**
*
* 查询(根据ID 批量查询)
*
*
* @param idList 主键ID列表(不能为 null 以及 empty)
* @return 实体集合
*/
List selectBatchIds(@Param(Constants.COLLECTION) Collection extends Serializable> idList);
/**
*
* 查询(根据 columnMap 条件)
*
*
* @param columnMap 表字段 map 对象
* @return 实体集合
*/
List selectByMap(@Param(Constants.COLUMN_MAP) Map columnMap);
/**
*
* 根据 entity 条件,查询一条记录
*
*
* @param queryWrapper 实体对象
* @return 实体
*/
T selectOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询总记录数
*
*
* @param queryWrapper 实体对象
* @return 满足条件记录数
*/
Integer selectCount(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 entity 条件,查询全部记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
* @return 实体集合
*/
List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询全部记录
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
* @return 字段映射对象 Map 集合
*/
List> selectMaps(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询全部记录
* 注意: 只返回第一个字段的值
*
*
* @param queryWrapper 实体对象封装操作类(可以为 null)
* @return 字段映射对象集合
*/
List selectObjs(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 entity 条件,查询全部记录(并翻页)
*
*
* @param page 分页查询条件(可以为 RowBounds.DEFAULT)
* @param queryWrapper 实体对象封装操作类(可以为 null)
* @return 实体分页对象
*/
IPage selectPage(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询全部记录(并翻页)
*
*
* @param page 分页查询条件
* @param queryWrapper 实体对象封装操作类
* @return 字段映射对象 Map 分页对象
*/
IPage> selectMapsPage(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
说明:
get 查询单行
remove 删除
list 查询集合
page 分页
前缀命名方式区分 Mapper
层避免混淆,T
为任意实体对象IBaseService
继承 Mybatis-Plus
提供的基类Wrapper
为 条件构造器/**
*
* 插入一条记录(选择字段,策略插入)
*
*
* @param entity 实体对象
*/
boolean save(T entity);
/**
*
* 插入一条记录(选择字段,策略插入)
*
*
* @param entity 实体对象
*/
boolean save(T entity);
/**
*
* 批量修改插入
*
*
* @param entityList 实体对象集合
*/
boolean saveOrUpdateBatch(Collection entityList);
/**
*
* 批量修改插入
*
*
* @param entityList 实体对象集合
* @param batchSize 每次的数量
*/
boolean saveOrUpdateBatch(Collection entityList, int batchSize);
/**
*
* 根据 ID 删除
*
*
* @param id 主键ID
*/
boolean removeById(Serializable id);
/**
*
* 根据 columnMap 条件,删除记录
*
*
* @param columnMap 表字段 map 对象
*/
boolean removeByMap(Map columnMap);
/**
*
* 根据 entity 条件,删除记录
*
*
* @param queryWrapper 实体包装类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
boolean remove(Wrapper queryWrapper);
/**
*
* 删除(根据ID 批量删除)
*
*
* @param idList 主键ID列表
*/
boolean removeByIds(Collection extends Serializable> idList);
/**
*
* 根据 ID 选择修改
*
*
* @param entity 实体对象
*/
boolean updateById(T entity);
/**
*
* 根据 whereEntity 条件,更新记录
*
*
* @param entity 实体对象
* @param updateWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper}
*/
boolean update(T entity, Wrapper updateWrapper);
/**
*
* 根据ID 批量更新
*
*
* @param entityList 实体对象集合
* @param batchSize 更新批次数量
*/
boolean updateBatchById(Collection entityList, int batchSize);
/**
*
* TableId 注解存在更新记录,否插入一条记录
*
*
* @param entity 实体对象
*/
boolean saveOrUpdate(T entity);
/**
*
* 根据 ID 查询
*
*
* @param id 主键ID
*/
T getById(Serializable id);
/**
*
* 查询(根据ID 批量查询)
*
*
* @param idList 主键ID列表
*/
Collection listByIds(Collection extends Serializable> idList);
/**
*
* 查询(根据 columnMap 条件)
*
*
* @param columnMap 表字段 map 对象
*/
Collection listByMap(Map columnMap);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
* @param throwEx 有多个 result 是否抛出异常
*/
T getOne(Wrapper queryWrapper, boolean throwEx);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
Map getMap(Wrapper queryWrapper);
/**
*
* 根据 Wrapper,查询一条记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
Object getObj(Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询总记录数
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
int count(Wrapper queryWrapper);
/**
*
* 查询列表
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
List list(Wrapper queryWrapper);
/**
*
* 翻页查询
*
*
* @param page 翻页对象
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
IPage page(IPage page, Wrapper queryWrapper);
/**
*
* 查询列表
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
List> listMaps(Wrapper queryWrapper);
/**
*
* 根据 Wrapper 条件,查询全部记录
*
*
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
List listObjs(Wrapper queryWrapper);
/**
*
* 翻页查询
*
*
* @param page 翻页对象
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
*/
IPage> pageMaps(IPage page, Wrapper queryWrapper);