|
@@ -340,7 +340,7 @@ module.exports = app => {
|
|
|
case 0: // 包含你的所有变更令
|
|
|
sql =
|
|
|
'SELECT a.* FROM ?? AS a WHERE a.tid = ? AND' +
|
|
|
- ' (a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ ' (a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid))' +
|
|
|
' OR a.status = ?)' + stateSql;
|
|
|
sqlParam = [
|
|
@@ -364,7 +364,7 @@ module.exports = app => {
|
|
|
sql =
|
|
|
'SELECT a.* FROM ?? AS a WHERE' +
|
|
|
' (a.status = ? OR a.status = ? OR a.status = ?) AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid)))');
|
|
|
sqlParam = [
|
|
|
this.tableName,
|
|
@@ -385,7 +385,7 @@ module.exports = app => {
|
|
|
sql =
|
|
|
'SELECT a.* FROM ?? AS a WHERE ' +
|
|
|
'a.status = ? AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid)');
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid)');
|
|
|
sqlParam = [this.tableName, status, tenderId, this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId];
|
|
|
break;
|
|
|
case 3: // 已完成(所有的)
|
|
@@ -433,7 +433,7 @@ module.exports = app => {
|
|
|
case 0: // 包含你的所有变更令
|
|
|
const sql =
|
|
|
'SELECT count(*) AS count FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
|
- '(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ '(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid))' +
|
|
|
' OR a.status = ? )' + stateSql;
|
|
|
const sqlParam = [
|
|
@@ -464,7 +464,7 @@ module.exports = app => {
|
|
|
const sql2 =
|
|
|
'SELECT count(*) AS count FROM ?? AS a WHERE' +
|
|
|
' (a.status = ? OR a.status = ? OR a.status = ?) AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid)))');
|
|
|
const sqlParam2 = [
|
|
|
this.tableName,
|
|
@@ -486,7 +486,7 @@ module.exports = app => {
|
|
|
const sql3 =
|
|
|
'SELECT count(*) AS count FROM ?? AS a WHERE ' +
|
|
|
'a.status = ? AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid)');
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid)');
|
|
|
const sqlParam3 = [this.tableName, status, tenderId, this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId];
|
|
|
const result3 = await this.db.query(sql3, sqlParam3);
|
|
|
return result3[0].count;
|
|
@@ -512,7 +512,7 @@ module.exports = app => {
|
|
|
case 0: // 包含你的所有变更令
|
|
|
const sql =
|
|
|
'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
|
- '(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ '(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid))' +
|
|
|
' OR a.status = ? )' + stateSql;
|
|
|
const sqlParam = [
|
|
@@ -538,7 +538,7 @@ module.exports = app => {
|
|
|
const sql2 =
|
|
|
'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE' +
|
|
|
' (a.status = ? OR a.status = ? OR a.status = ?) AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid))' +
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND ((a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid))' +
|
|
|
' OR (a.status = ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times - 1 = b.times GROUP BY b.cid)))');
|
|
|
const sqlParam2 = [
|
|
|
this.tableName,
|
|
@@ -560,7 +560,7 @@ module.exports = app => {
|
|
|
const sql3 =
|
|
|
'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE ' +
|
|
|
'a.status = ? AND a.tid = ?' + stateSql +
|
|
|
- (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid)');
|
|
|
+ (this.ctx.session.sessionUser.is_admin ? '' : ' AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? GROUP BY b.cid)');
|
|
|
const sqlParam3 = [this.tableName, status, tenderId, this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId];
|
|
|
const result3 = await this.db.query(sql3, sqlParam3);
|
|
|
return result3[0].total_price ? result3[0].total_price : 0;
|