75 lines
3.0 KiB
Go
75 lines
3.0 KiB
Go
package models
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
// CompositeCase 复合案例定义
|
|
type CompositeCase struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
Name string `json:"name" gorm:"not null;size:255"`
|
|
Description string `json:"description" gorm:"type:text"`
|
|
Status string `json:"status" gorm:"default:'active';size:50"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
|
|
// 关联的步骤
|
|
Steps []CompositeCaseStep `json:"steps" gorm:"foreignKey:CompositeCaseID"`
|
|
}
|
|
|
|
// CompositeCaseStep 复合案例步骤
|
|
type CompositeCaseStep struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
CompositeCaseID uint `json:"composite_case_id" gorm:"not null"`
|
|
StepOrder int `json:"step_order" gorm:"not null"`
|
|
StepName string `json:"step_name" gorm:"not null;size:255"`
|
|
StepDescription string `json:"step_description" gorm:"type:text"`
|
|
StepType string `json:"step_type" gorm:"not null;size:100"`
|
|
ActivityName string `json:"activity_name" gorm:"not null;size:255"`
|
|
ParametersJson string `json:"parameters_json" gorm:"type:json"`
|
|
IsRequired bool `json:"is_required" gorm:"default:true"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// CreateCompositeCaseRequest 创建复合案例请求
|
|
type CreateCompositeCaseRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
Status string `json:"status"`
|
|
Steps []CreateCompositeCaseStepRequest `json:"steps"`
|
|
}
|
|
|
|
// CreateCompositeCaseStepRequest 创建复合案例步骤请求
|
|
type CreateCompositeCaseStepRequest struct {
|
|
StepOrder int `json:"step_order" binding:"required"`
|
|
StepName string `json:"step_name" binding:"required"`
|
|
StepDescription string `json:"step_description"`
|
|
StepType string `json:"step_type" binding:"required"`
|
|
ActivityName string `json:"activity_name"`
|
|
ParametersJson string `json:"parameters_json"`
|
|
IsRequired bool `json:"is_required"`
|
|
}
|
|
|
|
// UpdateCompositeCaseRequest 更新复合案例请求
|
|
type UpdateCompositeCaseRequest struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Status string `json:"status"`
|
|
Steps []UpdateCompositeCaseStepRequest `json:"steps"`
|
|
}
|
|
|
|
// UpdateCompositeCaseStepRequest 更新复合案例步骤请求
|
|
type UpdateCompositeCaseStepRequest struct {
|
|
ID uint `json:"id"`
|
|
StepOrder int `json:"step_order"`
|
|
StepName string `json:"step_name"`
|
|
StepDescription string `json:"step_description"`
|
|
StepType string `json:"step_type"`
|
|
ActivityName string `json:"activity_name"`
|
|
ParametersJson string `json:"parameters_json"`
|
|
IsRequired bool `json:"is_required"`
|
|
}
|