接口 SqliteTablesMapper
@InterceptorIgnore(tenantLine="true",
illegalSql="true",
blockAttack="true")
public interface SqliteTablesMapper
创建更新表结构的Mapper
- 作者:
- don
-
方法概要
修饰符和类型方法说明voidbackupTable(String orgTableName, String backupTableName) 备份表intcheckTableExist(String tableName) 根据表名判断是否存在voiddropIndexSql(String indexName) 删除索引voiddropTableByName(String tableName) 根据表名删除表voidexecuteSql(String sql) 万能sql执行器voidmigrateData(String orgTableName, String backupTableName) 备份表queryBuildIndexSql(String tableName) 查询建表语句queryBuildTableSql(String tableName) 查询建表语句
-
方法详细资料
-
executeSql
万能sql执行器- 参数:
sql- 待执行的sql
-
dropTableByName
根据表名删除表- 参数:
tableName- 表名
-
checkTableExist
@Select("select count(1) from `sqlite_master` where type=\'table\' and name=#{tableName};") int checkTableExist(String tableName) 根据表名判断是否存在- 参数:
tableName- 表名- 返回:
- 影响行数
-
queryBuildTableSql
@Select("select `sql` from sqlite_master where type=\'table\' and name=#{tableName};") String queryBuildTableSql(String tableName) 查询建表语句- 参数:
tableName- 表名- 返回:
- 建表语句
-
queryBuildIndexSql
@Result(column="type",property="type") @Result(column="name",property="name") @Result(column="tbl_name",property="tblName") @Result(column="rootpage",property="rootpage") @Result(column="sql",property="sql") @Select("select * from sqlite_master where type=\'index\' and tbl_name=#{tableName};") List<SqliteMaster> queryBuildIndexSql(String tableName) 查询建表语句- 参数:
tableName- 表名- 返回:
- 建表语句
-
dropIndexSql
删除索引- 参数:
indexName- 索引名
-
backupTable
@Select("ALTER TABLE \"${orgTableName}\" RENAME TO \"${backupTableName}\";") void backupTable(String orgTableName, String backupTableName) 备份表- 参数:
orgTableName- 原表名称backupTableName- 备份的名称
-
migrateData
@Insert("INSERT INTO \"${orgTableName}\" SELECT * FROM \"${backupTableName}\";") void migrateData(String orgTableName, String backupTableName) 备份表- 参数:
orgTableName- 原表名称backupTableName- 备份的名称
-