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