add Officer view

This commit is contained in:
kittapath 2025-01-22 15:15:29 +07:00
parent 99c1ead9a1
commit debf24e5bc
3 changed files with 25 additions and 2 deletions

View file

@ -815,6 +815,13 @@ export class WorkflowController extends Controller {
let condition: any = {
isDirector: true,
orgRootId: posMasterUser.orgRootId,
orgRevisionId: posMasterUser.orgRevisionId,
};
let conditionOfficer: any = {
isDirector: true,
isOfficer: true,
orgRevisionId: posMasterUser.orgRevisionId,
};
if (type.trim().toUpperCase() == "OPERATE") {
@ -832,6 +839,7 @@ export class WorkflowController extends Controller {
condition = {
isDirector: true,
orgRootId: posMasterUser.orgRootId,
orgRevisionId: posMasterUser.orgRevisionId,
orgChild1Id: IsNull(),
orgChild2Id: IsNull(),
orgChild3Id: IsNull(),
@ -848,6 +856,7 @@ export class WorkflowController extends Controller {
condition = {
isDirector: true,
isDeputy: true,
orgRevisionId: posMasterUser.orgRevisionId,
orgChild1Id: IsNull(),
orgChild2Id: IsNull(),
orgChild3Id: IsNull(),
@ -860,7 +869,11 @@ export class WorkflowController extends Controller {
if (body.isAct == true) {
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
.createQueryBuilder("viewDirectorActing")
.andWhere(condition)
.andWhere(
new Brackets((qb) => {
qb.orWhere(condition).orWhere(conditionOfficer);
}),
)
.andWhere(
new Brackets((qb) => {
qb.orWhere(
@ -936,7 +949,11 @@ export class WorkflowController extends Controller {
} else {
const [lists, total] = await AppDataSource.getRepository(viewDirector)
.createQueryBuilder("viewDirector")
.andWhere(condition)
.andWhere(
new Brackets((qb) => {
qb.orWhere(condition).orWhere(conditionOfficer);
}),
)
.andWhere(
new Brackets((qb) => {
qb.orWhere(

View file

@ -21,6 +21,7 @@ import { ViewColumn, ViewEntity } from "typeorm";
\`posType\`.\`posTypeName\` AS \`posType\`,
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
\`orgChild1\`.\`isOfficer\` AS \`isOfficer\`,
\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
@ -113,6 +114,8 @@ export class viewDirector {
@ViewColumn()
isDeputy: boolean;
@ViewColumn()
isOfficer: boolean;
@ViewColumn()
orgRootId: string;
@ViewColumn()
orgChild1Id: string;

View file

@ -22,6 +22,7 @@ import { ViewColumn, ViewEntity } from "typeorm";
\`posType\`.\`posTypeName\` AS \`posType\`,
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
\`orgChild1\`.\`isOfficer\` AS \`isOfficer\`,
\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
@ -78,6 +79,8 @@ export class viewDirectorActing {
@ViewColumn()
isDeputy: boolean;
@ViewColumn()
isOfficer: boolean;
@ViewColumn()
isDirectorChild: boolean;
@ViewColumn()
orgRootId: string;