Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
cd708e3d
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
9 个月 前同步成功
通知
324
Star
18154
Fork
5505
代码
文件
提交
分支
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 搜索 >>
提交
cd708e3d
编写于
8月 24, 2020
作者:
Sliver_Horn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加测试文档,Find替换为First方法
上级
21112238
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
77 addition
and
10 deletion
+77
-10
server/GORMV2接口测试文档.md
server/GORMV2接口测试文档.md
+69
-0
server/service/sys_authority.go
server/service/sys_authority.go
+8
-10
未找到文件。
server/GORMV2接口测试文档.md
0 → 100644
浏览文件 @
cd708e3d
| 路由path | 路由描述 | 测试情况 |
| ------------------------------------------------- | ----------------------- | :------: |
| /base/login | 用户登录 | √ |
| /base/register | 用户注册 | |
| /api/createApi | 创建api | |
| /api/getApiList | 获取api详细信息 | |
| /api/deleteApi | 删除Api | |
| /api/updateApi | 更新Api | |
| /api/getAllApis | 获取所有api | |
| /authority/createAuthority | 创建角色 | √ |
| /authority/createAuthority | 创建子角色 | √ |
| /authority/deleteAuthority | 删除角色 | √ |
| /authority/getAuthorityList | 获取角色列表 | √ |
| /menu/getMenu | 获取菜单树 | |
| /menu/getMenuList | 分页获取基础menu列表 | |
| /menu/addBaseMenu | 新增菜单 | |
| /menu/getBaseMenuTree | 获取用户动态路由 | |
| /menu/addMenuAuthority | 增加menu和角色关联关系 | |
| /menu/getMenuAuthority | 获取指定角色menu | |
| /menu/deleteBaseMenu | 删除菜单 | |
| /menu/updateBaseMenu | 更新菜单 | |
| /menu/getBaseMenuById | 根据id获取菜单 | |
| /user/changePassword | 修改密码 | |
| /user/uploadHeaderImg | 上传头像 | |
| /user/getInfoList | 分页获取用户列表 | |
| /user/getUserList | 获取用户列表 | |
| /user/setUserAuthority | 修改用户角色 | |
| /fileUploadAndDownload/upload | 文件上传示例 | |
| /fileUploadAndDownload/getFileList | 获取上传文件列表 | |
| /casbin/updateCasbin | 更改角色api权限 | |
| /casbin/getPolicyPathByAuthorityId | 获取权限列表 | |
| /fileUploadAndDownload/deleteFile | 删除文件 | |
| /jwt/jsonInBlacklist | jwt加入黑名单 | |
| /authority/setDataAuthority | 设置角色资源权限 | |
| /system/getSystemConfig | 获取配置文件内容 | |
| /system/setSystemConfig | 设置配置文件内容 | |
| /customer/customer | 创建客户 | |
| /customer/customer | 更新客户 | |
| /customer/customer | 删除客户 | |
| /customer/customer | 获取单一客户 | |
| /customer/customerList | 获取客户列表 | |
| /casbin/casbinTest/:pathParam | RESTFUL模式测试 | |
| /autoCode/createTemp | 自动化代码 | |
| /authority/updateAuthority | 更新角色信息 | |
| /authority/copyAuthority | 拷贝角色 | |
| /user/deleteUser | 删除用户 | |
| /sysDictionaryDetail/createSysDictionaryDetail | 新增字典内容 | |
| /sysDictionaryDetail/deleteSysDictionaryDetail | 新增字典内容 | |
| /sysDictionaryDetail/updateSysDictionaryDetail | 新增字典内容 | |
| /sysDictionaryDetail/findSysDictionaryDetail | 根据ID获取字典内容 | |
| /sysDictionaryDetail/getSysDictionaryDetailList | 获取字典内容列表 | |
| /sysDictionary/createSysDictionary | 新增字典 | |
| /sysDictionary/deleteSysDictionary | 删除字典 | |
| /sysDictionary/updateSysDictionary | 更新字典 | |
| /sysDictionary/findSysDictionary | 根据ID获取字典 | |
| /sysDictionary/getSysDictionaryList | 获取字典列表 | |
| /sysOperationRecord/createSysOperationRecord | 新增操作记录 | |
| /sysOperationRecord/deleteSysOperationRecord | 删除操作记录 | |
| /sysOperationRecord/updateSysOperationRecord | 更新操作记录 | |
| /sysOperationRecord/findSysOperationRecord | 根据ID获取操作记录 | |
| /sysOperationRecord/getSysOperationRecordList | 获取操作记录列表 | |
| /autoCode/getTables | 获取数据库表 | √ |
| /autoCode/getDB | 获取所有数据库 | √ |
| /autoCode/getColume | 获取所选table的所有字段 | √ |
| /sysOperationRecord/deleteSysOperationRecordByIds | 批量删除操作历史 | |
| /simpleUploader/upload | 插件版分片上传 | |
| /simpleUploader/checkFileMd5 | 文件完整度验证 | |
| /simpleUploader/mergeFileMd5 | 上传完成合并文件 | |
server/service/sys_authority.go
浏览文件 @
cd708e3d
...
...
@@ -19,7 +19,7 @@ import (
func
CreateAuthority
(
auth
model
.
SysAuthority
)
(
err
error
,
authority
model
.
SysAuthority
)
{
var
authorityBox
model
.
SysAuthority
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
Fi
nd
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
Fi
rst
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
return
errors
.
New
(
"存在相同角色id"
),
auth
}
...
...
@@ -36,7 +36,7 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
func
CopyAuthority
(
copyInfo
response
.
SysAuthorityCopyResponse
)
(
err
error
,
authority
model
.
SysAuthority
)
{
var
authorityBox
model
.
SysAuthority
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
copyInfo
.
Authority
.
AuthorityId
)
.
Fi
nd
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
copyInfo
.
Authority
.
AuthorityId
)
.
Fi
rst
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
return
errors
.
New
(
"存在相同角色id"
),
authority
}
...
...
@@ -79,15 +79,13 @@ func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
// 删除角色
func
DeleteAuthority
(
auth
*
model
.
SysAuthority
)
(
err
error
)
{
err
=
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
Find
(
&
model
.
SysUser
{})
.
Error
if
err
==
nil
{
err
=
errors
.
New
(
"此角色有用户正在使用禁止删除"
)
return
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysUser
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
return
errors
.
New
(
"此角色有用户正在使用禁止删除"
)
}
err
=
global
.
GVA_DB
.
Where
(
"parent_id = ?"
,
auth
.
AuthorityId
)
.
Find
(
&
model
.
SysAuthority
{})
.
Error
if
err
==
nil
{
err
=
errors
.
New
(
"此角色存在子角色不允许删除"
)
return
notHas
=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"parent_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysAuthority
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
return
errors
.
New
(
"此角色存在子角色不允许删除"
)
}
db
:=
global
.
GVA_DB
.
Preload
(
"SysBaseMenus"
)
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
auth
)
.
Unscoped
()
.
Delete
(
auth
)
if
len
(
auth
.
SysBaseMenus
)
>
0
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录