diff --git a/src/bean/vo/response/dict.go b/src/bean/vo/response/dict.go index 15c8f5e05169c659fcff13b639f836354abed0e6..1968355005238b9eb2bf7cafd8050dc87f2805a1 100644 --- a/src/bean/vo/response/dict.go +++ b/src/bean/vo/response/dict.go @@ -1,15 +1,19 @@ package response +import "gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime" + type DictListRes struct { - Id string `json:"id" column:"id"` //主键ID - Class int `json:"class" column:"class"` //组件分类(1开发语言与版本 2中间件类型与中间件 3云组件类型 4模块类型 5所属区域 6操作系统 7对象类型 8SQL类型 9调研评估结果 10任务阶段 11测试文档类型 12验收问题类型 13Q&A问题类型 14文档类型) - Name string `json:"name" column:"name"` //组件名称 - ParentId string `json:"parent_id" column:"parent_id"` //父id - Status int `json:"status"` - MinVal string `json:"min_val" ` //最大值 - MaxVal string `json:"max_val"` - Sort int `json:"sort"` - Children []*DictListRes `json:"children,omitempty"` + Id string `json:"id" column:"id"` //主键ID + Class int `json:"class" column:"class"` //组件分类(1开发语言与版本 2中间件类型与中间件 3云组件类型 4模块类型 5所属区域 6操作系统 7对象类型 8SQL类型 9调研评估结果 10任务阶段 11测试文档类型 12验收问题类型 13Q&A问题类型 14文档类型) + Name string `json:"name" column:"name"` //组件名称 + ParentId string `json:"parent_id" column:"parent_id"` //父id + Status int `json:"status"` + Description string `json:"description"` + UpdatedAt jsontime.Time `json:"updated_at"` + MinVal string `json:"min_val" ` //最大值 + MaxVal string `json:"max_val"` + Sort int `json:"sort"` + Children []*DictListRes `json:"children,omitempty"` } //type ComponentDictTreeRes struct { diff --git a/src/controller/dict.go b/src/controller/dict.go index 07ea42fe0f2aaebf58fc44f66a49b5d32c4ad435..aeb67a7decfddfdcae5273547700ad8e81a929af 100644 --- a/src/controller/dict.go +++ b/src/controller/dict.go @@ -194,7 +194,7 @@ func (d Dict) DictSort(c *gin.Context) { SendJsonResponse(c, resp.OK, "") } -func (d Dict) UpdateDictionaryState(c *gin.Context) { +func (d Dict) UpdateStatus(c *gin.Context) { id := c.Query("id") status := c.Query("status") if id == "" || status == "" { @@ -204,7 +204,7 @@ func (d Dict) UpdateDictionaryState(c *gin.Context) { svc := new(service.Dict) svc.Ctx = c svc.User = header.GetUser(c) - total, err := svc.UpdateDictionaryState(id, status) + total, err := svc.UpdateStatus(id, status) if err != nil { SendJsonResponse(c, err, nil) return diff --git a/src/router/dict.go b/src/router/dict.go index b1e780e46ce6863396d19c28305dfe7dc637603e..20b6cca0ce27e7c6ed71dec393ce625456cfc5b1 100644 --- a/src/router/dict.go +++ b/src/router/dict.go @@ -15,14 +15,14 @@ func initDictRoute(e *gin.Engine) { //系统字典 dict := new(controller.Dict) - base.POST("", dict.Add) //新增字典 - base.PUT("", dict.Update) //修改字典 - base.DELETE("", dict.Del) //删除字典 - base.GET("", dict.List) //字典列表 - base.GET("/tree", dict.DictTree) //字典列表-树结构 - base.GET("/classList", dict.ClassList) //字典分类列表 - base.PUT("/sort", dict.DictSort) //字典排序 - base.PUT("//state", dict.UpdateDictionaryState) //字典排序 + base.POST("", dict.Add) //新增字典 + base.PUT("", dict.Update) //修改字典 + base.DELETE("", dict.Del) //删除字典 + base.GET("", dict.List) //字典列表 + base.GET("/tree", dict.DictTree) //字典列表-树结构 + base.GET("/classList", dict.ClassList) //字典分类列表 + base.PUT("/sort", dict.DictSort) //字典排序 + base.PUT("/status", dict.UpdateStatus) //字典排序 //base.GET("/manage_list", dict.ManageList) //字典管理列表 diff --git a/src/service/component_dict.go b/src/service/component_dict.go index 9e54fbd1288ad2d9613e82c4a21a0bbf65282977..56ad4ddea3db8a5e6ddc070499bbf1c0d358d6d7 100644 --- a/src/service/component_dict.go +++ b/src/service/component_dict.go @@ -64,7 +64,7 @@ func (c *Dict) List(req request.DictReq) (dictListRes []*response.DictListRes, c } session := db.NewSession() - session.Select("id,class,name,parent_id,status,min_val,max_val,sort").Table("dict") + session.Select("id,class,name,parent_id,status,min_val,max_val,sort,description,updated_at").Table("dict") session.Where("is_delete = 0 ") if req.Id != "" { @@ -268,7 +268,7 @@ func (c *Dict) DictSort(req []request.DictSortInput) error { return err } -func (d *Dict) UpdateDictionaryState(id string, status string) (total int64, err error) { +func (d *Dict) UpdateStatus(id string, status string) (total int64, err error) { db, err := client.GetDbClient() if err != nil { return 0, resp.DbConnectError.ErrorDetail(err) @@ -279,7 +279,7 @@ func (d *Dict) UpdateDictionaryState(id string, status string) (total int64, err "updated_by": d.User.Id, }) if err != nil { - conf.Logger.Error("Update UpdateDictionaryState ", zap.String("erro", err.Error())) + conf.Logger.Error("Update UpdateStatus ", zap.String("erro", err.Error())) return 0, resp.DbUpdateError.ErrorDetail(err) } return