wangzhibo
6 天以前 3f249e399659dcd09d3fe58071b146e50e45c17f
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
import { Inject } from "@midwayjs/core";
import { CoolController, BaseController } from "@cool-midway/core";
import { RecycleAppointmentEntity } from "../../entity/recycleappointment";
import { RecycleAppointmentService } from "../../service/recycleappointment";
 
/**
 * 回收预约-应用端
 */
@CoolController({
  api: ["add", "info", "page"],
  entity: RecycleAppointmentEntity,
  service: RecycleAppointmentService,
  pageQueryOp: {
    fieldEq: ["a.status", "a.campusUserId"],
    addOrderBy: {
      createTime: "DESC",
    },
    where: async (ctx) => {
      const { tab } = ctx.request.body;
      if (tab === "done") {
        return [["a.status = :st", { st: "已完成" }]];
      }
      if (tab === "booked") {
        return [["a.status != :st", { st: "已完成" }]];
      }
      return [];
    },
  },
})
export class AppRecycleAppointmentController extends BaseController {
  @Inject()
  recycleAppointmentService: RecycleAppointmentService;
}