This commit is contained in:
2026-08-16 15:11:38 +08:00
parent f7f6db8695
commit a85477be80
40 changed files with 761 additions and 144 deletions
+8 -2
View File
@@ -17,8 +17,14 @@ func (s *DictionaryService) ImportDictionaryJSON(ctx context.Context, raw string
Description string `json:"desc"`
Details []dto.DictionaryDetailRequest `json:"sysDictionaryDetails"`
}
if json.Unmarshal([]byte(raw), &payload) != nil || payload.Name == "" || payload.Type == "" {
return errors.New("JSON 格式错误")
if err := json.Unmarshal([]byte(raw), &payload); err != nil {
return errors.New("JSON 格式错误: " + err.Error())
}
if payload.Name == "" {
return errors.New("字典名称不能为空")
}
if payload.Type == "" {
return errors.New("字典类型不能为空")
}
dictionary := dictionaryDomain(&dto.DictionaryRequest{Name: payload.Name, Type: payload.Type, Status: payload.Status, Description: payload.Description})
details := make([]*biz.DictionaryDetail, 0, len(payload.Details))