接口 SqliteTablesMapper


@InterceptorIgnore(tenantLine="true", illegalSql="true", blockAttack="true") public interface SqliteTablesMapper
创建更新表结构的Mapper
作者:
don
  • 方法详细资料

    • executeSql

      @Select("${sql}") void executeSql(String sql)
      万能sql执行器
      参数:
      sql - 待执行的sql
    • dropTableByName

      @Delete("drop table if exists `${tableName}`;") void dropTableByName(String tableName)
      根据表名删除表
      参数:
      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

      @Delete("drop index if exists \"${indexName}\";") void dropIndexSql(String indexName)
      删除索引
      参数:
      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 - 备份的名称