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
dfddde9d
Commit
dfddde9d
authored
Jul 04, 2023
by
黄智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新字典
parent
72f4ba62
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
14 deletions
+13
-14
src/bean/vo/request/dict.go
src/bean/vo/request/dict.go
+4
-4
src/controller/dict.go
src/controller/dict.go
+2
-3
src/pkg/beagle/resp/resp.go
src/pkg/beagle/resp/resp.go
+1
-1
src/service/component_dict.go
src/service/component_dict.go
+6
-6
No files found.
src/bean/vo/request/dict.go
View file @
dfddde9d
...
@@ -18,7 +18,7 @@ type AddDictReq struct {
...
@@ -18,7 +18,7 @@ type AddDictReq struct {
Class
int
`json:"class" form:"class" binding:"required,oneof=1 2 3 4 5 6 7 8 9 10 11 12 13 14"`
//组件分类(1开发语言与版本 2中间件类型与中间件 3云组件类型 4模块类型 5所属区域 6操作系统 7对象类型 8SQL类型 9调研评估结果 10任务阶段 11测试文档类型 12验收问题类型 13Q&A问题类型 14文档类型)
Class
int
`json:"class" form:"class" binding:"required,oneof=1 2 3 4 5 6 7 8 9 10 11 12 13 14"`
//组件分类(1开发语言与版本 2中间件类型与中间件 3云组件类型 4模块类型 5所属区域 6操作系统 7对象类型 8SQL类型 9调研评估结果 10任务阶段 11测试文档类型 12验收问题类型 13Q&A问题类型 14文档类型)
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
0:启用 1
:禁用)
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
1:启用 2
:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
...
@@ -28,19 +28,19 @@ type UpdateDictReq struct {
...
@@ -28,19 +28,19 @@ type UpdateDictReq struct {
Id
string
`json:"id" form:"id" binding:"required"`
//组件ID
Id
string
`json:"id" form:"id" binding:"required"`
//组件ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
0:启用 1
:禁用)
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
1:启用 2
:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
UpdatedBy
int
`json:"updated_by" `
//修改人
UpdatedBy
int
`json:"updated_by" `
//修改人
Updated
Time
jsontime
.
Time
`json:"updated_at"`
//修改时间
Updated
At
jsontime
.
Time
`json:"updated_at"`
//修改时间
}
}
type
DictManageListReq
struct
{
type
DictManageListReq
struct
{
Id
string
`json:"id" form:"id" binding:"required"`
//组件ID
Id
string
`json:"id" form:"id" binding:"required"`
//组件ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
0:启用 1
:禁用)
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(
1:启用 2
:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
...
...
src/controller/dict.go
View file @
dfddde9d
...
@@ -3,7 +3,6 @@ package controller
...
@@ -3,7 +3,6 @@ package controller
import
(
import
(
"errors"
"errors"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"github.com/spf13/cast"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header"
...
@@ -135,9 +134,9 @@ func (d Dict) Del(c *gin.Context) {
...
@@ -135,9 +134,9 @@ func (d Dict) Del(c *gin.Context) {
svc
:=
new
(
service
.
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
Ctx
=
c
//svc.User = &user
svc
.
User
=
header
.
GetUser
(
c
)
err
=
svc
.
Del
(
cast
.
ToInt
(
id
)
)
err
=
svc
.
Del
(
id
)
if
err
!=
nil
{
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
return
...
...
src/pkg/beagle/resp/resp.go
View file @
dfddde9d
...
@@ -63,7 +63,7 @@ func (r Resp) TranslateError(err error) Resp {
...
@@ -63,7 +63,7 @@ func (r Resp) TranslateError(err error) Resp {
}
}
func
(
r
Resp
)
Error
()
string
{
func
(
r
Resp
)
Error
()
string
{
return
fmt
.
Sprintf
(
"code:%d Message:%s
"
,
r
.
Code
,
r
.
Msg
)
return
fmt
.
Sprintf
(
"code:%d Message:%s
data:%v"
,
r
.
Code
,
r
.
Msg
,
r
.
Data
)
}
}
func
DecodeErr
(
err
error
,
data
interface
{})
(
int
,
string
,
interface
{})
{
func
DecodeErr
(
err
error
,
data
interface
{})
(
int
,
string
,
interface
{})
{
...
...
src/service/component_dict.go
View file @
dfddde9d
...
@@ -127,7 +127,7 @@ func (c *Dict) Add(req request.AddDictReq) (err error) {
...
@@ -127,7 +127,7 @@ func (c *Dict) Add(req request.AddDictReq) (err error) {
return
return
}
}
componentD
ict
:=
&
entity
.
Dict
{
d
ict
:=
&
entity
.
Dict
{
Id
:
util
.
GetUUID
(),
Id
:
util
.
GetUUID
(),
Class
:
req
.
Class
,
Class
:
req
.
Class
,
Name
:
req
.
Name
,
Name
:
req
.
Name
,
...
@@ -148,9 +148,9 @@ func (c *Dict) Add(req request.AddDictReq) (err error) {
...
@@ -148,9 +148,9 @@ func (c *Dict) Add(req request.AddDictReq) (err error) {
return
return
}
}
_
,
err
=
db
.
Insert
(
&
componentD
ict
)
_
,
err
=
db
.
Insert
(
d
ict
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
resp
.
DbInsertError
.
ErrorDetail
(
err
)
err
=
resp
.
DbInsertError
.
WithData
(
err
)
return
return
}
}
...
@@ -174,10 +174,10 @@ func (c *Dict) Update(req request.UpdateDictReq) (err error) {
...
@@ -174,10 +174,10 @@ func (c *Dict) Update(req request.UpdateDictReq) (err error) {
session
:=
db
.
NewSession
()
session
:=
db
.
NewSession
()
req
.
UpdatedBy
=
c
.
User
.
Id
req
.
UpdatedBy
=
c
.
User
.
Id
req
.
Updated
Time
=
jsontime
.
Time
(
time
.
Now
())
req
.
Updated
At
=
jsontime
.
Time
(
time
.
Now
())
_
,
err
=
session
.
Table
(
"dict"
)
.
_
,
err
=
session
.
Table
(
"dict"
)
.
Cols
(
"name,status,description,updated_by,updated_
time
,min_val,max_val"
)
.
Cols
(
"name,status,description,updated_by,updated_
at
,min_val,max_val"
)
.
Where
(
"id = ? and is_delete = 0"
,
req
.
Id
)
.
Update
(
&
req
)
Where
(
"id = ? and is_delete = 0"
,
req
.
Id
)
.
Update
(
&
req
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"修改字典失败!"
)
err
=
errors
.
Wrap
(
err
,
"修改字典失败!"
)
...
@@ -187,7 +187,7 @@ func (c *Dict) Update(req request.UpdateDictReq) (err error) {
...
@@ -187,7 +187,7 @@ func (c *Dict) Update(req request.UpdateDictReq) (err error) {
}
}
func
(
c
*
Dict
)
Del
(
id
int
)
(
err
error
)
{
func
(
c
*
Dict
)
Del
(
id
string
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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