File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
library/src/com/lidroid/xutils Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -580,7 +580,7 @@ public static class DaoConfig {
580
580
private String dbDir ;
581
581
582
582
public DaoConfig (Context context ) {
583
- this .context = context ;
583
+ this .context = context . getApplicationContext () ;
584
584
}
585
585
586
586
public Context getContext () {
Original file line number Diff line number Diff line change @@ -107,9 +107,15 @@ public Object getColumnValue(Object entity) {
107
107
Column column = TableUtils .getColumnOrId (foreignEntityType , foreignColumnName );
108
108
columnValue = column .getColumnValue (foreignEntities .get (0 ));
109
109
110
+ // 仅自动关联外键
110
111
Table table = this .getTable ();
111
- if (table != null && columnValue == null && column instanceof Id ) {
112
- table .db .saveOrUpdateAll (foreignEntities );
112
+ if (table != null && column instanceof Id ) {
113
+ for (Object foreignObj : foreignEntities ) {
114
+ Object idValue = column .getColumnValue (foreignObj );
115
+ if (idValue == null ) {
116
+ table .db .saveOrUpdate (foreignObj );
117
+ }
118
+ }
113
119
}
114
120
115
121
columnValue = column .getColumnValue (foreignEntities .get (0 ));
You can’t perform that action at this time.
0 commit comments