From f800e743795ceed7503b4360ac23c9de3883353f Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 28 Feb 2025 14:50:26 +0700 Subject: [PATCH] add sql_mode --- src/controllers/ProfileSalaryController.ts | 3 +++ src/controllers/ReportController.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index b9ea0520..8c7c6e33 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -82,6 +82,9 @@ export class ProfileSalaryController extends Controller { @Get("tenure/{profileId}") public async getPositionTenure(@Path() profileId: string, @Request() req: RequestWithUser) { + const sql_mode = await AppDataSource.query( + "SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));", + ); const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [profileId]); const _position = position.length > 0 ? position[0] : []; const mapPosition = diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 77a8a2ec..a7be928d 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -259,6 +259,9 @@ export class ReportController extends Controller { tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax"; //xxxxxxxxxxxx } + const sql_mode = await AppDataSource.query( + "SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));", + ); const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer) .createQueryBuilder("registryOfficer") .where(nodeCondition, {