|
@@ -333,6 +333,12 @@ class TreeService extends Service {
|
|
|
async _getMaxLid(mid) {
|
|
|
const cacheKey = this.setting.keyPre + mid;
|
|
|
let maxId = parseInt(await this.cache.get(cacheKey));
|
|
|
+ // 判断是否存在变更新增部位maxId,有则取两者最大值
|
|
|
+ const changeReviseCacheKey = 'change_ledger_maxLid2:' + mid;
|
|
|
+ const changeReviseMaxId = await this.cache.get(changeReviseCacheKey);
|
|
|
+ if (changeReviseMaxId) {
|
|
|
+ maxId = !maxId ? parseInt(changeReviseMaxId) : Math.max(maxId, parseInt(changeReviseMaxId));
|
|
|
+ }
|
|
|
if (!maxId) {
|
|
|
const sql = 'SELECT Max(??) As max_id FROM ?? Where ' + this.setting.mid + ' = ?';
|
|
|
const sqlParam = [this.setting.kid, this.tableName, mid];
|