a
554325746@qq.com
2019-07-15 e6a8bdd23d6f5cb46ac650285829573280edcdf6
app/src/main/java/com/basic/security/dao/SqliteManager.java
@@ -135,4 +135,27 @@
            return this;
        }
    }
    public static Map<String, String> findById(String table, String id) {
        Cursor cursor = null;
        try {
            String sql = "select * from "+table+" where id = '" + id + "'";
            if (Constants.printSql) {
                System.out.println("findById="+sql);
            }
            cursor = DatabaseManager.getDatabase().rawQuery(sql, null);
            if (cursor.moveToFirst()) {
                return cursorToModelAdapter(cursor, table);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (cursor != null)
                cursor.close();
        }
        return null;
    }
}