|
@@ -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 '变更令号重复';
|
|
|
}
|