Commit ab896cb2 by 王昆

gsb

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