|
@@ -126,18 +126,20 @@ module.exports = app => {
|
|
|
}
|
|
|
// 数据库创建新增节点数据
|
|
|
await this.transaction.insert(this.tableName, bills);
|
|
|
- await this.transaction.insert(this.ctx.service.revisePos.tableName, pos);
|
|
|
+ if (pos.length > 0) {
|
|
|
+ await this.transaction.insert(this.ctx.service.revisePos.tableName, pos);
|
|
|
+ }
|
|
|
this._cacheMaxLid(tid, maxId + data.length);
|
|
|
await this.transaction.commit();
|
|
|
} catch (err) {
|
|
|
- await this.transaction.rollback();
|
|
|
+ await this.transaction.rollback();console.log(lastChild);
|
|
|
throw err;
|
|
|
}
|
|
|
|
|
|
// 查询应返回的结果
|
|
|
result.ledger.create = await this.getDataById(newIds);
|
|
|
if (!lastChild) {
|
|
|
- result.ledger.update = await this.getDataByKid(select.id);
|
|
|
+ result.ledger.update = await this.getDataById(select.id);
|
|
|
}
|
|
|
result.pos = await this.ctx.service.revisePos.getDataByLid(tid, newIds);
|
|
|
return result;
|
|
@@ -215,7 +217,9 @@ module.exports = app => {
|
|
|
await this._updateChildrenOrder(tid, select.ledger_pid, select.order+1);
|
|
|
// 数据库创建新增节点数据
|
|
|
await this.transaction.insert(this.tableName, bills);
|
|
|
- await this.transaction.insert(this.ctx.service.revisePos.tableName, pos);
|
|
|
+ if (pos.length > 0) {
|
|
|
+ await this.transaction.insert(this.ctx.service.revisePos.tableName, pos);
|
|
|
+ }
|
|
|
this._cacheMaxLid(tid, maxId + data.length);
|
|
|
await this.transaction.commit();
|
|
|
} catch (err) {
|