import { default as BaseController } from "../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { FeeBaseOneCharge } from "../../entity/finance/base/feeBaseOneCharge";
|
import { Like } from "typeorm";
|
export default class BaseOneChargeController extends BaseController {
|
//#region 获取一次性收费项默认值
|
/**
|
* 获取一次性收费项默认值
|
*/
|
@Post()
|
public async getDefaultItems() {
|
let { ctx } = this;
|
let body = ctx.body; // 接收前端发来的数据
|
let userInfo = await ctx.helper.userInfo(); // 权限
|
let userProduct_Id = userInfo.userProduct_Id; // 获取权限id
|
try {
|
// 检验ID是否存在
|
let dataList = await this.dbRead.find(FeeBaseOneCharge, {
|
where: {
|
storage_Id: body.storage_Id,
|
consignor_Id: body.consignor_Id,
|
userProduct_Id: userProduct_Id,
|
associatedTasks: Like("%" + body.associatedTasks + "%"),
|
isDefault: 1
|
},
|
select: ["feeItem_Id"]
|
});
|
|
this.info.result = true;
|
this.info.data = dataList.map(item => item.feeItem_Id);
|
} catch (error) {
|
this.info.result = false;
|
this.info.msg = "错误信息:" + error.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
}
|