mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
修复高级模型下的belongsTo的错误
This commit is contained in:
parent
121f8cfa38
commit
e00a9d7416
@ -156,7 +156,7 @@ module.exports = Model(function(){
|
||||
return mapOptions.model.initPromise().then(function(){
|
||||
mapKey = mapOptions.model.getModelName().toLowerCase() + "_id";
|
||||
mapfKey = mapOptions.model.getPk();
|
||||
var where = self.parseRelationWhere(data, mapOptions.mapKey, mapOptions.mapfKey);
|
||||
var where = self.parseRelationWhere(data, mapKey, mapfKey);
|
||||
mapOptions.model.where(where);
|
||||
return mapOptions.model.select();
|
||||
}).then(function(mapData){
|
||||
@ -229,6 +229,9 @@ module.exports = Model(function(){
|
||||
var value = data.map(function(item){
|
||||
return item[mapKey];
|
||||
});
|
||||
if (value.length === 0) {
|
||||
value = [0];
|
||||
}
|
||||
return getObject(mapfKey, ["IN", value]);
|
||||
}
|
||||
return getObject(mapfKey, data[mapKey]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user