update join
This commit is contained in:
@ -5,7 +5,7 @@ import { OrmHelper } from "../helpers/orm";
|
||||
import Joi from "joi";
|
||||
import { ILogObj, Logger } from "tslog";
|
||||
import { Language } from "../langs/lang";
|
||||
import { Paging } from "entity";
|
||||
import { Paging, User } from "entity";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { ActivityType } from "entity";
|
||||
import * as fastcsv from 'fast-csv';
|
||||
@ -96,11 +96,12 @@ export class UserActivityController {
|
||||
}
|
||||
|
||||
const res_count = userRepository.createQueryBuilder()
|
||||
.addSelect('(SELECT u.username FROM users u WHERE u.id = id_user)', 'username')
|
||||
.having(whereAttr, whereVal);
|
||||
.leftJoinAndMapOne('u.username', User, 'u', 'u.id = id_user')
|
||||
.where(whereAttr, whereVal);
|
||||
const res_list = userRepository.createQueryBuilder()
|
||||
.addSelect('(SELECT u.username FROM users u WHERE u.id = id_user)', 'username')
|
||||
.having(whereAttr, whereVal)
|
||||
// .addSelect('(SELECT u.username FROM users u WHERE u.id = id_user)', 'username')
|
||||
.leftJoinAndMapOne('u.username', User, 'u', 'u.id = id_user')
|
||||
.where(whereAttr, whereVal)
|
||||
.orderBy(param.order_field, param.order_direction)
|
||||
.offset(offset)
|
||||
.limit(param.limit);
|
||||
|
||||
Reference in New Issue
Block a user