diff --git a/src/transaction/entities/coa.entity.ts b/src/transaction/entities/coa.entity.ts index 23de4f0..f60bb7a 100644 --- a/src/transaction/entities/coa.entity.ts +++ b/src/transaction/entities/coa.entity.ts @@ -17,11 +17,13 @@ export class COA extends BaseModel { amount: number; @Column({ + type: 'uuid', nullable: true, }) user: string; @Column({ + type: 'uuid', nullable: true, }) relatedUser: string; diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 987c3bb..eb97d80 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -126,6 +126,12 @@ export class UsersService { 'user_detail', `user_detail.user = user.id`, ) + .leftJoinAndMapOne( + 'user.coa', + COA, + 'coa', + `coa.user = user.id and coa.type = '0'`, + ) .select([ 'user.id', 'user.username', @@ -133,6 +139,7 @@ export class UsersService { 'roles.id', 'roles.name', 'user_detail', + 'coa.amount', ]); const data = await baseQuery @@ -175,6 +182,12 @@ export class UsersService { 'user_detail', `user_detail.user = user.id`, ) + .leftJoinAndMapOne( + 'user.coa', + COA, + 'coa', + `coa.user = user.id and coa.type = '0'`, + ) .select([ 'user.id', 'user.username', @@ -182,6 +195,7 @@ export class UsersService { 'roles.id', 'roles.name', 'user_detail', + 'coa.amount', ]); const data = await baseQuery