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
dac54b71
"src/page/main/log/system/index.vue" did not exist on "1c201c47b2699285689b97c5e64d2a0317b79ad4"
Commit
dac54b71
authored
Jul 04, 2023
by
黄智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用户更新状态接口
parent
cd9bb6ae
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
160 additions
and
99 deletions
+160
-99
src/bean/entity/dictionary.go
src/bean/entity/dictionary.go
+5
-5
src/bean/vo/request/dict.go
src/bean/vo/request/dict.go
+6
-5
src/bean/vo/request/system_user.go
src/bean/vo/request/system_user.go
+2
-2
src/bean/vo/response/dict.go
src/bean/vo/response/dict.go
+21
-0
src/bean/vo/response/dict_class.go
src/bean/vo/response/dict_class.go
+0
-0
src/controller/dict.go
src/controller/dict.go
+46
-48
src/controller/system_user.go
src/controller/system_user.go
+16
-0
src/router/dict.go
src/router/dict.go
+8
-8
src/router/router.go
src/router/router.go
+2
-0
src/router/systemuserrouter.go
src/router/systemuserrouter.go
+3
-2
src/service/component_dict.go
src/service/component_dict.go
+30
-28
src/service/system_menu.go
src/service/system_menu.go
+1
-1
src/service/system_user.go
src/service/system_user.go
+20
-0
No files found.
src/bean/entity/dictionary.go
View file @
dac54b71
...
...
@@ -4,7 +4,7 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
)
type
Dict
ionary
Base
struct
{
type
DictBase
struct
{
Id
string
`json:"id" xorm:"pk autoincr" `
//id
Class
int
`json:"class"`
//菜单分组id
Name
string
`json:"name" `
//字典名称
...
...
@@ -22,7 +22,7 @@ type DictionaryBase struct {
Sort
int64
`json:"sort" `
//排序字段 降序排列
}
type
Component
Dict
struct
{
type
Dict
struct
{
Id
string
`json:"id" xorm:"id"`
//主键ID
Class
int
`json:"class" xorm:"class"`
//组件分类(1开发语言与版本 2中间件类型与中间件 3云组件类型 4模块类型 5所属区域 6操作系统 7对象类型 8SQL类型 9调研评估结果 10任务阶段 11测试文档类型 12验收问题类型 13Q&A问题类型 14文档类型)
Name
string
`json:"name" xorm:"name"`
//组件名称
...
...
@@ -40,15 +40,15 @@ type ComponentDict struct {
Sort
int
`json:"sort" xorm:"sort autoincr"`
//排序字段 降序排列
}
func
(
c
Component
Dict
)
TableName
()
string
{
func
(
c
Dict
)
TableName
()
string
{
return
"dict"
}
type
Component
DictClass
struct
{
type
DictClass
struct
{
ClassId
int
`json:"class_id" xorm:"class_id"`
//字典类别id
ClassName
string
`json:"class_name" xorm:"class_name"`
//字典类别名称
}
func
(
c
Component
DictClass
)
TableName
()
string
{
func
(
c
DictClass
)
TableName
()
string
{
return
"dict_class"
}
src/bean/vo/request/
component_
dict.go
→
src/bean/vo/request/dict.go
View file @
dac54b71
...
...
@@ -2,18 +2,19 @@ package request
import
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
type
ComponentDictReq
struct
{
Id
string
`json:"id" form:"id"`
//主键ID
type
DictReq
struct
{
Id
string
`json:"id" form:"id"`
//主键ID
Status
int
`json:"status" form:"status"`
Class
int
`json:"class" form:"class" binding:"oneof=0 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
}
type
Component
DictTreeReq
struct
{
type
DictTreeReq
struct
{
Class
int
`json:"class" form:"class" binding:"oneof=0 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
}
type
Add
Component
DictReq
struct
{
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文档类型)
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
...
...
@@ -23,7 +24,7 @@ type AddComponentDictReq struct {
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
}
type
Update
Component
DictReq
struct
{
type
UpdateDictReq
struct
{
Id
string
`json:"id" form:"id" binding:"required"`
//组件ID
ParentId
string
`json:"parent_id" form:"parent_id"`
//父级ID
Name
string
`json:"name" form:"name" binding:"required"`
//字典标签
...
...
src/bean/vo/request/system_user.go
View file @
dac54b71
...
...
@@ -43,8 +43,8 @@ type SystemUserDetailReq struct {
Id
string
`json:"id" form:"id" vd:"len($)>0;msg:'请输入id'"`
// id
}
type
SystemUserStateReq
struct
{
Id
string
`json:"id" form:"id" vd:"len($)>0;msg:'请输入id'"`
// id
State
string
`json:"state" vd:"len($)>0;msg:'请填写状态'"`
// Id
Id
int
`json:"id" form:"id" vd:"len($)>0;msg:'请输入id'"`
// id
State
int
`json:"state" vd:"len($)>0;msg:'请填写状态'"`
// Id
}
type
SystemUserEditPasswordReq
struct
{
Id
int
`json:"id" form:"id" vd:"$>0;msg:'请输入id'"`
// id
...
...
src/bean/vo/response/
component_
dict.go
→
src/bean/vo/response/dict.go
View file @
dac54b71
package
response
type
ComponentDictListRes
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
Children
[]
*
ComponentDictListRes
`json:"children,omitempty"`
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"`
}
//type ComponentDictTreeRes struct {
...
...
src/bean/vo/response/
component_
dict_class.go
→
src/bean/vo/response/dict_class.go
View file @
dac54b71
File moved
src/controller/
component_
dict.go
→
src/controller/dict.go
View file @
dac54b71
...
...
@@ -10,14 +10,14 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
)
type
Component
Dict
struct
{}
type
Dict
struct
{}
// List 组件列表
func
(
d
Component
Dict
)
List
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
List
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
Component
DictReq
req
request
.
DictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
...
...
@@ -25,26 +25,24 @@ func (d ComponentDict) List(c *gin.Context) {
return
}
//user, _ := header.GetUserContext(c)
svc
:=
new
(
service
.
ComponentDict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
componentDic
t
,
err
:=
svc
.
List
(
req
)
resul
t
,
err
:=
svc
.
List
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
componentDic
t
)
SendJsonResponse
(
c
,
resp
.
OK
,
resul
t
)
}
// DictTree 字典列表-树结构
func
(
d
Component
Dict
)
DictTree
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
DictTree
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
Component
DictTreeReq
req
request
.
DictTreeReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
...
...
@@ -54,7 +52,7 @@ func (d ComponentDict) DictTree(c *gin.Context) {
//user, _ := header.GetUserContext(c)
svc
:=
new
(
service
.
Component
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
componentDictTreeRes
,
err
:=
svc
.
DictTree
(
req
)
...
...
@@ -67,11 +65,11 @@ func (d ComponentDict) DictTree(c *gin.Context) {
}
// Add 新增字典
func
(
d
Component
Dict
)
Add
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
Add
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
Add
Component
DictReq
req
request
.
AddDictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
...
...
@@ -79,7 +77,7 @@ func (d ComponentDict) Add(c *gin.Context) {
return
}
svc
:=
new
(
service
.
Component
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
...
...
@@ -93,11 +91,11 @@ func (d ComponentDict) Add(c *gin.Context) {
}
// Update 修改字典
func
(
d
Component
Dict
)
Update
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
Update
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
Update
Component
DictReq
req
request
.
UpdateDictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
...
...
@@ -105,7 +103,7 @@ func (d ComponentDict) Update(c *gin.Context) {
return
}
svc
:=
new
(
service
.
Component
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
...
...
@@ -119,7 +117,7 @@ func (d ComponentDict) Update(c *gin.Context) {
}
// Del 删除字典
func
(
d
Component
Dict
)
Del
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
Del
(
c
*
gin
.
Context
)
{
var
(
err
error
...
...
@@ -135,7 +133,7 @@ func (d ComponentDict) Del(c *gin.Context) {
return
}
svc
:=
new
(
service
.
Component
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
//svc.User = &user
...
...
@@ -149,7 +147,7 @@ func (d ComponentDict) Del(c *gin.Context) {
}
// List 组件列表
func
(
d
Component
Dict
)
ClassList
(
c
*
gin
.
Context
)
{
func
(
d
Dict
)
ClassList
(
c
*
gin
.
Context
)
{
var
(
err
error
...
...
@@ -160,9 +158,9 @@ func (d ComponentDict) ClassList(c *gin.Context) {
className
=
c
.
Param
(
"class_name"
)
}
svc
:=
new
(
service
.
Component
Dict
)
svc
:=
new
(
service
.
Dict
)
svc
.
Ctx
=
c
//svc.User = &user
svc
.
User
=
header
.
GetUser
(
c
)
classList
,
err
:=
svc
.
ClassList
(
className
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
...
...
@@ -173,29 +171,29 @@ func (d ComponentDict) ClassList(c *gin.Context) {
}
// List 组件列表
func
(
d
Component
Dict
)
ManageList
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
DictManageListReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
//svc := new(service.Component
Dict)
//svc.Ctx = c
////svc.User = &user
//manageList, err := svc.ManageList(req)
//if err != nil {
// resp.Json(c, resp.FAIL.WithMsg(err.Error()))
// return
//}
//
//resp.Json(c, resp.OK.WithData(manageList))
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
//func (d
Dict) ManageList(c *gin.Context) {
//
//
var (
//
err error
//
req request.DictManageListReq
//
)
//
//
if err = c.ShouldBind(&req); err != nil {
//
SendJsonResponse(c, resp.InvalidParam.WithError(err), "")
//
return
//
}
//svc := new(service.
Dict)
//svc.Ctx = c
////svc.User = &user
//manageList, err := svc.ManageList(req)
//if err != nil {
// resp.Json(c, resp.FAIL.WithMsg(err.Error()))
// return
//}
//
//resp.Json(c, resp.OK.WithData(manageList))
//
//
SendJsonResponse(c, resp.OK, nil)
//
//
}
src/controller/system_user.go
View file @
dac54b71
...
...
@@ -162,3 +162,19 @@ func ResetSystemUserPassword(c *gin.Context) {
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
func
SystemUserUpdateState
(
c
*
gin
.
Context
)
{
params
:=
request
.
SystemUserStateReq
{}
if
err
:=
c
.
ShouldBindJSON
(
&
params
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
return
}
svc
:=
service
.
User
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
SystemUserUpdateState
(
params
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
err
,
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
src/router/dict.go
View file @
dac54b71
...
...
@@ -14,13 +14,13 @@ func initDictRoute(e *gin.Engine) {
//系统字典
componentDictController
:=
new
(
controller
.
Component
Dict
)
base
.
POST
(
""
,
componentDictController
.
Add
)
//新增字典
base
.
PUT
(
""
,
componentDictController
.
Update
)
//修改字典
base
.
DELETE
(
""
,
componentDictController
.
Del
)
//删除字典
base
.
GET
(
""
,
componentDictController
.
List
)
//字典列表
base
.
GET
(
"/
dict_tree"
,
componentDictController
.
DictTree
)
//字典列表-树结构
base
.
GET
(
"/class
_list"
,
componentDictController
.
ClassList
)
//字典分类列表
base
.
GET
(
"/manage_list"
,
componentDictController
.
ManageList
)
//字典管理列表
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
(
"/class
List"
,
dict
.
ClassList
)
//字典分类列表
//base.GET("/manage_list", dict
.ManageList) //字典管理列表
}
src/router/router.go
View file @
dac54b71
...
...
@@ -43,6 +43,8 @@ func Load(r *gin.Engine, middleware ...gin.HandlerFunc) {
InitSystemRoleRouter
(
r
)
// 初始化菜单相关路由(r)
InitSystemMenuRouter
(
r
)
// 初始化字典相关路由(r)
initDictRoute
(
r
)
// 初始化指标配置路由
InitMetricConfigRouter
(
r
)
// 初始化预警规则配置路由
...
...
src/router/systemuserrouter.go
View file @
dac54b71
...
...
@@ -22,8 +22,9 @@ func InitSystemUserRouter(e *gin.Engine) {
base
.
DELETE
(
"/del"
,
controller
.
DelOrgUser
)
//删除组织用户
base
.
POST
(
"/check"
,
controller
.
CheckRepetition
)
//去重校验
base
.
POST
(
"/updatePwd"
,
controller
.
SystemUserEditPassword
)
// 修改账户密码
base
.
POST
(
"/resetPwd"
,
controller
.
ResetSystemUserPassword
)
// 重置账户密码
base
.
POST
(
"/updatePwd"
,
controller
.
SystemUserEditPassword
)
// 修改账户密码
base
.
POST
(
"/resetPwd"
,
controller
.
ResetSystemUserPassword
)
// 重置账户密码
base
.
POST
(
"/updateState"
,
controller
.
SystemUserUpdateState
)
// 重置账户密码
}
}
src/service/component_dict.go
View file @
dac54b71
...
...
@@ -15,12 +15,12 @@ import (
"time"
)
type
Component
Dict
struct
{
type
Dict
struct
{
Ctx
*
gin
.
Context
User
entity
.
SystemUserInfo
}
func
(
c
*
Component
Dict
)
Check
(
id
,
parentId
string
,
name
string
)
(
err
error
)
{
func
(
c
*
Dict
)
Check
(
id
,
parentId
string
,
name
string
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
...
...
@@ -34,7 +34,7 @@ func (c *ComponentDict) Check(id, parentId string, name string) (err error) {
session
.
Where
(
"id != ?"
,
id
)
}
cnt
,
err
:=
session
.
Count
(
&
entity
.
Component
Dict
{})
cnt
,
err
:=
session
.
Count
(
&
entity
.
Dict
{})
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"数据库查重失败!"
)
return
...
...
@@ -52,17 +52,17 @@ func (c *ComponentDict) Check(id, parentId string, name string) (err error) {
return
}
func
(
c
*
ComponentDict
)
List
(
req
request
.
ComponentDictReq
)
(
componentDictListRes
[]
*
response
.
Component
DictListRes
,
err
error
)
{
func
(
c
*
Dict
)
List
(
req
request
.
DictReq
)
(
dictListRes
[]
*
response
.
DictListRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
WithError
(
err
)
return
componentD
ictListRes
,
err
return
d
ictListRes
,
err
}
session
:=
db
.
NewSession
()
session
.
Select
(
"id,class,name,parent_id"
)
.
Table
(
"dict"
)
session
.
Where
(
"
WHERE status = 0 AND
is_delete = 0 "
)
session
.
Select
(
"id,class,name,parent_id
,status,min_val,max_val,sort
"
)
.
Table
(
"dict"
)
session
.
Where
(
"is_delete = 0 "
)
if
req
.
Id
!=
""
{
session
.
Where
(
"id = ? "
,
req
.
Id
)
...
...
@@ -73,16 +73,19 @@ func (c *ComponentDict) List(req request.ComponentDictReq) (componentDictListRes
if
req
.
Class
!=
0
{
session
.
Where
(
"class = ? "
,
req
.
Class
)
}
if
req
.
Status
!=
0
{
session
.
Where
(
"status = ? "
,
req
.
Status
)
}
err
=
session
.
OrderBy
(
"
name"
)
.
Find
(
&
componentD
ictListRes
)
err
=
session
.
OrderBy
(
"
class,sort"
)
.
Find
(
&
d
ictListRes
)
if
err
!=
nil
{
return
componentDictListRes
,
resp
.
DbSelectError
return
dictListRes
,
resp
.
DbSelectError
.
WithError
(
err
)
}
return
}
func
(
c
*
ComponentDict
)
DictTree
(
req
request
.
ComponentDictTreeReq
)
(
componentDictTreeRes
[]
*
response
.
Component
DictListRes
,
err
error
)
{
listReq
:=
request
.
Component
DictReq
{
func
(
c
*
Dict
)
DictTree
(
req
request
.
DictTreeReq
)
(
componentDictTreeRes
[]
*
response
.
DictListRes
,
err
error
)
{
listReq
:=
request
.
DictReq
{
Class
:
req
.
Class
,
ParentId
:
""
,
}
...
...
@@ -96,27 +99,27 @@ func (c *ComponentDict) DictTree(req request.ComponentDictTreeReq) (componentDic
return
}
func
getTreeIterative
(
list
[]
*
response
.
ComponentDictListRes
,
parentId
string
)
[]
*
response
.
Component
DictListRes
{
memo
:=
make
(
map
[
string
]
*
response
.
Component
DictListRes
)
func
getTreeIterative
(
list
[]
*
response
.
DictListRes
,
parentId
string
)
[]
*
response
.
DictListRes
{
memo
:=
make
(
map
[
string
]
*
response
.
DictListRes
)
for
_
,
v
:=
range
list
{
if
_
,
ok
:=
memo
[
v
.
Id
];
ok
{
v
.
Children
=
memo
[
v
.
Id
]
.
Children
memo
[
v
.
Id
]
=
v
}
else
{
v
.
Children
=
make
([]
*
response
.
Component
DictListRes
,
0
)
v
.
Children
=
make
([]
*
response
.
DictListRes
,
0
)
memo
[
v
.
Id
]
=
v
}
if
_
,
ok
:=
memo
[
v
.
ParentId
];
ok
{
memo
[
v
.
ParentId
]
.
Children
=
append
(
memo
[
v
.
ParentId
]
.
Children
,
memo
[
v
.
Id
])
}
else
{
memo
[
v
.
ParentId
]
=
&
response
.
ComponentDictListRes
{
Children
:
[]
*
response
.
Component
DictListRes
{
memo
[
v
.
Id
]}}
memo
[
v
.
ParentId
]
=
&
response
.
DictListRes
{
Children
:
[]
*
response
.
DictListRes
{
memo
[
v
.
Id
]}}
}
}
return
memo
[
parentId
]
.
Children
}
func
(
c
*
ComponentDict
)
Add
(
req
request
.
AddComponent
DictReq
)
(
err
error
)
{
func
(
c
*
Dict
)
Add
(
req
request
.
Add
DictReq
)
(
err
error
)
{
//检查重复
err
=
c
.
Check
(
""
,
req
.
ParentId
,
req
.
Name
)
...
...
@@ -124,7 +127,7 @@ func (c *ComponentDict) Add(req request.AddComponentDictReq) (err error) {
return
}
componentDict
:=
&
entity
.
Component
Dict
{
componentDict
:=
&
entity
.
Dict
{
Id
:
util
.
GetUUID
(),
Class
:
req
.
Class
,
Name
:
req
.
Name
,
...
...
@@ -155,7 +158,7 @@ func (c *ComponentDict) Add(req request.AddComponentDictReq) (err error) {
}
func
(
c
*
ComponentDict
)
Update
(
req
request
.
UpdateComponent
DictReq
)
(
err
error
)
{
func
(
c
*
Dict
)
Update
(
req
request
.
Update
DictReq
)
(
err
error
)
{
//检查重复
err
=
c
.
Check
(
req
.
Id
,
req
.
ParentId
,
req
.
Name
)
...
...
@@ -184,7 +187,7 @@ func (c *ComponentDict) Update(req request.UpdateComponentDictReq) (err error) {
}
func
(
c
*
Component
Dict
)
Del
(
id
int
)
(
err
error
)
{
func
(
c
*
Dict
)
Del
(
id
int
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
...
...
@@ -207,7 +210,7 @@ func (c *ComponentDict) Del(id int) (err error) {
}
func
(
c
*
Component
Dict
)
ClassList
(
className
string
)
(
classList
[]
response
.
ClassListRes
,
err
error
)
{
func
(
c
*
Dict
)
ClassList
(
className
string
)
(
classList
[]
response
.
ClassListRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
...
...
@@ -221,7 +224,7 @@ func (c *ComponentDict) ClassList(className string) (classList []response.ClassL
session
.
Where
(
"class_name like ?"
,
"%"
+
className
+
"%"
)
}
session
.
OrderBy
(
"class_
name
"
)
session
.
OrderBy
(
"class_
id
"
)
//执行查询
err
=
session
.
Table
(
"dict_class"
)
.
Find
(
&
classList
)
...
...
@@ -232,13 +235,12 @@ func (c *ComponentDict) ClassList(className string) (classList []response.ClassL
return
}
//
//func (c *ComponentDict) ManageList(req request.DictManageListReq) (componentDictTreeRes []*response.ComponentDictListRes, err error) {
// listReq := request.ComponentDictReq{
//func (c *Dict) ManageList(req request.DictManageListReq) (componentDictTreeRes []*response.DictListRes, err error) {
// listReq := request.DictReq{
// Class: req.Class,
// ParentId: -1,
// }
// componentDictList, err := c.ist(listReq)
// componentDictList, err := c.
l
ist(listReq)
// if err != nil {
// return
// }
...
...
@@ -247,10 +249,10 @@ func (c *ComponentDict) ClassList(className string) (classList []response.ClassL
//
// return
//}
//func (c *Dict) list(req request.DictReq) (componentDictListRes []*response.DictListRes, err error) {
//
//func (c *ComponentDict) list(req request.ComponentDictReq) (componentDictListRes []*response.ComponentDictListRes, err error) {
//
// finder := zorm.NewFinder().Append("select id,class,name,parent_id from " + new(entity.ComponentDict).GetTableName())
// finder := zorm.NewFinder().Append("select id,class,name,parent_id from " + new(entity.Dict).GetTableName())
// finder.Append("WHERE status = 0 AND is_delete = 0 ")
//
// if req.Id != 0 {
...
...
src/service/system_menu.go
View file @
dac54b71
...
...
@@ -283,7 +283,7 @@ func (s *SystemMenu) GetGroupDict() (interface{}, error) {
if
err
!=
nil
{
return
nil
,
resp
.
DbConnectError
.
ErrorDetail
(
err
)
}
dict
:=
make
([]
entity
.
Dict
ionary
Base
,
0
)
dict
:=
make
([]
entity
.
DictBase
,
0
)
err
=
db
.
Table
(
"dict"
)
.
Where
(
"is_delete = 0 and status = 1"
)
.
And
(
"class = 4"
)
.
Find
(
&
dict
)
if
err
!=
nil
{
conf
.
Logger
.
Error
(
"查询字典失败"
,
zap
.
Error
(
err
))
...
...
src/service/system_user.go
View file @
dac54b71
...
...
@@ -10,8 +10,10 @@ import (
"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"
"time"
"xorm.io/xorm"
"go.uber.org/zap"
...
...
@@ -282,6 +284,24 @@ func (o *User) CheckRepetition(input request.CheckRepetition) error {
return
nil
}
func
(
u
*
User
)
SystemUserUpdateState
(
params
request
.
SystemUserStateReq
)
error
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
return
resp
.
DbConnectError
.
WithData
(
err
)
}
_
,
err
=
db
.
Table
(
"system_user"
)
.
Cols
(
"state,updated_by"
)
.
Where
(
"id = ? "
,
params
.
Id
)
.
Update
(
map
[
string
]
interface
{}{
"updated_by"
:
u
.
User
.
Id
,
"state"
:
params
.
State
,
"updated_time"
:
jsontime
.
Time
(
time
.
Now
()),
})
if
err
!=
nil
{
return
resp
.
DbSelectError
.
WithData
(
err
)
}
return
nil
}
// SystemUserEditPassword 修改密码
func
SystemUserEditPassword
(
params
request
.
SystemUserEditPasswordReq
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
...
...
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