odf_new/server/ZR.Service/Business/OdfAuditLogsService.cs
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

53 lines
1.9 KiB
C#

using Infrastructure.Attribute;
using ZR.Model;
using ZR.Model.Business;
using ZR.Model.Business.Dto;
using ZR.Repository;
using ZR.Service.Business.IBusinessService;
namespace ZR.Service.Business
{
/// <summary>
/// 审计日志Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IOdfAuditLogsService), ServiceLifetime = LifeTime.Transient)]
public class OdfAuditLogsService : BaseService<OdfAuditLogs>, IOdfAuditLogsService
{
/// <summary>
/// 分页查询审计日志列表,支持时间范围、操作类型、表名筛选
/// </summary>
public PagedInfo<OdfAuditLogs> GetList(OdfAuditLogsQueryDto parm)
{
var predicate = Expressionable.Create<OdfAuditLogs>();
predicate = predicate.AndIF(parm.BeginTime != null, it => it.OperationTime >= parm.BeginTime);
predicate = predicate.AndIF(parm.EndTime != null, it => it.OperationTime <= parm.EndTime);
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.OperationType), it => it.OperationType == parm.OperationType);
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.TableName), it => it.TableName == parm.TableName);
var total = 0;
var list = Queryable()
.Where(predicate.ToExpression())
.OrderByDescending(it => it.OperationTime)
.ToPageList(parm.PageNum, parm.PageSize, ref total);
return new PagedInfo<OdfAuditLogs>
{
Result = list,
TotalNum = total,
PageIndex = parm.PageNum,
PageSize = parm.PageSize
};
}
/// <summary>
/// 写入审计日志记录
/// </summary>
public int AddLog(OdfAuditLogs log)
{
log.OperationTime ??= DateTime.Now;
return Insert(log);
}
}
}