新增获取民族列表
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user