Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
祺技世界
gin-vue-admin
提交
26ee865c
G
gin-vue-admin
项目概览
祺技世界
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
6
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
26ee865c
编写于
1月 07, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
角色增加数据资源功能 增加数据资源关联返回(go代码完成 api开发完成 数据库配置完成 前端实现逻辑编写中)
上级
be572a07
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
339 addition
and
49 deletion
+339
-49
QMPlusServer/controller/api/sys_authority.go
QMPlusServer/controller/api/sys_authority.go
+17
-2
QMPlusServer/db/qmplus.sql
QMPlusServer/db/qmplus.sql
+89
-40
QMPlusServer/docs/docs.go
QMPlusServer/docs/docs.go
+82
-1
QMPlusServer/docs/swagger.json
QMPlusServer/docs/swagger.json
+81
-0
QMPlusServer/docs/swagger.yaml
QMPlusServer/docs/swagger.yaml
+50
-0
QMPlusServer/model/sysModel/sys_authority.go
QMPlusServer/model/sysModel/sys_authority.go
+14
-6
QMPlusServer/router/sys_authority.go
QMPlusServer/router/sys_authority.go
+1
-0
README.md
README.md
+5
-0
未找到文件。
QMPlusServer/controller/api/sys_authority.go
浏览文件 @
26ee865c
...
...
@@ -84,6 +84,21 @@ func GetAuthorityList(c *gin.Context) {
}
}
type
GetAuthorityId
struct
{
AuthorityId
string
`json:"authorityId"`
// @Tags authority
// @Summary 设置角色资源权限
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body sysModel.SysAuthority true "设置角色资源权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
// @Router /authority/setDataAuthority [post]
func
SetDataAuthority
(
c
*
gin
.
Context
)
{
var
auth
sysModel
.
SysAuthority
_
=
c
.
ShouldBind
(
&
auth
)
err
:=
auth
.
SetDataAuthority
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"设置关联失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"设置关联成功"
,
gin
.
H
{})
}
}
QMPlusServer/db/qmplus.sql
浏览文件 @
26ee865c
此差异已折叠。
点击以展开。
QMPlusServer/docs/docs.go
浏览文件 @
26ee865c
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 20
19-12-20 11:36:51.4275267 +0800 CST m=+0.0828126
01
// 20
20-01-06 17:53:22.2207663 +0800 CST m=+0.0698440
01
package
docs
...
...
@@ -365,6 +365,45 @@ var doc = `{
}
}
},
"/authority/setDataAuthority": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"authority"
],
"summary": "设置角色资源权限",
"parameters": [
{
"description": "设置角色资源权限",
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/sysModel.SysAuthority"
}
}
],
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"设置成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/base/login": {
"post": {
"produces": [
...
...
@@ -616,6 +655,33 @@ var doc = `{
}
}
},
"/jwt/jsonInBlacklist": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jwt"
],
"summary": "jwt加入黑名单",
"responses": {
"200": {
"description": "{\"success\":true,\"data\":{},\"msg\":\"拉黑成功\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/menu/addBaseMenu": {
"post": {
"security": [
...
...
@@ -1266,6 +1332,21 @@ var doc = `{
},
"authorityName": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/sysModel.SysAuthority"
}
},
"dataAuthorityId": {
"type": "array",
"items": {
"$ref": "#/definitions/sysModel.SysAuthority"
}
},
"parentId": {
"type": "string"
}
}
},
...
...
QMPlusServer/docs/swagger.json
浏览文件 @
26ee865c
...
...
@@ -348,6 +348,45 @@
}
}
},
"/authority/setDataAuthority"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"authority"
],
"summary"
:
"设置角色资源权限"
,
"parameters"
:
[
{
"description"
:
"设置角色资源权限"
,
"name"
:
"data"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"object"
,
"$ref"
:
"#/definitions/sysModel.SysAuthority"
}
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
设置成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/base/login"
:
{
"post"
:
{
"produces"
:
[
...
...
@@ -599,6 +638,33 @@
}
}
},
"/jwt/jsonInBlacklist"
:
{
"post"
:
{
"security"
:
[
{
"ApiKeyAuth"
:
[]
}
],
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"jwt"
],
"summary"
:
"jwt加入黑名单"
,
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
success
\"
:true,
\"
data
\"
:{},
\"
msg
\"
:
\"
拉黑成功
\"
}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/menu/addBaseMenu"
:
{
"post"
:
{
"security"
:
[
...
...
@@ -1249,6 +1315,21 @@
},
"authorityName"
:
{
"type"
:
"string"
},
"children"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/sysModel.SysAuthority"
}
},
"dataAuthorityId"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/sysModel.SysAuthority"
}
},
"parentId"
:
{
"type"
:
"string"
}
}
},
...
...
QMPlusServer/docs/swagger.yaml
浏览文件 @
26ee865c
...
...
@@ -99,6 +99,16 @@ definitions:
type
:
string
authorityName
:
type
:
string
children
:
items
:
$ref
:
'
#/definitions/sysModel.SysAuthority'
type
:
array
dataAuthorityId
:
items
:
$ref
:
'
#/definitions/sysModel.SysAuthority'
type
:
array
parentId
:
type
:
string
type
:
object
sysModel.SysBaseMenu
:
properties
:
...
...
@@ -394,6 +404,30 @@ paths:
summary
:
分页获取角色列表
tags
:
-
authority
/authority/setDataAuthority
:
post
:
consumes
:
-
application/json
parameters
:
-
description
:
设置角色资源权限
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/sysModel.SysAuthority'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"设置成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
设置角色资源权限
tags
:
-
authority
/base/login
:
post
:
parameters
:
...
...
@@ -550,6 +584,22 @@ paths:
summary
:
上传文件示例
tags
:
-
ExaFileUploadAndDownload
/jwt/jsonInBlacklist
:
post
:
consumes
:
-
application/json
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"拉黑成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
jwt加入黑名单
tags
:
-
jwt
/menu/addBaseMenu
:
post
:
consumes
:
...
...
QMPlusServer/model/sysModel/sys_authority.go
浏览文件 @
26ee865c
...
...
@@ -10,10 +10,11 @@ import (
type
SysAuthority
struct
{
gorm
.
Model
AuthorityId
string
`json:"authorityId" gorm:"not null;unique"`
AuthorityName
string
`json:"authorityName"`
ParentId
string
`json:"parentId"`
Children
[]
SysAuthority
`json:"children"`
AuthorityId
string
`json:"authorityId" gorm:"not null;unique"`
AuthorityName
string
`json:"authorityName"`
ParentId
string
`json:"parentId"`
DataAuthorityId
[]
SysAuthority
`json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;association_jointable_foreignkey:data_id"`
Children
[]
SysAuthority
`json:"children"`
}
// 创建角色
...
...
@@ -47,7 +48,7 @@ func (a *SysAuthority) GetInfoList(info modelInterface.PageInfo) (err error, lis
return
}
else
{
var
authority
[]
SysAuthority
err
=
db
.
Where
(
"parent_id = 0"
)
.
Find
(
&
authority
)
.
Error
err
=
db
.
Preload
(
"DataAuthorityId"
)
.
Where
(
"parent_id = 0"
)
.
Find
(
&
authority
)
.
Error
if
len
(
authority
)
>
0
{
for
k
,
_
:=
range
authority
{
err
=
findChildrenAuthority
(
&
authority
[
k
])
...
...
@@ -58,7 +59,7 @@ func (a *SysAuthority) GetInfoList(info modelInterface.PageInfo) (err error, lis
}
func
findChildrenAuthority
(
authority
*
SysAuthority
)
(
err
error
)
{
err
=
qmsql
.
DEFAULTDB
.
Where
(
"parent_id = ?"
,
authority
.
AuthorityId
)
.
Find
(
&
authority
.
Children
)
.
Error
err
=
qmsql
.
DEFAULTDB
.
Preload
(
"DataAuthorityId"
)
.
Where
(
"parent_id = ?"
,
authority
.
AuthorityId
)
.
Find
(
&
authority
.
Children
)
.
Error
if
len
(
authority
.
Children
)
>
0
{
for
k
,
_
:=
range
authority
.
Children
{
err
=
findChildrenAuthority
(
&
authority
.
Children
[
k
])
...
...
@@ -66,3 +67,10 @@ func findChildrenAuthority(authority *SysAuthority) (err error) {
}
return
err
}
func
(
a
*
SysAuthority
)
SetDataAuthority
()
error
{
var
s
SysAuthority
qmsql
.
DEFAULTDB
.
Preload
(
"DataAuthorityId"
)
.
First
(
&
s
,
"id = ?"
,
a
.
ID
)
err
:=
qmsql
.
DEFAULTDB
.
Model
(
&
s
)
.
Association
(
"DataAuthorityId"
)
.
Replace
(
&
a
.
DataAuthorityId
)
.
Error
return
err
}
QMPlusServer/router/sys_authority.go
浏览文件 @
26ee865c
...
...
@@ -12,5 +12,6 @@ func InitAuthorityRouter(Router *gin.RouterGroup) {
AuthorityRouter
.
POST
(
"createAuthority"
,
api
.
CreateAuthority
)
//创建角色
AuthorityRouter
.
POST
(
"deleteAuthority"
,
api
.
DeleteAuthority
)
//删除角色
AuthorityRouter
.
POST
(
"getAuthorityList"
,
api
.
GetAuthorityList
)
//获取角色列表
AuthorityRouter
.
POST
(
"setDataAuthority"
,
api
.
SetDataAuthority
)
//设置角色资源权限
}
}
README.md
浏览文件 @
26ee865c
...
...
@@ -152,3 +152,8 @@ swag init
<h3>
qq交流群:622360840
</h3>
<h3>
微信交流群可以添加任意一位开发者备注"加入gin-vue-admin交流群"
</h3>
</div>
## 更新日志
2020/01/07 角色增加数据资源功能 增加数据资源关联返回(go代码完成 api开发完成 数据库配置完成 前端实现逻辑编写中)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录