updated appoint by permission
This commit is contained in:
parent
ad5c953aa8
commit
ff2edc685c
3 changed files with 43 additions and 3 deletions
|
|
@ -12,6 +12,7 @@ import {
|
||||||
Post,
|
Post,
|
||||||
Path,
|
Path,
|
||||||
Delete,
|
Delete,
|
||||||
|
Query,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { setLogDataDiff } from "../interfaces/utils";
|
import { setLogDataDiff } from "../interfaces/utils";
|
||||||
|
|
||||||
|
|
@ -42,11 +43,40 @@ export class AppointController extends Controller {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Get("")
|
@Get("")
|
||||||
async GetList(@Request() request: RequestWithUser) {
|
async GetList(
|
||||||
|
@Query() keyword: string = "",
|
||||||
|
@Query("page") page: number = 1,
|
||||||
|
@Query("pageSize") pageSize: number = 10,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
await new permission().PermissionList(request, "SYS_PROBATION");
|
await new permission().PermissionList(request, "SYS_PROBATION");
|
||||||
|
const _data = await new permission().PermissionOrgList(request, "SYS_PROBATION");
|
||||||
|
|
||||||
|
const conditions: any = {};
|
||||||
|
|
||||||
|
if (_data.root != undefined && _data.root != null && _data.root[0] != null) {
|
||||||
|
conditions.root = _data.root;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_data.child1 != undefined && _data.child1 != null && _data.child1[0] != null) {
|
||||||
|
conditions.child1 = _data.child1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_data.child2 != undefined && _data.child2 != null && _data.child2[0] != null) {
|
||||||
|
conditions.child2 = _data.child2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_data.child3 != undefined && _data.child3 != null && _data.child3[0] != null) {
|
||||||
|
conditions.child3 = _data.child3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_data.child4 != undefined && _data.child4 != null && _data.child4[0] != null) {
|
||||||
|
conditions.child4 = _data.child4;
|
||||||
|
}
|
||||||
|
|
||||||
const appoint = await this.appointRepository.find({
|
const appoint = await this.appointRepository.find({
|
||||||
where: { createdUserId: request.user.sub },
|
relations: ["personal"],
|
||||||
|
where: { personal: conditions },
|
||||||
});
|
});
|
||||||
|
|
||||||
return new HttpSuccess(appoint);
|
return new HttpSuccess(appoint);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn } from "typeorm";
|
import { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn, OneToOne } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
import { AppointDirector } from "./AppointDirector";
|
import { AppointDirector } from "./AppointDirector";
|
||||||
|
import { Personal } from "./Personal";
|
||||||
|
|
||||||
@Entity("appoint")
|
@Entity("appoint")
|
||||||
export class Appoint extends EntityBase {
|
export class Appoint extends EntityBase {
|
||||||
|
|
@ -37,6 +38,10 @@ export class Appoint extends EntityBase {
|
||||||
@OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint)
|
@OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint)
|
||||||
@JoinColumn({ name: "id" })
|
@JoinColumn({ name: "id" })
|
||||||
directors: AppointDirector[];
|
directors: AppointDirector[];
|
||||||
|
|
||||||
|
@OneToOne(() => Personal, (personal: Personal) => personal.personal_id)
|
||||||
|
@JoinColumn({ name: "profileId" })
|
||||||
|
personal: Personal;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateAppoint {
|
export class CreateAppoint {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, OneToMany } from "typeorm";
|
import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, OneToMany } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
import { Assign } from "./Assign";
|
import { Assign } from "./Assign";
|
||||||
|
import { Appoint } from "./Appoint";
|
||||||
|
|
||||||
@Entity("personal")
|
@Entity("personal")
|
||||||
export class Personal extends EntityBase {
|
export class Personal extends EntityBase {
|
||||||
|
|
@ -119,6 +120,10 @@ export class Personal extends EntityBase {
|
||||||
@OneToMany(() => Assign, (assign: Assign) => assign.personal_id)
|
@OneToMany(() => Assign, (assign: Assign) => assign.personal_id)
|
||||||
@JoinColumn({ name: "personal_id" })
|
@JoinColumn({ name: "personal_id" })
|
||||||
assign: Assign[];
|
assign: Assign[];
|
||||||
|
|
||||||
|
@OneToOne(() => Appoint, (appoint: Appoint) => appoint.profileId)
|
||||||
|
@JoinColumn({ name: "personal_id" })
|
||||||
|
appoint: Appoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePersonal {
|
export class CreatePersonal {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue