计划监控增加计划名
This commit is contained in:
@@ -53,14 +53,20 @@ func NewListDeviceCommandLogResponse(data []models.DeviceCommandLog, total int64
|
||||
}
|
||||
|
||||
// NewListPlanExecutionLogResponse 从模型数据创建列表响应 DTO
|
||||
func NewListPlanExecutionLogResponse(data []models.PlanExecutionLog, total int64, page, pageSize int) *ListPlanExecutionLogResponse {
|
||||
dtos := make([]PlanExecutionLogDTO, len(data))
|
||||
for i, item := range data {
|
||||
func NewListPlanExecutionLogResponse(planLogs []models.PlanExecutionLog, plans []models.Plan, total int64, page, pageSize int) *ListPlanExecutionLogResponse {
|
||||
planId2Name := make(map[uint]string)
|
||||
for _, plan := range plans {
|
||||
planId2Name[plan.ID] = plan.Name
|
||||
}
|
||||
|
||||
dtos := make([]PlanExecutionLogDTO, len(planLogs))
|
||||
for i, item := range planLogs {
|
||||
dtos[i] = PlanExecutionLogDTO{
|
||||
ID: item.ID,
|
||||
CreatedAt: item.CreatedAt,
|
||||
UpdatedAt: item.UpdatedAt,
|
||||
PlanID: item.PlanID,
|
||||
PlanName: planId2Name[item.PlanID],
|
||||
Status: item.Status,
|
||||
StartedAt: item.StartedAt,
|
||||
EndedAt: item.EndedAt,
|
||||
|
||||
@@ -91,6 +91,7 @@ type PlanExecutionLogDTO struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PlanID uint `json:"plan_id"`
|
||||
PlanName string `json:"plan_name"`
|
||||
Status models.ExecutionStatus `json:"status"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
EndedAt time.Time `json:"ended_at"`
|
||||
|
||||
Reference in New Issue
Block a user