From f8bce61af2e51020490960097ffb1a78bf3cb645 Mon Sep 17 00:00:00 2001 From: sdjdd Date: Tue, 24 Oct 2023 12:10:28 +0800 Subject: [PATCH] debug: print query conditions --- next/api/src/orm/clickhouse.ts | 1 + next/api/src/router/ticket.ts | 4 ++++ next/api/src/ticket/export/ExportTicket.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/next/api/src/orm/clickhouse.ts b/next/api/src/orm/clickhouse.ts index 106dd889e..7a35c1912 100644 --- a/next/api/src/orm/clickhouse.ts +++ b/next/api/src/orm/clickhouse.ts @@ -205,6 +205,7 @@ export class ClickHouse { async find() { const sql = this.toSqlString(); + console.log('clickhouse sql', sql); return await ClickHouse.findWithSqlStr(sql); } diff --git a/next/api/src/router/ticket.ts b/next/api/src/router/ticket.ts index 72bdf5d29..7cc5ddd45 100644 --- a/next/api/src/router/ticket.ts +++ b/next/api/src/router/ticket.ts @@ -263,6 +263,8 @@ router.get( }); } + console.log('find ticket query', finalQuery.getRawCondition()); + let tickets: Ticket[]; if (params.count && !count) { const result = await finalQuery.findAndCount(currentUser.getAuthOptions()); @@ -393,6 +395,8 @@ router.get( const queryString = conditions.join(' AND '); + console.log({ queryString }); + const searchQuery = new AV.SearchQuery('Ticket'); searchQuery.queryString(queryString); sortFields?.forEach(({ key, order }) => { diff --git a/next/api/src/ticket/export/ExportTicket.ts b/next/api/src/ticket/export/ExportTicket.ts index c2e2a62e1..9db47ab41 100644 --- a/next/api/src/ticket/export/ExportTicket.ts +++ b/next/api/src/ticket/export/ExportTicket.ts @@ -345,6 +345,7 @@ export default async function exportTicket({ params, sortItems, utcOffset, date const exportFileManager = new ExportFileManager(fileName); debug('count tickets'); const [query, containFields] = await createBaseTicketQuery(rest, sortItems); + console.log('export query condition', query.getRawCondition()); const count = await query.count(authOptions); debug('count: ', count); const categoryMap = await getCategories();