|
@@ -77,7 +77,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async getAuditors(detailId, times = 1) {
|
|
|
const sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, pa.`mobile`, pa.`telephone`, la.`times`, la.`order`, la.`status`, la.`opinion`, la.`begin_time`, la.`end_time`, g.`sort` ' +
|
|
|
- 'FROM ?? AS la, ?? AS pa, (SELECT t1.`aid`,(@i:=@i+1) as `sort` FROM (SELECT t.`aid` FROM (select `aid` from ?? WHERE `td_id` = ? AND `times` = ? ORDER BY `order` LIMIT 200) t GROUP BY t.`aid`) t1, (select @i:=0) as it) as g ' +
|
|
|
+ 'FROM ?? AS la, ?? AS pa, (SELECT t1.`aid`,(@i:=@i+1) as `sort` FROM (SELECT t.`aid`, t.`order` FROM (select `aid`, `order` from ?? WHERE `td_id` = ? AND `times` = ? ORDER BY `order` LIMIT 200) t GROUP BY t.`aid` ORDER BY t.`order`) t1, (select @i:=0) as it) as g ' +
|
|
|
'WHERE la.`td_id` = ? and la.`times` = ? and la.`aid` = pa.`id` and g.`aid` = la.`aid` order by la.`order`';
|
|
|
const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.tableName, detailId, times, detailId, times];
|
|
|
const result = await this.db.query(sql, sqlParam);
|
|
@@ -87,6 +87,7 @@ module.exports = app => {
|
|
|
for (const i in result) {
|
|
|
result[i].max_sort = count.num;
|
|
|
}
|
|
|
+ console.log(result);
|
|
|
return result;
|
|
|
}
|
|
|
|