schangxiang@126.com
2025-09-19 0821aa23eabe557c0d9ef5dbe6989c68be35d1fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}