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
619689fa
Commit
619689fa
authored
Jul 04, 2023
by
黄智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改角色列表
parent
9cc03d88
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
622 additions
and
17 deletions
+622
-17
src/bean/entity/dictionary.go
src/bean/entity/dictionary.go
+49
-14
src/bean/vo/request/component_dict.go
src/bean/vo/request/component_dict.go
+46
-0
src/bean/vo/response/component_dict.go
src/bean/vo/response/component_dict.go
+17
-0
src/bean/vo/response/component_dict_class.go
src/bean/vo/response/component_dict_class.go
+6
-0
src/controller/component_dict.go
src/controller/component_dict.go
+201
-0
src/router/dict.go
src/router/dict.go
+26
-0
src/service/component_dict.go
src/service/component_dict.go
+274
-0
src/service/system_role.go
src/service/system_role.go
+3
-3
No files found.
src/bean/entity/dictionary.go
View file @
619689fa
package
entity
import
"time"
import
(
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
)
type
DictionaryBase
struct
{
Id
string
`json:"id" xorm:"pk autoincr" `
//id
Class
int
`json:"class"`
//菜单分组id
Name
string
`json:"name" `
//字典名称
ParentId
int
`json:"parent_id" `
//父级id
Status
int32
`json:"status" `
//状态 1-启用 2-禁用
IsDelete
int32
`json:"is_delete" `
//是否删除 1-是 0-否
DictType
int32
`json:"dict_type" `
//字典类型(0-用户 1-系统)
Description
string
`json:"description" `
//描述
CreatedBy
int
`json:"created_by" `
//创建者
CreatedAt
time
.
Time
`json:"created_at" xorm:"created" `
//创建时间
UpdatedBy
int
`json:"updated_by" `
//更新者
UpdatedAt
time
.
Time
`json:"updated_at" xorm:"updated" `
//更新时间
Sort
int64
`json:"sort" `
//排序字段 降序排列
Id
string
`json:"id" xorm:"pk autoincr" `
//id
Class
int
`json:"class"`
//菜单分组id
Name
string
`json:"name" `
//字典名称
ParentId
int
`json:"parent_id" `
//父级id
Status
int32
`json:"status" `
//状态 1-启用 2-禁用
IsDelete
int32
`json:"is_delete" `
//是否删除 1-是 0-否
DictType
int32
`json:"dict_type" `
//字典类型(0-用户 1-系统)
Description
string
`json:"description" `
//描述
CreatedBy
int
`json:"created_by" `
//创建者
CreatedAt
jsontime
.
Time
`json:"created_at" xorm:"created" `
//创建时间
UpdatedBy
int
`json:"updated_by" `
//更新者
UpdatedAt
jsontime
.
Time
`json:"updated_at" xorm:"updated" `
//更新时间
MinVal
string
`json:"min_val"`
//最大值
MaxVal
string
`json:"max_val"`
//最小值
Sort
int64
`json:"sort" `
//排序字段 降序排列
}
type
ComponentDict
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"`
//组件名称
ParentId
string
`json:"parent_id" xorm:"parent_id"`
//父id
Status
int
`json:"status" xorm:"status"`
//是否启用(0:启用 1:禁用)
IsDelete
int
`json:"is_delete" xorm:"is_delete"`
//是否删除(0未删除 1已删除)
DictType
int
`json:"dict_type" xorm:"dict_type"`
//字典类型(0用户 1系统)
Description
string
`json:"description" xorm:"description"`
//描述
CreatedBy
int
`json:"created_by" xorm:"created_by"`
//创建人
CreatedAt
jsontime
.
Time
`json:"created_time" xorm:"created_at"`
//创建时间
UpdatedBy
int
`json:"updated_by" xorm:"updated_by"`
//修改人
UpdatedAt
jsontime
.
Time
`json:"updated_time" xorm:"updated_at"`
//修改时间
MinVal
string
`json:"min_val" xorm:"min_val"`
//最大值
MaxVal
string
`json:"max_val" xorm:"max_val"`
//最小值
Sort
int
`json:"sort" xorm:"sort autoincr"`
//排序字段 降序排列
}
func
(
c
ComponentDict
)
TableName
()
string
{
return
"dict"
}
type
ComponentDictClass
struct
{
ClassId
int
`json:"class_id" xorm:"class_id"`
//字典类别id
ClassName
string
`json:"class_name" xorm:"class_name"`
//字典类别名称
}
func
(
c
ComponentDictClass
)
TableName
()
string
{
return
"dict_class"
}
src/bean/vo/request/component_dict.go
0 → 100644
View file @
619689fa
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
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
ComponentDictTreeReq
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
AddComponentDictReq
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"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(0:启用 1:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
}
type
UpdateComponentDictReq
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"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(0:启用 1:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
UpdatedBy
int
`json:"updated_by" `
//修改人
UpdatedTime
jsontime
.
Time
`json:"updated_at"`
//修改时间
}
type
DictManageListReq
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"`
//字典标签
Status
int
`json:"status" form:"status" binding:"oneof=0 1"`
//是否启用(0:启用 1:禁用)
Description
string
`json:"description" form:"description" binding:"lte=200"`
//描述
MinVal
string
`json:"min_val" form:"min_val"`
//最大值
MaxVal
string
`json:"max_val" form:"max_val"`
//最小值
}
src/bean/vo/response/component_dict.go
0 → 100644
View file @
619689fa
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 ComponentDictTreeRes struct {
// Id int `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 int `json:"parent_id" column:"parent_id"` //父id
// Children []*ComponentDictTreeRes `json:"children,omitempty"`
//}
src/bean/vo/response/component_dict_class.go
0 → 100644
View file @
619689fa
package
response
type
ClassListRes
struct
{
ClassId
int
`json:"class_id" column:"class_id"`
//字典类别id
ClassName
string
`json:"class_name" column:"class_name"`
//字典类别名称
}
src/controller/component_dict.go
0 → 100644
View file @
619689fa
package
controller
import
(
"errors"
"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/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
)
type
ComponentDict
struct
{}
// List 组件列表
func
(
d
ComponentDict
)
List
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
ComponentDictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
//user, _ := header.GetUserContext(c)
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
componentDict
,
err
:=
svc
.
List
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
componentDict
)
}
// DictTree 字典列表-树结构
func
(
d
ComponentDict
)
DictTree
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
ComponentDictTreeReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
//user, _ := header.GetUserContext(c)
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
componentDictTreeRes
,
err
:=
svc
.
DictTree
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
componentDictTreeRes
)
}
// Add 新增字典
func
(
d
ComponentDict
)
Add
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
AddComponentDictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
err
=
svc
.
Add
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
// Update 修改字典
func
(
d
ComponentDict
)
Update
(
c
*
gin
.
Context
)
{
var
(
err
error
req
request
.
UpdateComponentDictReq
)
if
err
=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
""
)
return
}
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
svc
.
User
=
header
.
GetUser
(
c
)
err
=
svc
.
Update
(
req
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
// Del 删除字典
func
(
d
ComponentDict
)
Del
(
c
*
gin
.
Context
)
{
var
(
err
error
id
string
)
if
id
=
c
.
Query
(
"id"
);
id
==
""
{
id
=
c
.
Param
(
"id"
)
}
if
id
==
""
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
errors
.
New
(
"参数为空或不正确"
)),
""
)
return
}
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
//svc.User = &user
err
=
svc
.
Del
(
cast
.
ToInt
(
id
))
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
nil
)
}
// List 组件列表
func
(
d
ComponentDict
)
ClassList
(
c
*
gin
.
Context
)
{
var
(
err
error
className
string
)
if
className
=
c
.
Query
(
"class_name"
);
className
==
""
{
className
=
c
.
Param
(
"class_name"
)
}
svc
:=
new
(
service
.
ComponentDict
)
svc
.
Ctx
=
c
//svc.User = &user
classList
,
err
:=
svc
.
ClassList
(
className
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
""
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
classList
)
}
// List 组件列表
func
(
d
ComponentDict
)
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.ComponentDict)
//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/router/dict.go
0 → 100644
View file @
619689fa
package
router
import
(
"fmt"
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/controller"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header"
)
// InitSystemLoginRouter 初始化登录相关路由
func
initDictRoute
(
e
*
gin
.
Engine
)
{
base
:=
e
.
Group
(
fmt
.
Sprintf
(
"%s/dict"
,
conf
.
Options
.
Prefix
),
header
.
SetContext
)
//系统字典
componentDictController
:=
new
(
controller
.
ComponentDict
)
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
)
//字典管理列表
}
src/service/component_dict.go
0 → 100644
View file @
619689fa
package
service
import
(
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity"
"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/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"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"time"
)
type
ComponentDict
struct
{
Ctx
*
gin
.
Context
User
entity
.
SystemUserInfo
}
func
(
c
*
ComponentDict
)
Check
(
id
,
parentId
string
,
name
string
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
}
session
:=
db
.
NewSession
()
session
.
Table
(
"dict"
)
session
.
Where
(
"parent_id = ? and name = ? and is_delete = 0"
,
parentId
,
name
)
if
id
!=
""
{
session
.
Where
(
"id != ?"
,
id
)
}
cnt
,
err
:=
session
.
Count
(
&
entity
.
ComponentDict
{})
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"数据库查重失败!"
)
return
}
if
cnt
>
0
{
if
id
!=
""
{
err
=
errors
.
New
(
"编辑失败,已存在相同的字典标签!"
)
}
else
{
err
=
errors
.
New
(
"新增失败,已存在相同的字典标签!"
)
}
return
}
return
}
func
(
c
*
ComponentDict
)
List
(
req
request
.
ComponentDictReq
)
(
componentDictListRes
[]
*
response
.
ComponentDictListRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
WithError
(
err
)
return
componentDictListRes
,
err
}
session
:=
db
.
NewSession
()
session
.
Select
(
"id,class,name,parent_id"
)
.
Table
(
"dict"
)
session
.
Where
(
"WHERE status = 0 AND is_delete = 0 "
)
if
req
.
Id
!=
""
{
session
.
Where
(
"id = ? "
,
req
.
Id
)
}
if
req
.
ParentId
!=
""
{
session
.
Where
(
"parent_id = ? "
,
req
.
ParentId
)
}
if
req
.
Class
!=
0
{
session
.
Where
(
"class = ? "
,
req
.
Class
)
}
err
=
session
.
OrderBy
(
" name"
)
.
Find
(
&
componentDictListRes
)
if
err
!=
nil
{
return
componentDictListRes
,
resp
.
DbSelectError
}
return
}
func
(
c
*
ComponentDict
)
DictTree
(
req
request
.
ComponentDictTreeReq
)
(
componentDictTreeRes
[]
*
response
.
ComponentDictListRes
,
err
error
)
{
listReq
:=
request
.
ComponentDictReq
{
Class
:
req
.
Class
,
ParentId
:
""
,
}
componentDictList
,
err
:=
c
.
List
(
listReq
)
if
err
!=
nil
{
return
}
componentDictTreeRes
=
getTreeIterative
(
componentDictList
,
req
.
ParentId
)
return
}
func
getTreeIterative
(
list
[]
*
response
.
ComponentDictListRes
,
parentId
string
)
[]
*
response
.
ComponentDictListRes
{
memo
:=
make
(
map
[
string
]
*
response
.
ComponentDictListRes
)
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
.
ComponentDictListRes
,
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
.
ComponentDictListRes
{
memo
[
v
.
Id
]}}
}
}
return
memo
[
parentId
]
.
Children
}
func
(
c
*
ComponentDict
)
Add
(
req
request
.
AddComponentDictReq
)
(
err
error
)
{
//检查重复
err
=
c
.
Check
(
""
,
req
.
ParentId
,
req
.
Name
)
if
err
!=
nil
{
return
}
componentDict
:=
&
entity
.
ComponentDict
{
Id
:
util
.
GetUUID
(),
Class
:
req
.
Class
,
Name
:
req
.
Name
,
ParentId
:
req
.
ParentId
,
Status
:
req
.
Status
,
Description
:
req
.
Description
,
CreatedBy
:
c
.
User
.
Id
,
CreatedAt
:
jsontime
.
Time
(
time
.
Now
()),
UpdatedBy
:
c
.
User
.
Id
,
UpdatedAt
:
jsontime
.
Time
(
time
.
Now
()),
MinVal
:
req
.
MinVal
,
MaxVal
:
req
.
MaxVal
,
}
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
}
_
,
err
=
db
.
Insert
(
&
componentDict
)
if
err
!=
nil
{
err
=
resp
.
DbInsertError
.
ErrorDetail
(
err
)
return
}
return
}
func
(
c
*
ComponentDict
)
Update
(
req
request
.
UpdateComponentDictReq
)
(
err
error
)
{
//检查重复
err
=
c
.
Check
(
req
.
Id
,
req
.
ParentId
,
req
.
Name
)
if
err
!=
nil
{
return
}
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
}
session
:=
db
.
NewSession
()
req
.
UpdatedBy
=
c
.
User
.
Id
req
.
UpdatedTime
=
jsontime
.
Time
(
time
.
Now
())
_
,
err
=
session
.
Table
(
"dict"
)
.
Cols
(
"name,status,description,updated_by,updated_time,min_val,max_val"
)
.
Where
(
"id = ? and is_delete = 0"
,
req
.
Id
)
.
Update
(
&
req
)
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"修改字典失败!"
)
return
}
return
}
func
(
c
*
ComponentDict
)
Del
(
id
int
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
}
session
:=
db
.
NewSession
()
_
,
err
=
session
.
Table
(
"dict"
)
.
Cols
(
"is_delete"
)
.
Where
(
"id = ? "
,
id
)
.
Update
(
map
[
string
]
int
{
"is_delete"
:
1
,
})
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"删除字典失败!"
)
return
}
return
}
func
(
c
*
ComponentDict
)
ClassList
(
className
string
)
(
classList
[]
response
.
ClassListRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
ErrorDetail
(
err
)
return
}
session
:=
db
.
NewSession
()
if
className
!=
""
{
session
.
Where
(
"class_name like ?"
,
"%"
+
className
+
"%"
)
}
session
.
OrderBy
(
"class_name"
)
//执行查询
err
=
session
.
Table
(
"dict_class"
)
.
Find
(
&
classList
)
if
err
!=
nil
{
err
=
errors
.
Wrap
(
err
,
"查询字典分类列表失败"
)
return
}
return
}
//
//func (c *ComponentDict) ManageList(req request.DictManageListReq) (componentDictTreeRes []*response.ComponentDictListRes, err error) {
// listReq := request.ComponentDictReq{
// Class: req.Class,
// ParentId: -1,
// }
// componentDictList, err := c.ist(listReq)
// if err != nil {
// return
// }
//
// componentDictTreeRes = getTreeIterative(componentDictList, req.ParentId)
//
// return
//}
//
//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.Append("WHERE status = 0 AND is_delete = 0 ")
//
// if req.Id != 0 {
// finder.Append(" AND id = ? ", req.Id)
// }
// if req.ParentId != -1 {
// finder.Append(" AND parent_id = ? ", req.ParentId)
// }
// if req.Class != 0 {
// finder.Append(" AND class = ? ", req.Class)
// }
//
// finder.Append("order by name")
// //执行查询
// err = zorm.Query(c.Ctx, finder, &componentDictListRes, nil)
// if err != nil {
// err = errors.Wrap(err, "查询字典列表失败")
// return
// }
// return
//}
src/service/system_role.go
View file @
619689fa
...
...
@@ -241,9 +241,9 @@ func SystemRoleList(params *request.SystemRoleListReq) (resultData []response.Sy
//DataPurview: v.DataPurview,
}
// 业务系统角色不可分配用户
if
v
.
RoleType
!=
0
{
SystemRoleListRes
.
CantAllot
=
1
}
//
if v.RoleType != 0 {
//
SystemRoleListRes.CantAllot = 1
//
}
SystemRoleListArr
=
append
(
SystemRoleListArr
,
SystemRoleListRes
)
roleIds
=
append
(
roleIds
,
v
.
RoleId
)
}
...
...
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