| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date 2023/7/3
- * @version
- */
- module.exports = app => {
- class StdExtraList extends app.BaseService {
- /**
- * 构造函数
- *
- * @param {Object} ctx - egg全局变量
- * @return {void}
- */
- constructor(ctx) {
- super(ctx);
- this.tableName = 'std_extra_list';
- }
- async getList(subType) {
- return await this.getAllDataByCondition({ columns: ['id', 'name'], where: { sub_type: subType } });
- }
- async getSpecList() {
- const result = await this.getAllDataByCondition({ columns: ['id', 'name'], where: { sub_type: 0 } });
- for (const r of result) {
- const detail = await this.ctx.service.stdExtra.getAllDataByCondition({ columns: ['spec', 'value'], where: { list_id: r.id }, orders:[['order', 'asc']]});
- r.spec = detail.map(x => { return x.spec });
- r.value = detail.map(x => { return x.value });
- }
- return result;
- }
- }
- return StdExtraList;
- };
|