Browse Source

添加变更令号判断增加批复编号

laiguoran 5 years ago
parent
commit
a424c6854b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/service/change.js

+ 4 - 1
app/service/change.js

@@ -77,7 +77,10 @@ module.exports = app => {
         }
 
         async add(tenderId, userId, code, name) {
-            const count = await this.count({ tid: tenderId, code });
+            const sql = 'SELECT COUNT(*) as count FROM ?? WHERE `tid` = ? AND (`code` = ? OR `p_code` = ?)';
+            const sqlParam = [this.tableName, tenderId, code, code];
+            const codeCount = await this.db.queryOne(sql, sqlParam);
+            const count = codeCount.count;
             if (count > 0) {
                 throw '变更令号重复';
             }