兼容了外键为null的case
This commit is contained in:
parent
477475ac8d
commit
57ec2e8931
|
|
@ -140,7 +140,7 @@ var MysqlStore = /** @class */ (function (_super) {
|
|||
// 边界,如果是toModi的对象,这里的外键确实有可能为空
|
||||
(0, assert_1.default)(schema[e].toModi || r.entityId === r[attr].id, "\u5BF9\u8C61".concat(e, "\u53D6\u6570\u636E\u65F6\uFF0C\u53D1\u73B0entityId\u4E0E\u8FDE\u63A5\u7684\u5BF9\u8C61\u7684\u4E3B\u952E\u4E0D\u4E00\u81F4\uFF0CrowId\u662F").concat(r.id, "\uFF0C\u5176entityId\u503C\u4E3A").concat(r.entityId, "\uFF0C\u8FDE\u63A5\u7684\u5BF9\u8C61\u7684\u4E3B\u952E\u4E3A").concat(r[attr].id));
|
||||
if (r[attr].id === null) {
|
||||
(0, assert_1.default)(schema[e].toModi);
|
||||
(0, assert_1.default)(schema[e].toModi || r.entityId === null);
|
||||
delete r[attr];
|
||||
continue;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ var MysqlStore = /** @class */ (function (_super) {
|
|||
// 边界,如果是toModi的对象,这里的外键确实有可能为空
|
||||
(0, assert_1.default)(schema[e].toModi || r["".concat(attr, "Id")] === r[attr].id, "\u5BF9\u8C61".concat(e, "\u53D6\u6570\u636E\u65F6\uFF0C\u53D1\u73B0\u5176\u5916\u952E\u4E0E\u8FDE\u63A5\u7684\u5BF9\u8C61\u7684\u4E3B\u952E\u4E0D\u4E00\u81F4\uFF0CrowId\u662F").concat(r.id, "\uFF0C\u5176").concat(attr, "Id\u503C\u4E3A").concat(r["".concat(attr, "Id")], "\uFF0C\u8FDE\u63A5\u7684\u5BF9\u8C61\u7684\u4E3B\u952E\u4E3A").concat(r[attr].id));
|
||||
if (r[attr].id === null) {
|
||||
(0, assert_1.default)(schema[e].toModi);
|
||||
(0, assert_1.default)(schema[e].toModi || r["".concat(attr, "Id")] === null);
|
||||
delete r[attr];
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export class MysqlStore<ED extends EntityDict & BaseEntityDict, Cxt extends Asyn
|
|||
// 边界,如果是toModi的对象,这里的外键确实有可能为空
|
||||
assert (schema[e].toModi || r.entityId === r[attr].id, `对象${<string>e}取数据时,发现entityId与连接的对象的主键不一致,rowId是${r.id},其entityId值为${r.entityId},连接的对象的主键为${r[attr].id}`);
|
||||
if (r[attr].id === null) {
|
||||
assert(schema[e].toModi);
|
||||
assert(schema[e].toModi || r.entityId === null);
|
||||
delete r[attr];
|
||||
continue;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ export class MysqlStore<ED extends EntityDict & BaseEntityDict, Cxt extends Asyn
|
|||
// 边界,如果是toModi的对象,这里的外键确实有可能为空
|
||||
assert (schema[e].toModi || r[`${attr}Id`] === r[attr].id, `对象${<string>e}取数据时,发现其外键与连接的对象的主键不一致,rowId是${r.id},其${attr}Id值为${r[`${attr}Id`]},连接的对象的主键为${r[attr].id}`);
|
||||
if (r[attr].id === null) {
|
||||
assert(schema[e].toModi);
|
||||
assert(schema[e].toModi || r[`${attr}Id`] === null);
|
||||
delete r[attr];
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue