39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package dto
|
||
|
||
import (
|
||
"case-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
|
||
}
|