|
@@ -376,13 +376,13 @@ module.exports = app => {
|
|
|
* @returns {Promise<*>}
|
|
|
*/
|
|
|
async getNoticeTender(projectId, auditorId, noticeTime) {
|
|
|
- const sql = 'SELECT la.`audit_id`, la.`times`, la.`audit_order`, la.`end_time`, la.`status`, t.`id`, t.`name`, t.`project_id`, t.`type`, t.`user_id`, ' +
|
|
|
+ const sql = 'SELECT * FROM (SELECT la.`audit_id`, la.`times`, la.`audit_order`, la.`end_time`, la.`status`, t.`id`, t.`name`, t.`project_id`, t.`type`, t.`user_id`, ' +
|
|
|
' pa.name As `lu_name`, pa.role As `lu_role`, pa.company As `lu_company`' +
|
|
|
' FROM (SELECT * FROM ?? WHERE `user_id` = ? OR `id` in (SELECT `tender_id` FROM ?? WHERE `audit_id` = ? GROUP BY `tender_id`)) As t ' +
|
|
|
' LEFT JOIN ?? As la ON la.`tender_id` = t.`id`' +
|
|
|
' LEFT JOIN ?? As pa ON la.`audit_id` = pa.`id`' +
|
|
|
' WHERE la.`end_time` > ? and t.`project_id` = ?' +
|
|
|
- ' ORDER By la.`end_time` DESC';
|
|
|
+ ' ORDER By la.`end_time` DESC LIMIT 1000) as new_t GROUP BY new_t.`id` ORDER BY new_t.`end_time`';
|
|
|
const sqlParam = [this.ctx.service.tender.tableName, auditorId, this.tableName, auditorId, this.tableName, this.ctx.service.projectAccount.tableName,
|
|
|
noticeTime, projectId];
|
|
|
return await this.db.query(sql, sqlParam);
|