Commit ab896cb2 by 王昆

gsb

parent a0effc17
...@@ -159,6 +159,9 @@ class ActionAPI extends APIBase { ...@@ -159,6 +159,9 @@ class ActionAPI extends APIBase {
case "invoicecontent": case "invoicecontent":
opResult = await this.invoicecontentSve.apiGetById(action_body); opResult = await this.invoicecontentSve.apiGetById(action_body);
break; break;
case "invoicecontentAll":
opResult = await this.invoicecontentSve.getAll(action_body);
break;
// 阿里短信服务 // 阿里短信服务
case "sendSms": //发送短信 case "sendSms": //发送短信
......
...@@ -4,5 +4,10 @@ class InvoicecontentDao extends Dao{ ...@@ -4,5 +4,10 @@ class InvoicecontentDao extends Dao{
constructor(){ constructor(){
super(Dao.getModelName(InvoicecontentDao)); super(Dao.getModelName(InvoicecontentDao));
} }
async getByEnabled() {
let sql = "SELECT id, `name` FROM `d_invoicecontent` WHERE isEnabled = 1";
return this.customQuery(sql);
}
} }
module.exports=InvoicecontentDao; module.exports=InvoicecontentDao;
...@@ -89,14 +89,16 @@ class InvoicecontentService extends ServiceBase { ...@@ -89,14 +89,16 @@ class InvoicecontentService extends ServiceBase {
await this.dao.bulkDelete(ids); await this.dao.bulkDelete(ids);
} }
async getAll(params) {
let list = await this.dao.getByEnabled(1) || [];
return system.getResultSuccess(list);
}
async invoiceList(params) { async invoiceList(params) {
console.log(JSON.stringify(params)); console.log(JSON.stringify(params));
var currentPage = Number(params.currentPage || 1); var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10); var pageSize = Number(params.pageSize || 10);
var where = {isEnabled: true}; var where = {};
if (params.domicileId) {
where.domicile_id = params.domicileId;
}
if (params.name) { if (params.name) {
where.name = { where.name = {
[this.db.Op.like]: "%" + decodeURIComponent(params.name) + "%" [this.db.Op.like]: "%" + decodeURIComponent(params.name) + "%"
...@@ -105,7 +107,7 @@ class InvoicecontentService extends ServiceBase { ...@@ -105,7 +107,7 @@ class InvoicecontentService extends ServiceBase {
var orderby = [ var orderby = [
["id", 'desc'] ["id", 'desc']
]; ];
var attributes = ["id", "name"]; var attributes = ["id", "name", "isEnabled", "created_at"];
let res = await this.dao.getPageList(currentPage, pageSize, where, orderby, attributes); let res = await this.dao.getPageList(currentPage, pageSize, where, orderby, attributes);
return res; return res;
} }
......
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