|
@@ -191,7 +191,7 @@ module.exports = app => {
|
|
|
switch (status) {
|
|
|
case 0:// 包含你的所有变更令
|
|
|
sql = 'SELECT a.* FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
|
- '(a.uid = ? OR (a.status != 1 AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))) ORDER BY a.in_time DESC';
|
|
|
+ '(a.uid = ? OR (a.status != 1 AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))) ORDER BY a.in_time DESC';
|
|
|
sqlParam = [this.tableName, tenderId, this.ctx.session.sessionUser.accountId,
|
|
|
this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId];
|
|
|
break;
|
|
@@ -210,7 +210,7 @@ module.exports = app => {
|
|
|
case 3:// 已完成(所有的)
|
|
|
case 4:// 终止(所有的)
|
|
|
sql = 'SELECT a.* FROM ?? AS a WHERE ' +
|
|
|
- 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid) AND ' +
|
|
|
+ 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) AND ' +
|
|
|
'a.status = ? AND a.tid = ? ORDER BY a.in_time DESC';
|
|
|
sqlParam = [this.tableName, this.ctx.service.changeAudit.tableName,
|
|
|
this.ctx.session.sessionUser.accountId, status, tenderId];
|
|
@@ -237,7 +237,7 @@ module.exports = app => {
|
|
|
switch (status) {
|
|
|
case 0:// 包含你的所有变更令
|
|
|
const sql = 'SELECT count(*) AS count FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
|
- '(a.uid = ? OR a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))';
|
|
|
+ '(a.uid = ? OR a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))';
|
|
|
const sqlParam = [this.tableName, tenderId, this.ctx.session.sessionUser.accountId,
|
|
|
this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId];
|
|
|
const result = await this.db.query(sql, sqlParam);
|
|
@@ -250,7 +250,7 @@ module.exports = app => {
|
|
|
});
|
|
|
case 5:// 待上报(所有的)PS:取未上报和退回的变更令
|
|
|
const sql2 = 'SELECT count(*) AS count FROM ?? AS a WHERE ' +
|
|
|
- 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid) ' +
|
|
|
+ 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) ' +
|
|
|
'AND (a.status = 1 OR a.status = 5) AND a.tid = ?';
|
|
|
const sqlParam2 = [this.tableName, this.ctx.service.changeAudit.tableName,
|
|
|
this.ctx.session.sessionUser.accountId, tenderId];
|
|
@@ -260,7 +260,7 @@ module.exports = app => {
|
|
|
case 3:// 已完成(所有的)
|
|
|
case 4:// 终止(所有的)
|
|
|
const sql3 = 'SELECT count(*) AS count FROM ?? AS a WHERE ' +
|
|
|
- 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid) AND a.status = ? AND a.tid = ?';
|
|
|
+ 'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) AND a.status = ? AND a.tid = ?';
|
|
|
const sqlParam3 = [this.tableName, this.ctx.service.changeAudit.tableName,
|
|
|
this.ctx.session.sessionUser.accountId, status, tenderId];
|
|
|
const result3 = await this.db.query(sql3, sqlParam3);
|