분할 패널에서 부서 추가 기능 구현

This commit is contained in:
dohyeons
2025-11-07 14:22:23 +09:00
parent 7835898a09
commit efaa267d78
10 changed files with 641 additions and 28 deletions

View File

@@ -165,12 +165,13 @@ export class AuthService {
const authNames = authResult.map((row) => row.auth_name).join(",");
// 3. 회사 정보 조회 (Raw Query 전환)
// Note: 현재 회사 정보는 PersonBean에 직접 사용되지 않지만 향후 확장을 위해 유지
const companyResult = await query<{ company_name: string }>(
"SELECT company_name FROM company_mng WHERE company_code = $1",
[userInfo.company_code || "ILSHIN"]
);
const companyName = companyResult.length > 0 ? companyResult[0].company_name : undefined;
// DB에서 조회한 원본 사용자 정보 상세 로그
//console.log("🔍 AuthService - DB 원본 사용자 정보:", {
// userId: userInfo.user_id,
@@ -205,6 +206,7 @@ export class AuthService {
partnerObjid: userInfo.partner_objid || undefined,
authName: authNames || undefined,
companyCode: companyCode,
companyName: companyName, // 회사명 추가
photo: userInfo.photo
? `data:image/jpeg;base64,${Buffer.from(userInfo.photo).toString("base64")}`
: undefined,

View File

@@ -231,6 +231,9 @@ class DataService {
const columns = await this.getTableColumnsSimple(tableName);
// PK 컬럼 정보 조회
const pkColumns = await this.getPrimaryKeyColumns(tableName);
// 컬럼 라벨 정보 추가
const columnsWithLabels = await Promise.all(
columns.map(async (column) => {
@@ -244,6 +247,7 @@ class DataService {
dataType: column.data_type,
isNullable: column.is_nullable === "YES",
defaultValue: column.column_default,
isPrimaryKey: pkColumns.includes(column.column_name), // PK 여부 추가
};
})
);
@@ -262,6 +266,26 @@ class DataService {
}
}
/**
* 테이블의 Primary Key 컬럼 목록 조회
*/
private async getPrimaryKeyColumns(tableName: string): Promise<string[]> {
try {
const result = await query<{ attname: string }>(
`SELECT a.attname
FROM pg_index i
JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)
WHERE i.indrelid = $1::regclass AND i.indisprimary`,
[tableName]
);
return result.map((row) => row.attname);
} catch (error) {
console.error(`PK 컬럼 조회 오류 (${tableName}):`, error);
return [];
}
}
/**
* 테이블 존재 여부 확인
*/
@@ -286,7 +310,7 @@ class DataService {
/**
* 특정 컬럼 존재 여부 확인
*/
private async checkColumnExists(
async checkColumnExists(
tableName: string,
columnName: string
): Promise<boolean> {