public class AutoSqlInjector extends Object implements ISqlInjector
SQL 自动注入器
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.apache.ibatis.builder.MapperBuilderAssistant |
builderAssistant |
protected org.apache.ibatis.session.Configuration |
configuration |
protected DBType |
dbType |
protected org.apache.ibatis.scripting.LanguageDriver |
languageDriver |
protected static Logger |
logger |
| 构造器和说明 |
|---|
AutoSqlInjector() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.ibatis.mapping.MappedStatement |
addDeleteMappedStatement(Class<?> mapperClass,
String id,
org.apache.ibatis.mapping.SqlSource sqlSource) |
org.apache.ibatis.mapping.MappedStatement |
addInsertMappedStatement(Class<?> mapperClass,
Class<?> modelClass,
String id,
org.apache.ibatis.mapping.SqlSource sqlSource,
org.apache.ibatis.executor.keygen.KeyGenerator keyGenerator,
String keyProperty,
String keyColumn) |
org.apache.ibatis.mapping.MappedStatement |
addMappedStatement(Class<?> mapperClass,
String id,
org.apache.ibatis.mapping.SqlSource sqlSource,
org.apache.ibatis.mapping.SqlCommandType sqlCommandType,
Class<?> parameterClass,
String resultMap,
Class<?> resultType,
org.apache.ibatis.executor.keygen.KeyGenerator keyGenerator,
String keyProperty,
String keyColumn) |
org.apache.ibatis.mapping.MappedStatement |
addSelectMappedStatement(Class<?> mapperClass,
String id,
org.apache.ibatis.mapping.SqlSource sqlSource,
Class<?> resultType,
TableInfo table) |
org.apache.ibatis.mapping.MappedStatement |
addUpdateMappedStatement(Class<?> mapperClass,
Class<?> modelClass,
String id,
org.apache.ibatis.mapping.SqlSource sqlSource) |
protected String |
convertIfTag(org.apache.ibatis.mapping.SqlCommandType sqlCommandType,
TableFieldInfo fieldInfo,
String prefix,
boolean colse)
IF 条件转换方法
|
protected String |
convertIfTag(TableFieldInfo fieldInfo,
boolean colse) |
protected String |
convertIfTag(TableFieldInfo fieldInfo,
String prefix,
boolean colse) |
protected String |
convertIfTagInsert(TableFieldInfo fieldInfo,
boolean colse) |
protected Class<?> |
extractModelClass(Class<?> mapperClass) |
void |
inject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass)
注入单点 crudSql
|
void |
inject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
自定义方法,注入点(子类需重写该方法)
|
protected void |
injectDeleteByMapSql(Class<?> mapperClass,
TableInfo table)
注入 map 条件删除 SQL 语句
|
protected void |
injectDeleteSelectiveSql(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入 entity 条件删除 SQL 语句
|
protected void |
injectDeleteSql(boolean batch,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入删除 SQL 语句
|
protected void |
injectInsertBatchSql(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入批量插入 SQL 语句
|
protected void |
injectInsertOneSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入插入 SQL 语句
|
protected void |
injectSelectByMapSql(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入 map 查询 SQL 语句
|
protected void |
injectSelectCountByEWSql(SqlMethod sqlMethod,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入EntityWrapper查询总记录数 SQL 语句
|
protected void |
injectSelectCountSql(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入实体查询总记录数 SQL 语句
|
protected void |
injectSelectListSql(SqlMethod sqlMethod,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入EntityWrapper方式查询记录列表 SQL 语句
|
protected void |
injectSelectOneSql(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入实体查询一条记录 SQL 语句
|
protected void |
injectSelectSql(boolean batch,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入查询 SQL 语句
|
protected void |
injectUpdateBatchById(Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入批量更新 SQL 语句
|
protected void |
injectUpdateByIdSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入更新 SQL 语句
|
protected void |
injectUpdateSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入批量更新 SQL 语句
|
void |
inspectInject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass)
CRUD注入后给予标识 注入过后不再注入
|
protected String |
sqlSelectColumns(TableInfo table,
boolean entityWrapper)
SQL 查询所有表字段
|
protected String |
sqlSet(boolean selective,
TableInfo table)
SQL 更新 set 语句
|
protected String |
sqlWhere(TableInfo table,
boolean space)
SQL 查询条件
|
protected String |
sqlWhereByMap()
SQL map 查询条件
|
protected String |
sqlWhereEntityWrapper(TableInfo table)
EntityWrapper方式获取select where
|
protected static final Logger logger
protected org.apache.ibatis.session.Configuration configuration
protected org.apache.ibatis.scripting.LanguageDriver languageDriver
protected org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant
protected DBType dbType
public void inspectInject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass)
inspectInject 在接口中 ISqlInjectorconfiguration - builderAssistant - mapperClass - public void inject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass)
inject 在接口中 ISqlInjectorpublic void inject(org.apache.ibatis.session.Configuration configuration,
org.apache.ibatis.builder.MapperBuilderAssistant builderAssistant,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
protected void injectInsertOneSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入插入 SQL 语句
selective - 是否选择插入mapperClass - modelClass - table - protected void injectInsertBatchSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入批量插入 SQL 语句
mapperClass - modelClass - table - protected void injectDeleteSelectiveSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入 entity 条件删除 SQL 语句
mapperClass - modelClass - table - protected void injectDeleteByMapSql(Class<?> mapperClass, TableInfo table)
注入 map 条件删除 SQL 语句
mapperClass - table - protected void injectDeleteSql(boolean batch,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入删除 SQL 语句
batch - 是否为批量插入mapperClass - modelClass - table - protected void injectUpdateByIdSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入更新 SQL 语句
selective - 是否选择更新mapperClass - modelClass - table - protected void injectUpdateBatchById(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入批量更新 SQL 语句
mapperClass - modelClass - table - protected void injectUpdateSql(boolean selective,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入批量更新 SQL 语句
selective - 是否选择更新mapperClass - modelClass - table - protected void injectSelectSql(boolean batch,
Class<?> mapperClass,
Class<?> modelClass,
TableInfo table)
注入查询 SQL 语句
batch - 是否为批量插入mapperClass - modelClass - table - protected void injectSelectByMapSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入 map 查询 SQL 语句
mapperClass - modelClass - table - protected void injectSelectOneSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入实体查询一条记录 SQL 语句
mapperClass - modelClass - table - protected void injectSelectCountSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入实体查询总记录数 SQL 语句
mapperClass - modelClass - table - protected void injectSelectListSql(SqlMethod sqlMethod, Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入EntityWrapper方式查询记录列表 SQL 语句
sqlMethod - mapperClass - modelClass - table - protected void injectSelectCountByEWSql(SqlMethod sqlMethod, Class<?> mapperClass, Class<?> modelClass, TableInfo table)
注入EntityWrapper查询总记录数 SQL 语句
sqlMethod - mapperClass - modelClass - table - protected String sqlWhereEntityWrapper(TableInfo table)
EntityWrapper方式获取select where
table - protected String sqlSet(boolean selective, TableInfo table)
SQL 更新 set 语句
selective - 是否选择更新table - protected String sqlSelectColumns(TableInfo table, boolean entityWrapper)
SQL 查询所有表字段
table - entityWrapper - 是否为包装类型查询protected String sqlWhere(TableInfo table, boolean space)
SQL 查询条件
table - space - 是否为空判断protected String sqlWhereByMap()
SQL map 查询条件
protected String convertIfTag(org.apache.ibatis.mapping.SqlCommandType sqlCommandType, TableFieldInfo fieldInfo, String prefix, boolean colse)
IF 条件转换方法
sqlCommandType - SQL 操作类型fieldInfo - 字段信息prefix - 条件前缀colse - 是否闭合标签protected String convertIfTagInsert(TableFieldInfo fieldInfo, boolean colse)
protected String convertIfTag(TableFieldInfo fieldInfo, String prefix, boolean colse)
protected String convertIfTag(TableFieldInfo fieldInfo, boolean colse)
public org.apache.ibatis.mapping.MappedStatement addSelectMappedStatement(Class<?> mapperClass, String id, org.apache.ibatis.mapping.SqlSource sqlSource, Class<?> resultType, TableInfo table)
public org.apache.ibatis.mapping.MappedStatement addInsertMappedStatement(Class<?> mapperClass, Class<?> modelClass, String id, org.apache.ibatis.mapping.SqlSource sqlSource, org.apache.ibatis.executor.keygen.KeyGenerator keyGenerator, String keyProperty, String keyColumn)
public org.apache.ibatis.mapping.MappedStatement addDeleteMappedStatement(Class<?> mapperClass, String id, org.apache.ibatis.mapping.SqlSource sqlSource)
public org.apache.ibatis.mapping.MappedStatement addUpdateMappedStatement(Class<?> mapperClass, Class<?> modelClass, String id, org.apache.ibatis.mapping.SqlSource sqlSource)
public org.apache.ibatis.mapping.MappedStatement addMappedStatement(Class<?> mapperClass, String id, org.apache.ibatis.mapping.SqlSource sqlSource, org.apache.ibatis.mapping.SqlCommandType sqlCommandType, Class<?> parameterClass, String resultMap, Class<?> resultType, org.apache.ibatis.executor.keygen.KeyGenerator keyGenerator, String keyProperty, String keyColumn)
Copyright © 2016. All rights reserved.