|
@@ -88,12 +88,11 @@ module.exports = app => {
|
|
|
order_sort;
|
|
|
const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.tableName, stageId, times, stageId, times];
|
|
|
const result = await this.db.query(sql, sqlParam);
|
|
|
- const sql2 = 'SELECT COUNT(a.`aid`) as num, a.`max_order` FROM (SELECT `aid`, Max(`order`) as max_order FROM ?? WHERE `sid` = ? AND `times` = ? GROUP BY `aid`) as a';
|
|
|
+ const sql2 = 'SELECT COUNT(a.`aid`) as num FROM (SELECT `aid` FROM ?? WHERE `sid` = ? AND `times` = ? GROUP BY `aid`) as a';
|
|
|
const sqlParam2 = [this.tableName, stageId, times];
|
|
|
const count = await this.db.queryOne(sql2, sqlParam2);
|
|
|
for (const i in result) {
|
|
|
result[i].max_sort = count.num;
|
|
|
- result[i].max_order = count.max_order;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -1307,6 +1306,21 @@ module.exports = app => {
|
|
|
throw err;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async getFinalAuditGroup(stageId, times) {
|
|
|
+ const sql =
|
|
|
+ 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, pa.`mobile`, pa.`telephone`, pa.`sign_path`, la.`times`, la.`sid`, la.`aid`, Max(la.`order`) as max_order ' +
|
|
|
+ 'FROM ?? AS la, ?? AS pa ' +
|
|
|
+ 'WHERE la.`sid` = ? and la.`times` = ? and la.`aid` = pa.`id` GROUP BY la.`aid` ORDER BY la.`order`';
|
|
|
+ const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, times];
|
|
|
+ const result = await this.db.query(sql, sqlParam);
|
|
|
+ for (const r of result) {
|
|
|
+ const auditor = await this.getDataByCondition({sid: stageId, times: r.times, order: r.max_order});
|
|
|
+ r.opinion = auditor.opinion;
|
|
|
+ r.en_time = auditor.end_time;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return StageAudit;
|