This commit is contained in:
yifeng.yl
2019-01-08 20:39:13 +08:00
parent 383819e280
commit 2e9702ec7b
242 changed files with 13523 additions and 654 deletions

View File

@ -28,7 +28,10 @@ class Sql extends BaseModel {
return tableName;
}
// condition: {}
Future<int> delete(String value,String key) async{
return await this.db.delete(tableName,where:'$key = ?',whereArgs:[value]);
}
Future<List> getByCondition({Map<dynamic, dynamic> conditions}) async {
if (conditions == null || conditions.isEmpty) {
return this.get();
@ -36,12 +39,10 @@ class Sql extends BaseModel {
String stringConditions = '';
int index = 0;
// print("condition>>> $conditions");
conditions.forEach((key, value) {
if (value == null) {
return ;
}
// print("$key value.runtimeType: ${value.runtimeType}");
if (value.runtimeType == String) {
stringConditions = '$stringConditions $key = "$value"';
}
@ -92,7 +93,6 @@ class Sql extends BaseModel {
}
index++;
});
print("this is string search condition for sql > $stringConditions");
return await this.query(tableName, where: stringConditions);
}