类 MapperManageImpl
java.lang.Object
top.lingkang.mm.orm.MapperManageImpl
- 所有已实现的接口:
MapperManage
-
字段概要
字段修饰符和类型字段说明org.apache.ibatis.session.Configurationorg.apache.ibatis.session.SqlSession -
构造器概要
构造器构造器说明MapperManageImpl(org.apache.ibatis.session.Configuration configuration, org.apache.ibatis.session.SqlSession sqlSession) -
方法概要
修饰符和类型方法说明voidcheckIdSet(MagicEntity entity, Object obj, IdGenerate idGenerate) <T> QueryWrapper<T>createQuery(String sql, Class<T> resultClass) 返回查询条件,只能执行查询。createUpdate(String sql) 返回更新条件,执行更新操作。intdeleteById(Class<?> entityClass, Object id) 根据id删除数据。intdeleteById(Object entity) 根据id删除数据<T,E> int deleteByIds(Class<T> entityClass, List<E> ids) 根据id批量删除。voidexecuteSqlScript(File scriptFile) 执行sql脚本,自动处于事务中执行,出现失败时全部回滚。voidexecuteSqlScript(String sqlScript) 执行sql脚本,自动处于事务中执行,出现失败时全部回滚。<T> booleanexistsById(Class<T> entityClass, Object id) 根据id判断实体对象是否存在protected ObjectgetIdValue(Object obj, Class<?> clazz, String name) getMagicEntity(Class<?> clazz) <T> T获取mapper.xml对象的接口类代理getSqlId(MagicEntity entity, String action) getUpdateNotNullParams(Object obj, MagicEntity entity) int插入数据,空值也会插入int插入数据<T> intinsertBatch(List<T> list) 批量插入数据booleanprotected voidloadTemplate(MagicEntity entity) <T> List<T>查询所有<T> TselectById(Class<T> entityClass, Object id) 根据id查询数据<T> StringselectTableSql(Class<T> entityClass) 获取实体对象的查询表sql:select id, username, password from t_uservoidsetIdGenerate(IdGenerate idGenerate) intupdateById(Object entity) 根据id更新实体intupdateById(Object entity, boolean updateNull) 根据id更新实体
-
字段详细资料
-
configuration
public org.apache.ibatis.session.Configuration configuration -
sqlSession
public org.apache.ibatis.session.SqlSession sqlSession -
idGenerate
-
langMapper
-
-
构造器详细资料
-
MapperManageImpl
public MapperManageImpl(org.apache.ibatis.session.Configuration configuration, org.apache.ibatis.session.SqlSession sqlSession)
-
-
方法详细资料
-
createQuery
从接口复制的说明:MapperManage返回查询条件,只能执行查询。 例子:QueryWrapper<UserEntity> query = mapperManage.createQuery( "select * from t_user where id>#{id}", UserEntity.class); query.addParam("id", 2); List<UserEntity> list = query.getList(); System.out.println(list);- 指定者:
createQuery在接口中MapperManage- 类型参数:
T- 接收查询结果类- 参数:
sql- mybatis 语法的sql,例如 select * from t_user where id=#{id}resultClass- 接收查询结果的类型- 返回:
- 查询包装
-
createUpdate
从接口复制的说明:MapperManage返回更新条件,执行更新操作。例1 :
例2:UpadateWrapper update = mapperManage.createUpdate("update t_user set password=#{p} where id=#{id}"); update.addParam("p", System.currentTimeMillis()).addParam("id", 1); int execute = update.execute(); log.info("受影响行数: {}", execute);UpadateWrapper update = mapperManage.createUpdate("insert into t_user(id,username) values (2,#{un})"); update.addParam("un", "lk"); int execute = update.execute(); log.info("受影响行数: {}", execute);- 指定者:
createUpdate在接口中MapperManage- 参数:
sql- mybatis 语法的sql,例如 update t_user set age=28 where id=#{id}- 返回:
- 更新包装对象
-
selectAll
从接口复制的说明:MapperManage查询所有- 指定者:
selectAll在接口中MapperManage- 类型参数:
T- 实体对象类- 参数:
entityClass- 实体对象类- 返回:
- 查询结果,不为空。无结果时返回空List
-
selectById
从接口复制的说明:MapperManage根据id查询数据- 指定者:
selectById在接口中MapperManage- 类型参数:
T- 实体对象类- 参数:
entityClass- 实体对象类id- 主键id- 返回:
- 无结果时返回 null
-
existsById
从接口复制的说明:MapperManage根据id判断实体对象是否存在- 指定者:
existsById在接口中MapperManage- 类型参数:
T- boolean- 参数:
entityClass- 实体对象类id- 主键id- 返回:
- true 存在; false 不存在
-
insert
从接口复制的说明:MapperManage插入数据,空值也会插入- 指定者:
insert在接口中MapperManage- 参数:
entity- 实体对象- 返回:
- 影响的行数
-
insert
从接口复制的说明:MapperManage插入数据- 指定者:
insert在接口中MapperManage- 参数:
entity- 实体对象insertNull- 是否插入空值,若为 false 生成的sql不带空值的列- 返回:
- 影响的行数
-
insertBatch
从接口复制的说明:MapperManage批量插入数据- 指定者:
insertBatch在接口中MapperManage- 参数:
list- 实体对象列表- 返回:
- 影响的行数
-
updateById
从接口复制的说明:MapperManage根据id更新实体- 指定者:
updateById在接口中MapperManage- 参数:
entity- 实体对象- 返回:
- 影响的行数
-
updateById
从接口复制的说明:MapperManage根据id更新实体- 指定者:
updateById在接口中MapperManage- 参数:
entity- 实体对象updateNull- 是否更新空值,若为 false 生成的sql不带空值的列- 返回:
- 影响的行数
-
deleteById
从接口复制的说明:MapperManage根据id删除数据- 指定者:
deleteById在接口中MapperManage- 参数:
entity- 实体对象- 返回:
- 影响的行数
-
deleteById
从接口复制的说明:MapperManage根据id删除数据。注意,不会触发PreUpdate和PostUpdate注解方法- 指定者:
deleteById在接口中MapperManage- 参数:
entityClass- 实体对象类id- 主键id- 返回:
- 影响的行数
-
deleteByIds
从接口复制的说明:MapperManage根据id批量删除。注意,不会触发PreUpdate和PostUpdate注解方法- 指定者:
deleteByIds在接口中MapperManage- 参数:
entityClass- 实体对象类ids- id列表- 返回:
- 影响的行数
-
getMapper
从接口复制的说明:MapperManage获取mapper.xml对象的接口类代理- 指定者:
getMapper在接口中MapperManage- 类型参数:
T- mapper接口类- 参数:
type- mapper接口- 返回:
- mapper接口代理对象
-
selectTableSql
从接口复制的说明:MapperManage获取实体对象的查询表sql:select id, username, password from t_user- 指定者:
selectTableSql在接口中MapperManage- 参数:
entityClass- 实体对象类- 返回:
- select id, username, password from t_user
-
executeSqlScript
从接口复制的说明:MapperManage执行sql脚本,自动处于事务中执行,出现失败时全部回滚。- 指定者:
executeSqlScript在接口中MapperManage- 参数:
sqlScript- sql脚本内容
-
executeSqlScript
从接口复制的说明:MapperManage执行sql脚本,自动处于事务中执行,出现失败时全部回滚。- 指定者:
executeSqlScript在接口中MapperManage- 参数:
scriptFile- sql脚本文件
-
isLoad
-
getMagicEntity
-
loadTemplate
-
getUpdateNotNullParams
-
getSqlId
-
getSqlId
-
getQtId
-
checkIdSet
-
getIdValue
-
getIdGenerate
-
setIdGenerate
-