hepa-calc-api/api/dto/BaseNation.go

39 lines
986 B
Go

package dto
import (
"fmt"
"hepa-calc-api/api/model"
)
// BaseNationDto 基础数据-民族
type BaseNationDto struct {
NationId string `json:"nation_id"` // 主键id
AppIden string `json:"app_iden"` // app唯一标识
NationName string `json:"nation_name"` // 民族名称
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// GetBaseNationListDto 列表-基础数据-分类表
func GetBaseNationListDto(m []*model.BaseNation) []*BaseNationDto {
// 处理返回值
responses := make([]*BaseNationDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := &BaseNationDto{
NationId: fmt.Sprintf("%d", v.NationId),
AppIden: v.AppIden,
NationName: v.NationName,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}