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
6caff425
Commit
6caff425
authored
Jul 05, 2023
by
李科
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
6a02848b
7bce6f49
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
0 deletions
+59
-0
src/bean/vo/request/dict.go
src/bean/vo/request/dict.go
+5
-0
src/controller/dict.go
src/controller/dict.go
+25
-0
src/router/dict.go
src/router/dict.go
+1
-0
src/service/component_dict.go
src/service/component_dict.go
+28
-0
No files found.
src/bean/vo/request/dict.go
View file @
6caff425
...
...
@@ -45,3 +45,8 @@ type DictManageListReq struct {
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
}
type
DictSortInput
struct
{
Id
string
`json:"id"`
//id
Sort
int
`json:"sort"`
//排序
}
src/controller/dict.go
View file @
6caff425
...
...
@@ -169,6 +169,31 @@ func (d Dict) ClassList(c *gin.Context) {
SendJsonResponse
(
c
,
resp
.
OK
,
classList
)
}
func
(
d
Dict
)
DictSort
(
c
*
gin
.
Context
)
{
var
(
err
error
req
[]
request
.
DictSortInput
)
err
=
c
.
ShouldBind
(
&
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
err
=
svc
.
DictSort
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
""
)
}
// List 组件列表
//func (d Dict) ManageList(c *gin.Context) {
//
...
...
src/router/dict.go
View file @
6caff425
...
...
@@ -21,6 +21,7 @@ func initDictRoute(e *gin.Engine) {
base
.
GET
(
""
,
dict
.
List
)
//字典列表
base
.
GET
(
"/tree"
,
dict
.
DictTree
)
//字典列表-树结构
base
.
GET
(
"/classList"
,
dict
.
ClassList
)
//字典分类列表
base
.
PUT
(
"/sort"
,
dict
.
DictSort
)
//字典排序
//base.GET("/manage_list", dict.ManageList) //字典管理列表
}
src/service/component_dict.go
View file @
6caff425
...
...
@@ -5,9 +5,12 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/response"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
"go.uber.org/zap"
"xorm.io/xorm"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
...
...
@@ -235,6 +238,31 @@ func (c *Dict) ClassList(className string) (classList []response.ClassListRes, e
return
}
func
(
c
*
Dict
)
DictSort
(
req
[]
request
.
DictSortInput
)
error
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
return
resp
.
DbConnectError
.
ErrorDetail
(
err
)
}
_
,
err
=
db
.
Transaction
(
func
(
x
*
xorm
.
Session
)
(
interface
{},
error
)
{
for
_
,
v
:=
range
req
{
_
,
err
:=
x
.
Table
(
"dict"
)
.
Cols
(
"sort, updated_at, updated_by"
)
.
Where
(
"id = ? and is_delete = 0"
,
v
.
Id
)
.
Update
(
&
entity
.
Dict
{
Sort
:
v
.
Sort
,
UpdatedBy
:
c
.
User
.
Id
,
UpdatedAt
:
jsontime
.
Time
(
time
.
Now
()),
})
if
err
!=
nil
{
conf
.
Logger
.
Error
(
"排序失败"
,
zap
.
Error
(
err
))
return
nil
,
resp
.
DbUpdateError
.
ErrorDetail
(
err
)
}
}
return
nil
,
nil
})
return
err
}
//func (c *Dict) ManageList(req request.DictManageListReq) (componentDictTreeRes []*response.DictListRes, err error) {
// listReq := request.DictReq{
// Class: req.Class,
...
...
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