odf_new/sql/v1.2.0/03_create_odf_audit_logs.sql
zpc 827d7a4367
All checks were successful
continuous-integration/drone/push Build is passing
feat(odf): Add marker pole management and audit logging for v1.2.0
- Add marker pole CRUD functionality with database tables (odf_marker_poles, odf_marker_pole_images)
- Implement marker pole API endpoints and service layer with data isolation by department
- Add UniApp pages for marker pole list, detail, and creation workflows
- Add Vue management backend pages for marker pole and audit log management
- Implement audit logging system via ActionFilter to track all business entity modifications
- Extend search API to include marker poles in results alongside cables and faults
- Add OdfAuditLogsController and service for querying audit trail data
- Update optical box detail page with left-right frame color scheme (green-orange)
- Add cable type page as entry point for marker poles and fault lists
- Create database migration scripts for v1.2.0 schema and permissions
- Add DeptDataScopeHelper for department-based data access control
- Update MCP settings to disable SQL Server connection and fix formatting
- Add marker pole service integration in UniApp with COS image upload support
2026-04-18 22:50:15 +08:00

29 lines
1.4 KiB
SQL

-- =============================================
-- ODF v1.2.0 - 创建审计日志表 odf_audit_logs
-- 需求: 8.1, 8.2
-- =============================================
CREATE TABLE odf_audit_logs (
Id INT IDENTITY(1,1) PRIMARY KEY,
TableName NVARCHAR(100) NOT NULL, -- 操作的表名
RecordId INT NULL, -- 操作的记录ID
OperationType NVARCHAR(20) NOT NULL, -- 操作类型: INSERT/UPDATE/DELETE
OperatorId BIGINT NOT NULL, -- 操作人用户ID
OperatorName NVARCHAR(100) NULL, -- 操作人用户名
SourceClient NVARCHAR(20) NOT NULL, -- 操作来源: App/Admin
OldData NVARCHAR(MAX) NULL, -- 修改前数据 (JSON)
NewData NVARCHAR(MAX) NULL, -- 修改后数据 (JSON)
OperationTime DATETIME DEFAULT GETDATE(), -- 操作时间
DeptId BIGINT NULL, -- 操作人所属部门
Remark NVARCHAR(500) NULL -- 备注
);
-- 索引:按操作时间范围查询
CREATE INDEX IX_odf_audit_logs_OperationTime ON odf_audit_logs(OperationTime);
-- 索引:按表名筛选
CREATE INDEX IX_odf_audit_logs_TableName ON odf_audit_logs(TableName);
-- 索引:按操作类型筛选
CREATE INDEX IX_odf_audit_logs_OperationType ON odf_audit_logs(OperationType);