271 lines
5.3 KiB
Markdown
271 lines
5.3 KiB
Markdown
|
# FEMS 데이터베이스 구조
|
||
|
|
||
|
## 1. 핵심 엔티티
|
||
|
|
||
|
### Company (기업)
|
||
|
|
||
|
- **설명**: 최상위 기업 정보 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- name (String)
|
||
|
- businessNumber (String, Unique)
|
||
|
- address, tel, email
|
||
|
- representative
|
||
|
- isActive (Boolean)
|
||
|
- contractStartDate, contractEndDate
|
||
|
|
||
|
### Branch (지점/공장)
|
||
|
|
||
|
- **설명**: 기업의 지점 및 공장 정보
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (UUID, FK)
|
||
|
- name, address, tel
|
||
|
- isActive (Boolean)
|
||
|
|
||
|
### User (사용자)
|
||
|
|
||
|
- **설명**: 시스템 사용자 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId, departmentId (FK)
|
||
|
- username, password
|
||
|
- name, email, phone
|
||
|
- role (Enum)
|
||
|
- isActive, lastLoginAt
|
||
|
|
||
|
### Equipment (설비)
|
||
|
|
||
|
- **설명**: 설비 기본 정보
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId, zoneId (FK)
|
||
|
- name, model, manufacturer
|
||
|
- type (Enum)
|
||
|
- specifications (JSON)
|
||
|
- installationDate, lastMaintenance
|
||
|
|
||
|
## 2. 계약/과금 관리
|
||
|
|
||
|
### Contract (계약)
|
||
|
|
||
|
- **설명**: 서비스 계약 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (FK)
|
||
|
- contractNumber (Unique)
|
||
|
- status (Enum)
|
||
|
- startDate, endDate
|
||
|
- totalAmount, paymentTerms
|
||
|
- termsConditions (JSON)
|
||
|
|
||
|
### ContractDetail (계약 상세)
|
||
|
|
||
|
- **설명**: 계약 세부사항
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- contractId (FK)
|
||
|
- serviceType
|
||
|
- specifications (JSON)
|
||
|
- unitPrice, quantity
|
||
|
|
||
|
## 3. 조직 관리
|
||
|
|
||
|
### Department (부서)
|
||
|
|
||
|
- **설명**: 부서 정보 (계층 구조)
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- parentId (UUID, Self-referential)
|
||
|
- name, description
|
||
|
- isActive
|
||
|
|
||
|
### Role (권한)
|
||
|
|
||
|
- **설명**: 권한 그룹 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (FK)
|
||
|
- name, description
|
||
|
- permissions (JSON)
|
||
|
- isActive
|
||
|
|
||
|
### UserRole (사용자-권한 매핑)
|
||
|
|
||
|
- **설명**: 사용자와 권한 연결
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- userId, roleId (FK)
|
||
|
|
||
|
## 4. 에너지 관리
|
||
|
|
||
|
### EnergyUsage (사용량)
|
||
|
|
||
|
- **설명**: 실시간 에너지 사용량
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- timestamp
|
||
|
- electricity, gas, water, steam
|
||
|
|
||
|
### EnergyCost (비용)
|
||
|
|
||
|
- **설명**: 에너지 비용 정보
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- year, month
|
||
|
- category (Enum)
|
||
|
- amount, usage, unitPrice
|
||
|
|
||
|
### EnergyTarget (목표)
|
||
|
|
||
|
- **설명**: 에너지 절감 목표
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- year, month, category
|
||
|
- targetUsage, targetCost
|
||
|
|
||
|
### EnergyPrediction (예측)
|
||
|
|
||
|
- **설명**: 에너지 사용량 예측
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- modelType, parameters (JSON)
|
||
|
- accuracy, lastTrainingDate
|
||
|
- status, validationMetrics
|
||
|
|
||
|
## 5. 설비 관리
|
||
|
|
||
|
### Zone (구역)
|
||
|
|
||
|
- **설명**: 공장 내 구역 정보
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- branchId (FK)
|
||
|
- name, description
|
||
|
- area (Float)
|
||
|
|
||
|
### EquipmentData (설비 데이터)
|
||
|
|
||
|
- **설명**: 설비 실시간 데이터
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- equipmentId (FK)
|
||
|
- timestamp
|
||
|
- parameters, measurements (JSON)
|
||
|
|
||
|
### MaintenanceLog (정비 이력)
|
||
|
|
||
|
- **설명**: 설비 정비 이력
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- equipmentId (FK)
|
||
|
- type, status (Enum)
|
||
|
- scheduledDate, completionDate
|
||
|
- description, findings, actions
|
||
|
- parts, cost, personnelInfo (JSON)
|
||
|
|
||
|
## 6. 모니터링/알람
|
||
|
|
||
|
### AlarmRule (알람 규칙)
|
||
|
|
||
|
- **설명**: 알람 규칙 설정
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId, branchId (FK)
|
||
|
- severity (Enum)
|
||
|
- conditions, actions (JSON)
|
||
|
- schedule, notificationConfig
|
||
|
|
||
|
### Alert (알람)
|
||
|
|
||
|
- **설명**: 알람 이력
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- type (Enum)
|
||
|
- message
|
||
|
- read (Boolean)
|
||
|
- companyId, branchId (FK)
|
||
|
|
||
|
## 7. 대시보드
|
||
|
|
||
|
### Dashboard (대시보드)
|
||
|
|
||
|
- **설명**: 대시보드 설정
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- userId (FK)
|
||
|
- name, description
|
||
|
- layout, isDefault
|
||
|
|
||
|
### Widget (위젯)
|
||
|
|
||
|
- **설명**: 위젯 구성
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- dashboardId (FK)
|
||
|
- type, title
|
||
|
- configuration (JSON)
|
||
|
- position, size
|
||
|
- refreshInterval
|
||
|
|
||
|
## 8. 시스템 설정
|
||
|
|
||
|
### SystemSetting (환경 설정)
|
||
|
|
||
|
- **설명**: 시스템 환경 설정
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (FK)
|
||
|
- category, key
|
||
|
- value, description
|
||
|
- dataType (Enum)
|
||
|
- isSystem
|
||
|
|
||
|
### ApiKey (API 인증)
|
||
|
|
||
|
- **설명**: API 인증 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (FK)
|
||
|
- keyName, apiKey
|
||
|
- permissions (JSON)
|
||
|
- expiryDate, lastUsedAt
|
||
|
- ipRestrictions
|
||
|
|
||
|
## 9. 보고서 관리
|
||
|
|
||
|
### ReportTemplate (보고서 템플릿)
|
||
|
|
||
|
- **설명**: 보고서 템플릿 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- companyId (FK)
|
||
|
- name, description
|
||
|
- type (Enum: daily/weekly/monthly/quarterly/yearly/custom)
|
||
|
- configuration (JSON)
|
||
|
- scheduleConfig (JSON)
|
||
|
- version
|
||
|
|
||
|
### Report (보고서)
|
||
|
|
||
|
- **설명**: 생성된 보고서 관리
|
||
|
- **주요 필드**:
|
||
|
- id (UUID, PK)
|
||
|
- templateId, companyId, branchId (FK)
|
||
|
- generatedBy, approvedBy (FK)
|
||
|
- title, reportDate
|
||
|
- status (Enum: draft/generated/approved/published)
|
||
|
- data (JSON)
|
||
|
- format (Enum: pdf/excel/html)
|
||
|
- approvedAt, publishedAt
|
||
|
- storageUrl
|
||
|
|
||
|
---
|
||
|
|
||
|
**Note**: 모든 테이블은 created_at, updated_at 타임스탬프를 포함합니다.
|