Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
c31ca2e5
Commit
c31ca2e5
authored
Jul 06, 2023
by
黄智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典调整
parent
9ab57916
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
22 deletions
+26
-22
src/bean/vo/response/dict.go
src/bean/vo/response/dict.go
+13
-9
src/controller/dict.go
src/controller/dict.go
+2
-2
src/router/dict.go
src/router/dict.go
+8
-8
src/service/component_dict.go
src/service/component_dict.go
+3
-3
No files found.
src/bean/vo/response/dict.go
View file @
c31ca2e5
package
response
package
response
import
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
type
DictListRes
struct
{
type
DictListRes
struct
{
Id
string
`json:"id" column:"id"`
//主键ID
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文档类型)
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"`
//组件名称
Name
string
`json:"name" column:"name"`
//组件名称
ParentId
string
`json:"parent_id" column:"parent_id"`
//父id
ParentId
string
`json:"parent_id" column:"parent_id"`
//父id
Status
int
`json:"status"`
Status
int
`json:"status"`
MinVal
string
`json:"min_val" `
//最大值
Description
string
`json:"description"`
MaxVal
string
`json:"max_val"`
UpdatedAt
jsontime
.
Time
`json:"updated_at"`
Sort
int
`json:"sort"`
MinVal
string
`json:"min_val" `
//最大值
Children
[]
*
DictListRes
`json:"children,omitempty"`
MaxVal
string
`json:"max_val"`
Sort
int
`json:"sort"`
Children
[]
*
DictListRes
`json:"children,omitempty"`
}
}
//type ComponentDictTreeRes struct {
//type ComponentDictTreeRes struct {
...
...
src/controller/dict.go
View file @
c31ca2e5
...
@@ -194,7 +194,7 @@ func (d Dict) DictSort(c *gin.Context) {
...
@@ -194,7 +194,7 @@ func (d Dict) DictSort(c *gin.Context) {
SendJsonResponse
(
c
,
resp
.
OK
,
""
)
SendJsonResponse
(
c
,
resp
.
OK
,
""
)
}
}
func
(
d
Dict
)
Update
DictionaryState
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
Update
Status
(
c
*
gin
.
Context
)
{
id
:=
c
.
Query
(
"id"
)
id
:=
c
.
Query
(
"id"
)
status
:=
c
.
Query
(
"status"
)
status
:=
c
.
Query
(
"status"
)
if
id
==
""
||
status
==
""
{
if
id
==
""
||
status
==
""
{
...
@@ -204,7 +204,7 @@ func (d Dict) UpdateDictionaryState(c *gin.Context) {
...
@@ -204,7 +204,7 @@ func (d Dict) UpdateDictionaryState(c *gin.Context) {
svc
:=
new
(
service
.
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
svc
.
User
=
header
.
GetUser
(
c
)
total
,
err
:=
svc
.
Update
DictionaryState
(
id
,
status
)
total
,
err
:=
svc
.
Update
Status
(
id
,
status
)
if
err
!=
nil
{
if
err
!=
nil
{
SendJsonResponse
(
c
,
err
,
nil
)
SendJsonResponse
(
c
,
err
,
nil
)
return
return
...
...
src/router/dict.go
View file @
c31ca2e5
...
@@ -15,14 +15,14 @@ func initDictRoute(e *gin.Engine) {
...
@@ -15,14 +15,14 @@ func initDictRoute(e *gin.Engine) {
//系统字典
//系统字典
dict
:=
new
(
controller
.
Dict
)
dict
:=
new
(
controller
.
Dict
)
base
.
POST
(
""
,
dict
.
Add
)
//新增字典
base
.
POST
(
""
,
dict
.
Add
)
//新增字典
base
.
PUT
(
""
,
dict
.
Update
)
//修改字典
base
.
PUT
(
""
,
dict
.
Update
)
//修改字典
base
.
DELETE
(
""
,
dict
.
Del
)
//删除字典
base
.
DELETE
(
""
,
dict
.
Del
)
//删除字典
base
.
GET
(
""
,
dict
.
List
)
//字典列表
base
.
GET
(
""
,
dict
.
List
)
//字典列表
base
.
GET
(
"/tree"
,
dict
.
DictTree
)
//字典列表-树结构
base
.
GET
(
"/tree"
,
dict
.
DictTree
)
//字典列表-树结构
base
.
GET
(
"/classList"
,
dict
.
ClassList
)
//字典分类列表
base
.
GET
(
"/classList"
,
dict
.
ClassList
)
//字典分类列表
base
.
PUT
(
"/sort"
,
dict
.
DictSort
)
//字典排序
base
.
PUT
(
"/sort"
,
dict
.
DictSort
)
//字典排序
base
.
PUT
(
"/
/state"
,
dict
.
UpdateDictionaryState
)
//字典排序
base
.
PUT
(
"/
status"
,
dict
.
UpdateStatus
)
//字典排序
//base.GET("/manage_list", dict.ManageList) //字典管理列表
//base.GET("/manage_list", dict.ManageList) //字典管理列表
...
...
src/service/component_dict.go
View file @
c31ca2e5
...
@@ -64,7 +64,7 @@ func (c *Dict) List(req request.DictReq) (dictListRes []*response.DictListRes, c
...
@@ -64,7 +64,7 @@ func (c *Dict) List(req request.DictReq) (dictListRes []*response.DictListRes, c
}
}
session
:=
db
.
NewSession
()
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 "
)
session
.
Where
(
"is_delete = 0 "
)
if
req
.
Id
!=
""
{
if
req
.
Id
!=
""
{
...
@@ -268,7 +268,7 @@ func (c *Dict) DictSort(req []request.DictSortInput) error {
...
@@ -268,7 +268,7 @@ func (c *Dict) DictSort(req []request.DictSortInput) error {
return
err
return
err
}
}
func
(
d
*
Dict
)
Update
DictionaryState
(
id
string
,
status
string
)
(
total
int64
,
err
error
)
{
func
(
d
*
Dict
)
Update
Status
(
id
string
,
status
string
)
(
total
int64
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
0
,
resp
.
DbConnectError
.
ErrorDetail
(
err
)
...
@@ -279,7 +279,7 @@ func (d *Dict) UpdateDictionaryState(id string, status string) (total int64, err
...
@@ -279,7 +279,7 @@ func (d *Dict) UpdateDictionaryState(id string, status string) (total int64, err
"updated_by"
:
d
.
User
.
Id
,
"updated_by"
:
d
.
User
.
Id
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
conf
.
Logger
.
Error
(
"Update Update
DictionaryState
"
,
zap
.
String
(
"erro"
,
err
.
Error
()))
conf
.
Logger
.
Error
(
"Update Update
Status
"
,
zap
.
String
(
"erro"
,
err
.
Error
()))
return
0
,
resp
.
DbUpdateError
.
ErrorDetail
(
err
)
return
0
,
resp
.
DbUpdateError
.
ErrorDetail
(
err
)
}
}
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment