case-admin-api/api/dto/ProjectPlatformDynamicItem.go
2025-03-07 17:23:50 +08:00

39 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
import (
"case-admin-api/api/model"
"fmt"
)
// ProjectPlatformDynamicItemDto 关联平台-白名单-动态-明细
type ProjectPlatformDynamicItemDto struct {
ItemId string `gorm:"column:item_id;type:bigint(19);primary_key;comment:主键id" json:"item_id"`
WhiteDynamicId string `gorm:"column:white_dynamic_id;type:bigint(19);comment:关联动态白名单id;NOT NULL" json:"white_dynamic_id"`
ItemValue string `gorm:"column:item_value;type:varchar(255);comment:明细值area:省份 level:医院等级 title:职称 department:科室 url:地址栏 类型间以-链接)" json:"item_value"`
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
}
// GetProjectPlatformDynamicItemListDto 列表
func GetProjectPlatformDynamicItemListDto(m []*model.ProjectPlatformDynamicItem) []*ProjectPlatformDynamicItemDto {
// 处理返回值
responses := make([]*ProjectPlatformDynamicItemDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := &ProjectPlatformDynamicItemDto{
ItemId: fmt.Sprintf("%d", v.ItemId),
WhiteDynamicId: fmt.Sprintf("%d", v.WhiteDynamicId),
ItemValue: v.ItemValue,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}