|
@@ -181,17 +181,39 @@ module.exports = app => {
|
|
|
* @return {Boolean} - 删除结果
|
|
|
*/
|
|
|
async deleteTenderById(id) {
|
|
|
-
|
|
|
const updateData = {
|
|
|
status: this.status.DISABLE,
|
|
|
id,
|
|
|
};
|
|
|
-
|
|
|
const result = this.db.update(this.tableName, updateData);
|
|
|
|
|
|
return result.affectedRows > 0;
|
|
|
}
|
|
|
|
|
|
+ async deleteTenderNoBackup(id) {
|
|
|
+ const transaction = await this.db.beginTransaction();
|
|
|
+ try {
|
|
|
+ await transaction.delete(this.tableName, {id});
|
|
|
+ await transaction.delete(this.ctx.service.tenderInfo.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.ledger.tableName, {tender_id: id});
|
|
|
+ await transaction.delete(this.ctx.service.ledgerAudit.tableName, {tender_id: id});
|
|
|
+ await transaction.delete(this.ctx.service.ledgerAudit.tableName + '_copy', {tender_id: id});
|
|
|
+ await transaction.delete(this.ctx.service.pos.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.pay.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stage.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stageAudit.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stageBills.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stagePos.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stageDetail.tableName, {tid: id});
|
|
|
+ await transaction.delete(this.ctx.service.stagePay.tableName, {tid: id});
|
|
|
+ await transaction.commit();
|
|
|
+ return true;
|
|
|
+ } catch (err) {
|
|
|
+ await transaction.rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 切换标段
|
|
|
*
|