no message
This commit is contained in:
parent
46b3df5e95
commit
e43c29dbc4
9 changed files with 1095 additions and 29 deletions
|
|
@ -30,11 +30,15 @@ import {
|
|||
getRoleMappings,
|
||||
getUserCount,
|
||||
enableStatus,
|
||||
getUserCountOrg,
|
||||
getUserListOrg,
|
||||
} from "../keycloak";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import { IsNull } from "typeorm";
|
||||
import { IsNull, Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
// import * as io from "../lib/websocket";
|
||||
// import elasticsearch from "../elasticsearch";
|
||||
// import { StorageFolder } from "../interfaces/storage-fs";
|
||||
|
|
@ -239,7 +243,89 @@ export class KeycloakController extends Controller {
|
|||
}
|
||||
|
||||
@Get("user")
|
||||
async getUserList(@Query() first = "", @Query() max = "", @Query() search = "") {
|
||||
async getUserList(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query() first = "",
|
||||
@Query() max = "",
|
||||
@Query() search = "",
|
||||
) {
|
||||
// let _data: any = {
|
||||
// root: null,
|
||||
// child1: null,
|
||||
// child2: null,
|
||||
// child3: null,
|
||||
// child4: null,
|
||||
// };
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// _data = await new permission().PermissionOrgList(request, "SYS_ORG");
|
||||
// }
|
||||
// const profiles = await this.profileRepo
|
||||
// .createQueryBuilder("profile")
|
||||
// .leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
// .leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
// .leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
// .leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
// .leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
// .leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
// .andWhere(
|
||||
// _data.root != undefined && _data.root != null
|
||||
// ? _data.root[0] != null
|
||||
// ? `current_holders.orgRootId IN (:...root)`
|
||||
// : `current_holders.orgRootId is null`
|
||||
// : "1=1",
|
||||
// {
|
||||
// root: _data.root,
|
||||
// },
|
||||
// )
|
||||
// .andWhere(
|
||||
// _data.child1 != undefined && _data.child1 != null
|
||||
// ? _data.child1[0] != null
|
||||
// ? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is null`
|
||||
// : "1=1",
|
||||
// {
|
||||
// child1: _data.child1,
|
||||
// },
|
||||
// )
|
||||
// .andWhere(
|
||||
// _data.child2 != undefined && _data.child2 != null
|
||||
// ? _data.child2[0] != null
|
||||
// ? `current_holders.orgChild2Id IN (:...child2)`
|
||||
// : `current_holders.orgChild2Id is null`
|
||||
// : "1=1",
|
||||
// {
|
||||
// child2: _data.child2,
|
||||
// },
|
||||
// )
|
||||
// .andWhere(
|
||||
// _data.child3 != undefined && _data.child3 != null
|
||||
// ? _data.child3[0] != null
|
||||
// ? `current_holders.orgChild3Id IN (:...child3)`
|
||||
// : `current_holders.orgChild3Id is null`
|
||||
// : "1=1",
|
||||
// {
|
||||
// child3: _data.child3,
|
||||
// },
|
||||
// )
|
||||
// .andWhere(
|
||||
// _data.child4 != undefined && _data.child4 != null
|
||||
// ? _data.child4[0] != null
|
||||
// ? `current_holders.orgChild4Id IN (:...child4)`
|
||||
// : `current_holders.orgChild4Id is null`
|
||||
// : "1=1",
|
||||
// {
|
||||
// child4: _data.child4,
|
||||
// },
|
||||
// )
|
||||
// .andWhere({ keycloak: Not(IsNull()) })
|
||||
// .andWhere({ keycloak: Not("") })
|
||||
// .select("profile.keycloak", "keycloak")
|
||||
// .getRawMany();
|
||||
// let keycloakArray = profiles.map((p) => p.keycloak);
|
||||
|
||||
// const total = await getUserCountOrg(first, max, search, keycloakArray);
|
||||
// const result = await getUserListOrg(first, max, search, keycloakArray);
|
||||
|
||||
const total = await getUserCount(first, max, search);
|
||||
const result = await getUserList(first, max, search);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue