Commit b88f6a14 by 王昆

gsb

parent e02e387c
......@@ -19,5 +19,25 @@ class EtemplateDao extends Dao{
var list = await this.customQuery(sql, {queryLike: "%" + name + "%"});
return list || [];
}
async findMapByIds(ids, attrs) {
var result = {};
if(!ids || ids.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM c_etemplate where id IN (:ids) ";
var list = await this.customQuery(sql, {ids:ids});
if(!list || list.length == 0) {
return result;
}
for(var item of list) {
result[item.id] = item;
}
return result;
}
}
module.exports=EtemplateDao;
......@@ -12,6 +12,7 @@ class EcontractService extends ServiceBase {
constructor() {
super(ServiceBase.getDaoName(EcontractService));
this.etemplateSve = system.getObject("service.etemplateSve");
this.etemplateDao = system.getObject("db.etemplateDao");
this.ecompanyDao = system.getObject("db.ecompanyDao");
this.usereaccountDao = system.getObject("db.usereaccountDao")
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
......@@ -352,6 +353,7 @@ class EcontractService extends ServiceBase {
}
await this.setEaccount(page.rows);
await this.setCompany(page.rows);
await this.setEtemplate(page.rows);
}
return page;
}
......@@ -388,6 +390,21 @@ class EcontractService extends ServiceBase {
}
}
async setEtemplate(list) {
if (!list || list.length == 0) {
return;
}
var ids = [];
for (var item of list) {
ids.push(item.etemplate_id || 0);
}
var templateMap = await this.etemplateDao.findMapByIds(ids, " id, nameA ");
for (var item of list) {
item.template = templateMap[item.etemplate_id];
}
}
async findInfo(obj) {
obj = obj || {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment