|
|
@@ -171,17 +171,17 @@ module.exports = app => {
|
|
|
// 未参与,但可见的标段
|
|
|
') ORDER BY CONVERT(t.`name` USING GBK) ASC';
|
|
|
sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, subProject.id, session.sessionUser.accountId,
|
|
|
- this.ctx.service.ledgerAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.stageAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.auditAss.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.settleAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.phasePayAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.changeAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.reviseAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.materialAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.advanceAudit.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.tenderTourist.tableName, session.sessionUser.accountId,
|
|
|
- this.ctx.service.tenderAss.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.ledgerAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.stageAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.auditAss.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.settleAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.phasePayAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.changeAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.reviseAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.materialAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.advanceAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.tenderTourist.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.tenderAss.tableName, session.sessionUser.accountId,
|
|
|
];
|
|
|
}
|
|
|
const list = await this.db.query(sql, sqlParam);
|
|
|
@@ -262,7 +262,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async getManageTenderList(projectId) {
|
|
|
- return await this.ctx.service.tender.getAllDataByCondition({ where: { project_id: projectId }});
|
|
|
+ return await this.ctx.service.tender.getAllDataByCondition({ where: { project_id: projectId } });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -359,13 +359,13 @@ module.exports = app => {
|
|
|
const result = await conn.update(this.tableName, rowData);
|
|
|
await conn.commit();
|
|
|
return result.affectedRows > 0;
|
|
|
- } catch(err) {
|
|
|
+ } catch (err) {
|
|
|
await conn.rollback();
|
|
|
throw err;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async batchUpdate (data) {
|
|
|
+ async batchUpdate(data) {
|
|
|
const validFields = ['filter_budget', 'filter_fund'];
|
|
|
const updateData = [];
|
|
|
for (const d of data) {
|
|
|
@@ -589,7 +589,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async saveApiRela(tid, updateData) {
|
|
|
- await this.db.update(this.tableName, updateData, {where: { id: tid } });
|
|
|
+ await this.db.update(this.tableName, updateData, { where: { id: tid } });
|
|
|
}
|
|
|
|
|
|
async saveTenderData(tid, updateData) {
|
|
|
@@ -617,6 +617,26 @@ module.exports = app => {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ async getDataByIds(ids, columns = commonQueryColumns) {
|
|
|
+ if (!ids || !Array.isArray(ids) || ids.length === 0) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建IN查询
|
|
|
+ const placeholders = ids.map(() => '?').join(',');
|
|
|
+ const sql = `SELECT ${columns.join(', ')} FROM ${this.tableName} WHERE id IN (${placeholders})`;
|
|
|
+ const result = await this.db.query(sql, ids);
|
|
|
+
|
|
|
+ // 处理category字段,如果存在的话
|
|
|
+ if (this._.includes(columns, 'category')) {
|
|
|
+ for (const item of result) {
|
|
|
+ item.category = item.category && item.category !== '' ? JSON.parse(item.category) : null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取你所参与的施工标段的列表
|
|
|
*
|
|
|
@@ -653,7 +673,7 @@ module.exports = app => {
|
|
|
' t.id IN ( SELECT ca.`tid` FROM ?? As ca WHERE ca.`uid` = ?)' +
|
|
|
' ORDER BY CONVERT(t.`name` USING GBK) ASC';
|
|
|
sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, session.sessionProject.id, this.ctx.subProject.id,
|
|
|
- this.ctx.service.constructionAudit.tableName, session.sessionUser.accountId,
|
|
|
+ this.ctx.service.constructionAudit.tableName, session.sessionUser.accountId,
|
|
|
];
|
|
|
}
|
|
|
const list = await this.db.query(sql, sqlParam);
|
|
|
@@ -700,7 +720,7 @@ module.exports = app => {
|
|
|
' t.id IN ( SELECT ca.`tid` FROM ?? As ca WHERE ca.`uid` = ?)' +
|
|
|
' AND t.`spid` = ? ORDER BY CONVERT(t.`name` USING GBK) ASC';
|
|
|
sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, session.sessionProject.id,
|
|
|
- this.ctx.service.contractAudit.tableName, session.sessionUser.accountId, this.ctx.subProject.id,
|
|
|
+ this.ctx.service.contractAudit.tableName, session.sessionUser.accountId, this.ctx.subProject.id,
|
|
|
];
|
|
|
}
|
|
|
const list = await this.db.query(sql, sqlParam);
|