| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | 
							- 'use strict';
 
- /**
 
-  * 版本数据模型
 
-  *
 
-  * @author CaiAoLin
 
-  * @date 2017/10/25
 
-  * @version
 
-  */
 
- module.exports = app => {
 
-     class ShenpiAudit extends app.BaseService {
 
-         /**
 
-          * 构造函数
 
-          *
 
-          * @param {Object} ctx - egg全局变量
 
-          * @return {void}
 
-          */
 
-         constructor(ctx) {
 
-             super(ctx);
 
-             this.tableName = 'shenpi_audit';
 
-         }
 
-         async getAudit(tid, type, status) {
 
-             const sql = 'SELECT sp.audit_id, pa.name FROM ?? AS sp LEFT JOIN ?? AS pa ON sp.audit_id = pa.id' +
 
-                 ' WHERE sp.tid = ? AND sp.sp_type = ? AND sp.sp_status = ?';
 
-             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tid, type, status];
 
-             return await this.db.queryOne(sql, sqlParam);
 
-         }
 
-         async getAuditList(tid, type, status) {
 
-             const sql = 'SELECT sp.audit_id, pa.name FROM ?? AS sp LEFT JOIN ?? AS pa ON sp.audit_id = pa.id' +
 
-                 ' WHERE sp.tid = ? AND sp.sp_type = ? AND sp.sp_status = ? ORDER BY sp.id ASC';
 
-             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tid, type, status];
 
-             return await this.db.query(sql, sqlParam);
 
-         }
 
-         async addAudit(data) {
 
-             const insertData = {
 
-                 tid: this.ctx.tender.id,
 
-                 sp_type: data.code,
 
-                 sp_status: data.status,
 
-                 audit_id: data.audit_id,
 
-             };
 
-             const result = await this.db.insert(this.tableName, insertData);
 
-             return result.effectRows === 1;
 
-         }
 
-         async removeAudit(data) {
 
-             const delData = {
 
-                 tid: this.ctx.tender.id,
 
-                 sp_type: data.code,
 
-                 sp_status: data.status,
 
-                 audit_id: data.audit_id,
 
-             };
 
-             return await this.db.delete(this.tableName, delData);
 
-         }
 
-     }
 
-     return ShenpiAudit;
 
- };
 
 
  |