feat: add complex query support
This commit is contained in:
parent
4941e0b560
commit
81d78b5ad2
1 changed files with 14 additions and 0 deletions
|
|
@ -65,12 +65,26 @@ export class TaskController extends Controller {
|
|||
@Query() page = 1,
|
||||
@Query() pageSize = 30,
|
||||
@Query() taskStatus?: TaskStatus,
|
||||
) {
|
||||
return this.getTaskOrderListByCriteria(req, query, page, pageSize, taskStatus);
|
||||
}
|
||||
|
||||
@Post("list")
|
||||
@Security("keycloak")
|
||||
async getTaskOrderListByCriteria(
|
||||
@Request() req: RequestWithUser,
|
||||
@Query() query: string = "",
|
||||
@Query() page = 1,
|
||||
@Query() pageSize = 30,
|
||||
@Query() taskStatus?: TaskStatus,
|
||||
@Body() body?: { code?: string[] },
|
||||
) {
|
||||
const [result, total] = await prisma.$transaction([
|
||||
prisma.taskOrder.findMany({
|
||||
where: {
|
||||
taskStatus,
|
||||
registeredBranch: { OR: permissionCondCompany(req.user) },
|
||||
code: body?.code ? { in: body.code } : undefined,
|
||||
OR: [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
{ taskName: { contains: query } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue