Browse Source

Merge branch 'gin-vue-admin_v2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gin-vue-admin_v2_dev

main
jinlan.du 5 years ago
parent
commit
8b7fa82c4d
  1. 2
      server/api/v1/exa_customer.go
  2. 2
      server/api/v1/exa_file_upload_download.go
  3. 4
      server/api/v1/sys_api.go
  4. 2
      server/api/v1/sys_authority.go
  5. 6
      server/api/v1/sys_casbin.go
  6. 14
      server/api/v1/sys_menu.go
  7. 8
      server/api/v1/sys_user.go
  8. 2
      server/api/v1/sys_work_flow.go
  9. 641
      server/docs/docs.go
  10. 637
      server/docs/swagger.json
  11. 494
      server/docs/swagger.yaml
  12. 2
      server/resource/template/fe/api.js.tpl
  13. 4
      server/resource/template/te/api.go.tpl
  14. 7
      server/service/exa_breakpoint_continue.go
  15. 5
      server/service/exa_customer.go
  16. 4
      server/service/exa_file_upload_download.go
  17. 4
      server/service/jwt_black_list.go
  18. 6
      server/service/sys_api.go
  19. 7
      server/service/sys_authority.go
  20. 1
      server/service/sys_auto_code.go
  21. 7
      server/service/sys_base_menu.go
  22. 8
      server/service/sys_casbin.go
  23. 8
      server/service/sys_menu.go
  24. 5
      server/service/sys_system.go
  25. 6
      server/service/sys_user.go
  26. 1
      server/service/sys_workflow.go
  27. 4
      server/utils/directory.go

2
server/api/v1/exa_customer.go

@ -95,7 +95,7 @@ func GetExaCustomer(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "获取权限客户列表"
// @Param data body request.PageInfo true "获取权限客户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/customerList [get]
func GetExaCustomerList(c *gin.Context) {

2
server/api/v1/exa_file_upload_download.go

@ -85,7 +85,7 @@ func DeleteFile(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取文件户列表"
// @Param data body request.PageInfo true "分页获取文件户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fileUploadAndDownload/getFileList [post]
func GetFileList(c *gin.Context) {

4
server/api/v1/sys_api.go

@ -55,7 +55,7 @@ func DeleteApi(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SearchApiParams true "分页获取API列表"
// @Param data body request.SearchApiParams true "分页获取API列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiList [post]
func GetApiList(c *gin.Context) {
@ -80,7 +80,7 @@ func GetApiList(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.GetById true "根据id获取api"
// @Param data body request.GetById true "根据id获取api"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiById [post]
func GetApiById(c *gin.Context) {

2
server/api/v1/sys_authority.go

@ -54,7 +54,7 @@ func DeleteAuthority(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取用户列表"
// @Param data body request.PageInfo true "分页获取用户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /authority/getAuthorityList [post]
func GetAuthorityList(c *gin.Context) {

6
server/api/v1/sys_casbin.go

@ -14,7 +14,7 @@ import (
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.CasbinInReceive true "更改角色api权限"
// @Param data body request.CasbinInReceive true "更改角色api权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/UpdateCasbin [post]
func UpdateCasbin(c *gin.Context) {
@ -33,7 +33,7 @@ func UpdateCasbin(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.CasbinInReceive true "获取权限列表"
// @Param data body request.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/getPolicyPathByAuthorityId [post]
func GetPolicyPathByAuthorityId(c *gin.Context) {
@ -48,7 +48,7 @@ func GetPolicyPathByAuthorityId(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.CasbinInReceive true "获取权限列表"
// @Param data body request.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/CasbinTest [get]
func CasbinTest(c *gin.Context) {

14
server/api/v1/sys_menu.go

@ -14,7 +14,7 @@ import (
// @Summary 获取用户动态路由
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
// @Param data body request.RegisterAndLoginStruct true "可以什么都不填"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /menu/getMenu [post]
func GetMenu(c *gin.Context) {
@ -33,7 +33,7 @@ func GetMenu(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取基础menu列表"
// @Param data body request.PageInfo true "分页获取基础menu列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/getMenuList [post]
func GetMenuList(c *gin.Context) {
@ -75,7 +75,7 @@ func AddBaseMenu(c *gin.Context) {
// @Summary 获取用户动态路由
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body api.RegisterAndLoginStruct true "可以什么都不填"
// @Param data body request.RegisterAndLoginStruct true "可以什么都不填"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /menu/getBaseMenuTree [post]
func GetBaseMenuTree(c *gin.Context) {
@ -93,7 +93,7 @@ func GetBaseMenuTree(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.AddMenuAuthorityInfo true "增加menu和角色关联关系"
// @Param data body request.AddMenuAuthorityInfo true "增加menu和角色关联关系"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/addMenuAuthority [post]
func AddMenuAuthority(c *gin.Context) {
@ -113,7 +113,7 @@ func AddMenuAuthority(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.AuthorityIdInfo true "增加menu和角色关联关系"
// @Param data body request.AuthorityIdInfo true "增加menu和角色关联关系"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/GetMenuAuthority [post]
func GetMenuAuthority(c *gin.Context) {
@ -132,7 +132,7 @@ func GetMenuAuthority(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.GetById true "删除菜单"
// @Param data body request.GetById true "删除菜单"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/deleteBaseMenu [post]
func DeleteBaseMenu(c *gin.Context) {
@ -171,7 +171,7 @@ func UpdateBaseMenu(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.GetById true "根据id获取菜单"
// @Param data body request.GetById true "根据id获取菜单"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/getBaseMenuById [post]
func GetBaseMenuById(c *gin.Context) {

8
server/api/v1/sys_user.go

@ -44,7 +44,7 @@ func Register(c *gin.Context) {
// @Tags Base
// @Summary 用户登录
// @Produce application/json
// @Param data body model.RegisterAndLoginStruct true "用户登录接口"
// @Param data body request.RegisterAndLoginStruct true "用户登录接口"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
// @Router /base/login [post]
func Login(c *gin.Context) {
@ -133,7 +133,7 @@ func tokenNext(c *gin.Context, user model.SysUser) {
// @Summary 用户修改密码
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body model.ChangePasswordStutrc true "用户修改密码"
// @Param data body request.ChangePasswordStruct true "用户修改密码"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
// @Router /user/changePassword [put]
func ChangePassword(c *gin.Context) {
@ -192,7 +192,7 @@ func UploadHeaderImg(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取用户列表"
// @Param data body request.PageInfo true "分页获取用户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /user/getUserList [post]
func GetUserList(c *gin.Context) {
@ -216,7 +216,7 @@ func GetUserList(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SetUserAuth true "设置用户权限"
// @Param data body request.SetUserAuth true "设置用户权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
// @Router /user/setUserAuthority [post]
func SetUserAuthority(c *gin.Context) {

2
server/api/v1/sys_work_flow.go

@ -11,7 +11,7 @@ import (
// @Tags workflow
// @Summary 注册工作流
// @Produce application/json
// @Param data body sysModel.SysWorkflow true "注册工作流接口"
// @Param data body model.SysWorkflow true "注册工作流接口"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
// @Router /workflow/createWorkFlow [post]
func CreateWorkFlow(c *gin.Context) {

641
server/docs/docs.go
File diff suppressed because it is too large
View File

637
server/docs/swagger.json
File diff suppressed because it is too large
View File

494
server/docs/swagger.yaml

@ -1,113 +1,105 @@
basePath: /
definitions:
api.AddMenuAuthorityInfo:
config.Captcha:
properties:
authorityId:
type: string
menus:
items:
$ref: '#/definitions/sysModel.SysBaseMenu'
type: array
imgHeight:
type: integer
imgWidth:
type: integer
keyLong:
type: integer
type: object
api.AuthorityIdInfo:
config.Casbin:
properties:
authorityId:
modelPath:
type: string
type: object
api.ChangePasswordStutrc:
config.JWT:
properties:
newPassword:
type: string
password:
type: string
username:
signingKey:
type: string
type: object
api.CreateApiParams:
config.Log:
properties:
description:
type: string
path:
file:
type: string
type: object
api.CreateAuthorityParams:
properties:
authorityId:
logFile:
type: boolean
prefix:
type: string
authorityName:
stdout:
type: string
type: object
api.DeleteAuthorityPatams:
config.Mysql:
properties:
authorityId:
type: integer
type: object
api.GetById:
properties:
id:
type: number
type: object
api.IdInfo:
properties:
id:
type: number
type: object
api.RegisterAndLoginStruct:
properties:
captcha:
config:
type: string
captchaId:
dbname:
type: string
logMode:
type: boolean
maxIdleConns:
type: integer
maxOpenConns:
type: integer
password:
type: string
path:
type: string
username:
type: string
type: object
api.SetUserAuth:
config.Qiniu:
properties:
authorityId:
accessKey:
type: string
uuid:
secretKey:
type: string
type: object
config.CasbinConfig:
config.Redis:
properties:
modelPath:
description: casbin model地址配置
addr:
type: string
db:
type: integer
password:
type: string
type: object
config.Config:
config.Server:
properties:
casbinConfig:
$ref: '#/definitions/config.CasbinConfig'
captcha:
$ref: '#/definitions/config.Captcha'
type: object
casbin:
$ref: '#/definitions/config.Casbin'
type: object
jwt:
$ref: '#/definitions/config.JWT'
type: object
mysqlAdmin:
$ref: '#/definitions/config.MysqlAdmin'
log:
$ref: '#/definitions/config.Log'
type: object
mysql:
$ref: '#/definitions/config.Mysql'
type: object
qiniu:
$ref: '#/definitions/config.Qiniu'
type: object
redisAdmin:
$ref: '#/definitions/config.RedisAdmin'
redis:
$ref: '#/definitions/config.Redis'
type: object
sqlite:
$ref: '#/definitions/config.Sqlite'
type: object
system:
$ref: '#/definitions/config.System'
type: object
type: object
config.JWT:
properties:
signingKey:
type: string
type: object
config.MysqlAdmin:
config.Sqlite:
properties:
config:
type: string
dbname:
type: string
logMode:
type: boolean
password:
type: string
path:
@ -115,46 +107,45 @@ definitions:
username:
type: string
type: object
config.Qiniu:
properties:
accessKey:
type: string
secretKey:
type: string
type: object
config.RedisAdmin:
properties:
addr:
type: string
db:
type: integer
password:
type: string
type: object
config.System:
properties:
addr:
type: integer
dbType:
type: string
env:
type: string
useMultipoint:
type: boolean
type: object
dbModel.ExaCustomer:
model.AutoCodeStruct:
properties:
abbreviation:
type: string
fields:
items:
$ref: '#/definitions/model.Field'
type: array
packageName:
type: string
structName:
type: string
type: object
model.ExaCustomer:
properties:
customerName:
type: string
customerPhoneData:
type: string
sysUser:
$ref: '#/definitions/sysModel.SysUser'
$ref: '#/definitions/model.SysUser'
type: object
sysUserAuthorityID:
type: string
sysUserId:
type: integer
type: object
dbModel.ExaFileUploadAndDownload:
model.ExaFileUploadAndDownload:
properties:
key:
type: string
@ -165,41 +156,29 @@ definitions:
url:
type: string
type: object
model.PageInfo:
model.Field:
properties:
page:
type: integer
pageSize:
type: integer
type: object
sysModel.CasbinInReceive:
properties:
authorityId:
columnName:
type: string
casbinInfos:
items:
$ref: '#/definitions/sysModel.CasbinInfo'
type: array
type: object
sysModel.CasbinInfo:
properties:
method:
fieldJson:
type: string
path:
fieldName:
type: string
fieldType:
type: string
type: object
sysModel.SysApi:
model.SysApi:
properties:
description:
apiGroup:
type: string
group:
description:
type: string
method:
type: string
path:
type: string
type: object
sysModel.SysAuthority:
model.SysAuthority:
properties:
authorityId:
type: string
@ -207,20 +186,34 @@ definitions:
type: string
children:
items:
$ref: '#/definitions/sysModel.SysAuthority'
$ref: '#/definitions/model.SysAuthority'
type: array
createdAt:
type: string
dataAuthorityId:
items:
$ref: '#/definitions/sysModel.SysAuthority'
$ref: '#/definitions/model.SysAuthority'
type: array
deletedAt:
type: string
menus:
items:
$ref: '#/definitions/model.SysBaseMenu'
type: array
parentId:
type: string
updatedAt:
type: string
type: object
sysModel.SysBaseMenu:
model.SysBaseMenu:
properties:
authoritys:
items:
$ref: '#/definitions/model.SysAuthority'
type: array
children:
items:
$ref: '#/definitions/sysModel.SysBaseMenu'
$ref: '#/definitions/model.SysBaseMenu'
type: array
component:
type: string
@ -230,21 +223,19 @@ definitions:
type: string
name:
type: string
nickName:
type: string
parentId:
type: string
path:
type: string
sort:
type: string
type: integer
title:
type: string
type: object
sysModel.SysUser:
model.SysUser:
properties:
authority:
$ref: '#/definitions/sysModel.SysAuthority'
$ref: '#/definitions/model.SysAuthority'
type: object
authorityId:
type: string
@ -257,7 +248,7 @@ definitions:
uuid:
type: string
type: object
sysModel.SysWorkflow:
model.SysWorkflow:
properties:
workflowDescription:
description: 工作流描述
@ -271,10 +262,10 @@ definitions:
workflowStep:
description: 工作流步骤
items:
$ref: '#/definitions/sysModel.SysWorkflowStepInfo'
$ref: '#/definitions/model.SysWorkflowStepInfo'
type: array
type: object
sysModel.SysWorkflowStepInfo:
model.SysWorkflowStepInfo:
properties:
isEnd:
description: 是否是完结流节点
@ -295,18 +286,103 @@ definitions:
description: 所属工作流ID
type: integer
type: object
sysModel.System:
model.System:
properties:
config:
$ref: '#/definitions/config.Config'
$ref: '#/definitions/config.Server'
type: object
type: object
request.AddMenuAuthorityInfo:
properties:
authorityId:
type: string
menus:
items:
$ref: '#/definitions/model.SysBaseMenu'
type: array
type: object
request.AuthorityIdInfo:
properties:
authorityId:
type: string
type: object
request.CasbinInReceive:
properties:
authorityId:
type: string
casbinInfos:
items:
$ref: '#/definitions/request.CasbinInfo'
type: array
type: object
request.CasbinInfo:
properties:
method:
type: string
path:
type: string
type: object
request.ChangePasswordStruct:
properties:
newPassword:
type: string
password:
type: string
username:
type: string
type: object
request.GetById:
properties:
id:
type: number
type: object
request.PageInfo:
properties:
page:
type: integer
pageSize:
type: integer
type: object
request.RegisterAndLoginStruct:
properties:
captcha:
type: string
captchaId:
type: string
password:
type: string
username:
type: string
type: object
request.SearchApiParams:
properties:
apiGroup:
type: string
desc:
type: boolean
description:
type: string
method:
type: string
orderKey:
type: string
page:
type: integer
pageSize:
type: integer
path:
type: string
type: object
request.SetUserAuth:
properties:
authorityId:
type: string
uuid:
type: string
type: object
info:
contact: {}
description: This is a sample Server pets
license: {}
title: Swagger Example API
version: 0.0.1
paths:
/api/createApi:
post:
@ -318,7 +394,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.CreateApiParams'
$ref: '#/definitions/model.SysApi'
type: object
produces:
- application/json
@ -342,7 +418,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysApi'
$ref: '#/definitions/model.SysApi'
type: object
produces:
- application/json
@ -377,12 +453,12 @@ paths:
consumes:
- application/json
parameters:
- description: 分页获取用户列表
- description: 根据id获取api
in: body
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.GetById'
type: object
produces:
- application/json
@ -406,7 +482,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.SearchApiParams'
type: object
produces:
- application/json
@ -430,7 +506,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.CreateApiParams'
$ref: '#/definitions/model.SysApi'
type: object
produces:
- application/json
@ -454,7 +530,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.CreateAuthorityParams'
$ref: '#/definitions/model.SysAuthority'
type: object
produces:
- application/json
@ -478,7 +554,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.DeleteAuthorityPatams'
$ref: '#/definitions/model.SysAuthority'
type: object
produces:
- application/json
@ -502,7 +578,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.PageInfo'
type: object
produces:
- application/json
@ -526,7 +602,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysAuthority'
$ref: '#/definitions/model.SysAuthority'
type: object
produces:
- application/json
@ -540,6 +616,30 @@ paths:
summary: 设置角色资源权限
tags:
- authority
/autoCode/createTemp:
post:
consumes:
- application/json
parameters:
- description: 创建自动代码
in: body
name: data
required: true
schema:
$ref: '#/definitions/model.AutoCodeStruct'
type: object
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"创建成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 自动代码模板
tags:
- SysApi
/base/captcha:
post:
consumes:
@ -580,7 +680,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.RegisterAndLoginStruct'
$ref: '#/definitions/request.RegisterAndLoginStruct'
type: object
produces:
- application/json
@ -600,7 +700,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysUser'
$ref: '#/definitions/model.SysUser'
type: object
produces:
- application/json
@ -622,7 +722,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.CreateAuthorityParams'
$ref: '#/definitions/request.CasbinInReceive'
type: object
produces:
- application/json
@ -646,7 +746,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.CasbinInReceive'
$ref: '#/definitions/request.CasbinInReceive'
type: object
produces:
- application/json
@ -670,7 +770,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.CreateAuthorityParams'
$ref: '#/definitions/request.CasbinInReceive'
type: object
produces:
- application/json
@ -684,17 +784,17 @@ paths:
summary: 获取权限列表
tags:
- casbin
/customer/createExaCustomer:
post:
/customer/customer:
delete:
consumes:
- application/json
parameters:
- description: 创建客户
- description: 删除客户
in: body
name: data
required: true
schema:
$ref: '#/definitions/dbModel.ExaCustomer'
$ref: '#/definitions/model.ExaCustomer'
type: object
produces:
- application/json
@ -705,20 +805,19 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 创建客户
summary: 删除客户
tags:
- SysApi
/customer/deleteExaCustomer:
post:
get:
consumes:
- application/json
parameters:
- description: 删除客户
- description: 获取单一客户信息
in: body
name: data
required: true
schema:
$ref: '#/definitions/dbModel.ExaCustomer'
$ref: '#/definitions/model.ExaCustomer'
type: object
produces:
- application/json
@ -729,20 +828,19 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 删除客户
summary: 获取单一客户信息
tags:
- SysApi
/customer/getExaCustomer:
post:
consumes:
- application/json
parameters:
- description: 获取单一客户信息
- description: 创建客户
in: body
name: data
required: true
schema:
$ref: '#/definitions/dbModel.ExaCustomer'
$ref: '#/definitions/model.ExaCustomer'
type: object
produces:
- application/json
@ -753,20 +851,19 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 获取单一客户信息
summary: 创建客户
tags:
- SysApi
/customer/getExaCustomerList:
post:
put:
consumes:
- application/json
parameters:
- description: 获取权限客户列表
- description: 创建客户
in: body
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/model.ExaCustomer'
type: object
produces:
- application/json
@ -777,20 +874,20 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 获取权限客户列表
summary: 更新客户信息
tags:
- SysApi
/customer/updateExaCustomer:
post:
/customer/customerList:
get:
consumes:
- application/json
parameters:
- description: 创建客户
- description: 获取权限客户列表
in: body
name: data
required: true
schema:
$ref: '#/definitions/dbModel.ExaCustomer'
$ref: '#/definitions/request.PageInfo'
type: object
produces:
- application/json
@ -801,7 +898,7 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 更新客户信息
summary: 获取权限客户列表
tags:
- SysApi
/fileUploadAndDownload/breakpointContinue:
@ -809,7 +906,7 @@ paths:
consumes:
- multipart/form-data
parameters:
- description: 断点续传示例
- description: an example for breakpoint resume, 断点续传示例
in: formData
name: file
required: true
@ -834,7 +931,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/dbModel.ExaFileUploadAndDownload'
$ref: '#/definitions/model.ExaFileUploadAndDownload'
type: object
produces:
- application/json
@ -853,7 +950,7 @@ paths:
consumes:
- multipart/form-data
parameters:
- description: 查找文件
- description: 上传文件完成
in: formData
name: file
required: true
@ -862,7 +959,7 @@ paths:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"查找成功"}'
description: '{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}'
schema:
type: string
security:
@ -880,7 +977,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.PageInfo'
type: object
produces:
- application/json
@ -899,7 +996,7 @@ paths:
consumes:
- multipart/form-data
parameters:
- description: 查找文件
- description: 删除缓存切片
in: formData
name: file
required: true
@ -954,6 +1051,30 @@ paths:
summary: jwt加入黑名单
tags:
- jwt
/menu/GetMenuAuthority:
post:
consumes:
- application/json
parameters:
- description: 增加menu和角色关联关系
in: body
name: data
required: true
schema:
$ref: '#/definitions/request.AuthorityIdInfo'
type: object
produces:
- application/json
responses:
"200":
description: '{"success":true,"data":{},"msg":"获取成功"}'
schema:
type: string
security:
- ApiKeyAuth: []
summary: 获取指定角色menu
tags:
- authorityAndMenu
/menu/addBaseMenu:
post:
consumes:
@ -964,7 +1085,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysBaseMenu'
$ref: '#/definitions/model.SysBaseMenu'
type: object
produces:
- application/json
@ -988,7 +1109,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.AuthorityIdInfo'
$ref: '#/definitions/request.AddMenuAuthorityInfo'
type: object
produces:
- application/json
@ -999,7 +1120,7 @@ paths:
type: string
security:
- ApiKeyAuth: []
summary: 获取指定角色menu
summary: 增加menu和角色关联关系
tags:
- authorityAndMenu
/menu/deleteBaseMenu:
@ -1012,7 +1133,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.IdInfo'
$ref: '#/definitions/request.GetById'
type: object
produces:
- application/json
@ -1036,7 +1157,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.GetById'
$ref: '#/definitions/request.GetById'
type: object
produces:
- application/json
@ -1058,7 +1179,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.RegisterAndLoginStruct'
$ref: '#/definitions/request.RegisterAndLoginStruct'
type: object
produces:
- application/json
@ -1080,7 +1201,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.RegisterAndLoginStruct'
$ref: '#/definitions/request.RegisterAndLoginStruct'
type: object
produces:
- application/json
@ -1104,7 +1225,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.PageInfo'
type: object
produces:
- application/json
@ -1118,7 +1239,7 @@ paths:
summary: 分页获取基础menu列表
tags:
- menu
/menu/updateBaseMen:
/menu/updateBaseMenu:
post:
consumes:
- application/json
@ -1128,7 +1249,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysBaseMenu'
$ref: '#/definitions/model.SysBaseMenu'
type: object
produces:
- application/json
@ -1150,7 +1271,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.System'
$ref: '#/definitions/model.System'
type: object
produces:
- application/json
@ -1186,7 +1307,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.System'
$ref: '#/definitions/model.System'
type: object
produces:
- application/json
@ -1201,14 +1322,14 @@ paths:
tags:
- system
/user/changePassword:
post:
put:
parameters:
- description: 用户修改密码
in: body
name: data
required: true
schema:
$ref: '#/definitions/api.ChangePasswordStutrc'
$ref: '#/definitions/request.ChangePasswordStruct'
type: object
produces:
- application/json
@ -1232,7 +1353,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/model.PageInfo'
$ref: '#/definitions/request.PageInfo'
type: object
produces:
- application/json
@ -1256,7 +1377,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/api.SetUserAuth'
$ref: '#/definitions/request.SetUserAuth'
type: object
produces:
- application/json
@ -1305,7 +1426,7 @@ paths:
name: data
required: true
schema:
$ref: '#/definitions/sysModel.SysWorkflow'
$ref: '#/definitions/model.SysWorkflow'
type: object
produces:
- application/json
@ -1317,9 +1438,4 @@ paths:
summary: 注册工作流
tags:
- workflow
securityDefinitions:
ApiKeyAuth:
in: header
name: x-token
type: apiKey
swagger: "2.0"

2
server/resource/template/fe/api.js.tpl

@ -72,7 +72,7 @@ export const create{{.StructName}} = (data) => {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取{{.StructName}}列表"
// @Param data body request.PageInfo true "分页获取{{.StructName}}列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /{{.Abbreviation}}/get{{.StructName}}List [post]
export const get{{.StructName}}List = (data) => {

4
server/resource/template/te/api.go.tpl

@ -97,11 +97,11 @@ func Find{{.StructName}}(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.PageInfo true "分页获取{{.StructName}}列表"
// @Param data body request.PageInfo true "分页获取{{.StructName}}列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /{{.Abbreviation}}/get{{.StructName}}List [post]
func Get{{.StructName}}List(c *gin.Context) {
var pageInfo model.PageInfo
var pageInfo request.PageInfo
_ = c.ShouldBindJSON(&pageInfo)
err, list, total := new({{.PackageName}}.{{.StructName}}).GetInfoList(pageInfo)
if err != nil {

7
server/service/exa_breakpoint_continue.go

@ -14,7 +14,8 @@ import (
// @param chunkTotal int
// @return err error
// @return file ExaFile
func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err error, file model.ExaFile) {
func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err error, file model.ExaFile) {
var cfile model.ExaFile
cfile.FileMd5 = fileMd5
cfile.FileName = fileName
@ -31,7 +32,6 @@ func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err err
}
}
// @title CreateFileChunk
// @description create a chunk of the file, 创建文件切片记录
// @auth (2020/04/05 20:22)
@ -39,6 +39,7 @@ func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err err
// @param fileChunkPath string
// @param fileChunkNumber int
// @return error
func CreateFileChunk(id uint, fileChunkPath string, fileChunkNumber int) error {
var chunk model.ExaFileChunk
chunk.FileChunkPath = fileChunkPath
@ -55,6 +56,7 @@ func CreateFileChunk(id uint, fileChunkPath string, fileChunkNumber int) error {
// @param fileName string
// @param filePath string
// @return error
func FileCreateComplete(fileMd5 string, fileName string, filePath string) error {
var file model.ExaFile
upDateFile := make(map[string]interface{})
@ -71,6 +73,7 @@ func FileCreateComplete(fileMd5 string, fileName string, filePath string) error
// @param FileName string
// @param FilePath string
// @return error
func DeleteFileChunk(fileMd5 string, fileName string, filePath string) error {
var chunks []model.ExaFileChunk
var file model.ExaFile

5
server/service/exa_customer.go

@ -11,6 +11,7 @@ import (
// @param e model.ExaCustomer
// @auth (2020/04/05 20:22)
// @return err error
func CreateExaCustomer(e model.ExaCustomer) (err error) {
err = global.GVA_DB.Create(&e).Error
return err
@ -21,6 +22,7 @@ func CreateExaCustomer(e model.ExaCustomer) (err error) {
// @auth (2020/04/05 20:22)
// @param e *model.ExaCustomer
// @return error
func DeleteExaCustomer(e model.ExaCustomer) (err error) {
err = global.GVA_DB.Delete(e).Error
return err
@ -31,6 +33,7 @@ func DeleteExaCustomer(e model.ExaCustomer) (err error) {
// @param e *model.ExaCustomer
// @auth (2020/04/05 20:22)
// @return error
func UpdateExaCustomer(e *model.ExaCustomer) (err error) {
err = global.GVA_DB.Save(e).Error
return err
@ -42,6 +45,7 @@ func UpdateExaCustomer(e *model.ExaCustomer) (err error) {
// @param id uint
// @return error
// @return customer ExaCustomer
func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) {
err = global.GVA_DB.Where("id = ?", id).First(&customer).Error
return
@ -53,6 +57,7 @@ func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) {
// @param sysUserAuthorityID string
// @param info PageInfo
// @return error
func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)

4
server/service/exa_file_upload_download.go

@ -11,6 +11,7 @@ import (
// @param file model.ExaFileUploadAndDownload
// @auth (2020/04/05 20:22)
// @return error
func Upload(file model.ExaFileUploadAndDownload) error {
err := global.GVA_DB.Create(&file).Error
return err
@ -21,6 +22,7 @@ func Upload(file model.ExaFileUploadAndDownload) error {
// @auth (2020/04/05 20:22)
// @param id uint
// @return error
func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
var file model.ExaFileUploadAndDownload
err := global.GVA_DB.Where("id = ?", id).First(&file).Error
@ -32,6 +34,7 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
// @auth (2020/04/05 20:22)
// @param file model.ExaFileUploadAndDownload
// @return error
func DeleteFile(file model.ExaFileUploadAndDownload) error {
err := global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(file).Error
return err
@ -44,6 +47,7 @@ func DeleteFile(file model.ExaFileUploadAndDownload) error {
// @return err error
// @return list error
// @return total error
func GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)

4
server/service/jwt_black_list.go

@ -10,6 +10,7 @@ import (
// @param jwtList model.JwtBlacklist
// @auth (2020/04/05 20:22)
// @return err error
func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) {
err = global.GVA_DB.Create(&jwtList).Error
return
@ -21,6 +22,7 @@ func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) {
// @param jwt string
// @param jwtList model.JwtBlacklist
// @return err error
func IsBlacklist(jwt string, jwtList model.JwtBlacklist) bool {
isNotFound := global.GVA_DB.Where("jwt = ?", jwt).First(&jwtList).RecordNotFound()
return !isNotFound
@ -32,6 +34,7 @@ func IsBlacklist(jwt string, jwtList model.JwtBlacklist) bool {
// @param userName string
// @return err error
// @return redisJWT string
func GetRedisJWT(userName string) (err error, redisJWT string) {
redisJWT, err = global.GVA_REDIS.Get(userName).Result()
return err, redisJWT
@ -43,6 +46,7 @@ func GetRedisJWT(userName string) (err error, redisJWT string) {
// @param jwtList model.JwtBlacklist
// @param userName string
// @return err error
func SetRedisJWT(jwtList model.JwtBlacklist, userName string) (err error) {
err = global.GVA_REDIS.Set(userName, jwtList.Jwt, 1000*1000*1000*60*60*24*7).Err()
return err

6
server/service/sys_api.go

@ -12,6 +12,7 @@ import (
// @auth (2020/04/05 20:22)
// @param api model.SysApi
// @return error
func CreateApi(api model.SysApi) (err error) {
findOne := global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).Find(&model.SysApi{}).Error
if findOne == nil {
@ -27,6 +28,7 @@ func CreateApi(api model.SysApi) (err error) {
// @param api model.SysApi
// @auth (2020/04/05 20:22)
// @return error
func DeleteApi(api model.SysApi) (err error) {
err = global.GVA_DB.Delete(api).Error
ClearCasbin(1, api.Path, api.Method)
@ -43,6 +45,7 @@ func DeleteApi(api model.SysApi) (err error) {
// @return err error
// @return list interface{}
// @return total int
func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
@ -91,6 +94,7 @@ func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc
// @auth (2020/04/05 20:22)
// @return err error
// @return apis []SysApi
func GetAllApis() (err error, apis []model.SysApi) {
err = global.GVA_DB.Find(&apis).Error
return
@ -102,6 +106,7 @@ func GetAllApis() (err error, apis []model.SysApi) {
// @param api model.SysApi
// @param id float64
// @return error
func GetApiById(id float64) (err error, api model.SysApi) {
err = global.GVA_DB.Where("id = ?", id).First(&api).Error
return
@ -112,6 +117,7 @@ func GetApiById(id float64) (err error, api model.SysApi) {
// @auth (2020/04/05 20:22)
// @param api model.SysApi
// @return error
func UpdateApi(api model.SysApi) (err error) {
var oldA model.SysApi

7
server/service/sys_authority.go

@ -13,6 +13,7 @@ import (
// @param auth model.SysAuthority
// @return error
// @return authority model.SysAuthority
func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
err = global.GVA_DB.Create(&auth).Error
return err, auth
@ -24,6 +25,7 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
// @param auth model.SysAuthority
// @return error
// 删除角色
func DeleteAuthority(auth *model.SysAuthority) (err error) {
err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).Find(&model.SysUser{}).Error
if err == nil {
@ -51,6 +53,7 @@ func DeleteAuthority(auth *model.SysAuthority) (err error) {
// @param info request.PaveInfo
// @return error
// 分页获取数据
func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
@ -71,6 +74,7 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t
// @param auth model.SysAuthority
// @return error
// @param authority model.SysAuthority
func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error
return err, sa
@ -81,6 +85,7 @@ func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority
// @auth (2020/04/05 20:22)
// @param auth model.SysAuthority
// @return error
func SetDataAuthority(auth model.SysAuthority) error {
var s model.SysAuthority
global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId)
@ -93,6 +98,7 @@ func SetDataAuthority(auth model.SysAuthority) error {
// @auth (2020/04/05 20:22)
// @param auth *model.SysAuthority
// @return error
func SetMenuAuthority(auth *model.SysAuthority) error {
var s model.SysAuthority
global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", auth.AuthorityId)
@ -105,6 +111,7 @@ func SetMenuAuthority(auth *model.SysAuthority) error {
// @auth (2020/04/05 20:22)
// @param auth *model.SysAuthority
// @return error
func findChildrenAuthority(authority *model.SysAuthority) (err error) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
if len(authority.Children) > 0 {

1
server/service/sys_auto_code.go

@ -12,6 +12,7 @@ import (
// @auth (2020/04/05 20:22)
// @param autoCode model.AutoCodeStruct
// @return err error
func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
basePath := "./resource/template"
modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")

7
server/service/sys_base_menu.go

@ -11,7 +11,8 @@ import (
// @auth (2020/04/05 20:22)
// @param id float64
// @return err error
func DeleteBaseMenu(id float64) (err error) {
func DeleteBaseMenu(id float64) (err error) {
err = global.GVA_DB.Where("parent_id = ?", id).First(&model.SysBaseMenu{}).Error
if err != nil {
var menu model.SysBaseMenu
@ -32,7 +33,8 @@ func DeleteBaseMenu(id float64) (err error) {
// @auth (2020/04/05 20:22)
// @param menu model.SysBaseMenu
// @return err error
func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
upDateMap := make(map[string]interface{})
upDateMap["parent_id"] = menu.ParentId
upDateMap["path"] = menu.Path
@ -52,6 +54,7 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
// @auth (2020/04/05 20:22)
// @param id float64
// @return err error
func GetBaseMenuById(id float64) (err error, menu model.SysBaseMenu) {
err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
return

8
server/service/sys_casbin.go

@ -17,6 +17,7 @@ import (
// @param authorityId string
// @param casbinInfos []CasbinInfo
// @return error
func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error {
ClearCasbin(0, authorityId)
for _, v := range casbinInfos {
@ -40,6 +41,7 @@ func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error {
// @auth (2020/04/05 20:22)
// @param cm model.CasbinModel
// @return bool
func AddCasbin(cm model.CasbinModel) bool {
e := Casbin()
return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method)
@ -53,6 +55,7 @@ func AddCasbin(cm model.CasbinModel) bool {
// @param oldMethod string
// @param newMethod string
// @return error
func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error {
var cs []model.CasbinModel
err := global.GVA_DB.Table("casbin_rule").Where("v1 = ? AND v2 = ?", oldPath, oldMethod).Find(&cs).Updates(map[string]string{
@ -67,6 +70,7 @@ func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod
// @auth (2020/04/05 20:22)
// @param authorityId string
// @return []string
func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []map[string]string) {
e := Casbin()
list := e.GetFilteredPolicy(0, authorityId)
@ -85,6 +89,7 @@ func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []map[string]strin
// @param v int
// @param p string
// @return bool
func ClearCasbin(v int, p ...string) bool {
e := Casbin()
return e.RemoveFilteredPolicy(v, p...)
@ -94,6 +99,7 @@ func ClearCasbin(v int, p ...string) bool {
// @title Casbin
// @description store to DB, 持久化到数据库 引入自定义规则
// @auth (2020/04/05 20:22)
func Casbin() *casbin.Enforcer {
a := gormadapter.NewAdapterByDB(global.GVA_DB)
e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a)
@ -108,6 +114,7 @@ func Casbin() *casbin.Enforcer {
// @param fullNameKey1 string
// @param key2 string
// @return bool
func ParamsMatch(fullNameKey1 string, key2 string) bool {
key1 := strings.Split(fullNameKey1, "?")[0]
//剥离路径后再使用casbin的keyMatch2
@ -120,6 +127,7 @@ func ParamsMatch(fullNameKey1 string, key2 string) bool {
// @param args ...interface{}
// @return interface{}
// @return error
func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
name1 := args[0].(string)
name2 := args[1].(string)

8
server/service/sys_menu.go

@ -13,6 +13,7 @@ import (
// @param authorityId string
// @return err error
// @return menus []model.SysMenu
func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?"
@ -29,6 +30,7 @@ func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
// @param menu *model.SysMenu
// @param sql string
// @return err error
func getChildrenList(menu *model.SysMenu, sql string) (err error) {
err = global.GVA_DB.Raw(sql, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error
for i := 0; i < len(menu.Children); i++ {
@ -44,6 +46,7 @@ func getChildrenList(menu *model.SysMenu, sql string) (err error) {
// @return err error
// @return list interface{}
// @return total int
func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
@ -61,6 +64,7 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int)
// @auth (2020/04/05 20:22)
// @param menu *model.SysBaseMenu
// @return err error
func getBaseChildrenList(menu *model.SysBaseMenu) (err error) {
err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
for i := 0; i < len(menu.Children); i++ {
@ -75,6 +79,7 @@ func getBaseChildrenList(menu *model.SysBaseMenu) (err error) {
// @param menu *model.SysBaseMenu
// @return err error
//增加基础路由
func AddBaseMenu(menu model.SysBaseMenu) (err error) {
findOne := global.GVA_DB.Where("name = ?", menu.Name).Find(&model.SysBaseMenu{}).Error
if findOne != nil {
@ -90,6 +95,7 @@ func AddBaseMenu(menu model.SysBaseMenu) (err error) {
// @auth (2020/04/05 20:22)
// @return err error
// @return menus []SysBaseMenu
func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) {
err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
for i := 0; i < len(menus); i++ {
@ -104,6 +110,7 @@ func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) {
// @param menus []model.SysBaseMenu
// @param authorityId string
// @return error
func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) {
var auth model.SysAuthority
auth.AuthorityId = authorityId
@ -118,6 +125,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error)
// @param authorityId string
// @return err error
// @return menus []SysBaseMenu
func GetMenuAuthority(authorityId string) (err error, menus []model.SysMenu) {
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ?"
err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error

5
server/service/sys_system.go

@ -12,16 +12,17 @@ import (
// @auth (2020/04/05 20:22)
// @return err error
// @return conf Server
func GetSystemConfig() (err error, conf config.Server) {
return nil, global.GVA_CONFIG
}
// @title SetSystemConfig
// @description set system config, 设置配置文件
// @auth (2020/04/05 20:22)
// @param system model.System
// @return err error
func SetSystemConfig(system model.System) (err error) {
cs := utils.StructToMap(system.Config)
for k, v := range cs {
@ -29,4 +30,4 @@ func SetSystemConfig(system model.System) (err error) {
}
err = global.GVA_VP.WriteConfig()
return err
}
}

6
server/service/sys_user.go

@ -15,6 +15,7 @@ import (
// @param u model.SysUser
// @return err error
// @return userInter *SysUser
func Register(u model.SysUser) (err error, userInter model.SysUser) {
var user model.SysUser
//判断用户名是否注册
@ -37,6 +38,7 @@ func Register(u model.SysUser) (err error, userInter model.SysUser) {
// @param u *model.SysUser
// @return err error
// @return userInter *SysUser
func Login(u *model.SysUser) (err error, userInter *model.SysUser) {
var user model.SysUser
u.Password = utils.MD5V([]byte(u.Password))
@ -55,6 +57,7 @@ func Login(u *model.SysUser) (err error, userInter *model.SysUser) {
// @param newPassword string
// @return err error
// @return userInter *SysUser
func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter *model.SysUser) {
var user model.SysUser
//后期修改jwt+password模式
@ -70,6 +73,7 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
// @return err error
// @return list interface{}
// @return total int
func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
@ -85,6 +89,7 @@ func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total
// @param uuid UUID
// @param authorityId string
// @return err error
func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) {
err = global.GVA_DB.Where("uuid = ?", uuid).First(&model.SysUser{}).Update("authority_id", authorityId).Error
return err
@ -97,6 +102,7 @@ func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) {
// @param filePath string
// @return err error
// @return userInter *SysUser
func UploadHeaderImg(uuid uuid.UUID, filePath string) (err error, userInter *model.SysUser) {
var user model.SysUser
err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error

1
server/service/sys_workflow.go

@ -10,6 +10,7 @@ import (
// @auth (2020/04/05 20:22)
// @param wk model.SysWorkflow
// @return error
func Create(wk model.SysWorkflow) error {
err := global.GVA_DB.Create(&wk).Error
return err

4
server/utils/directory.go

@ -10,6 +10,7 @@ import (
// @auth (2020/04/05 20:22)
// @param path string
// @return err error
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
@ -26,6 +27,7 @@ func PathExists(path string) (bool, error) {
// @auth (2020/04/05 20:22)
// @param dirs string
// @return err error
func CreateDir(dirs ...string) (err error) {
for _, v := range dirs {
exist, err := PathExists(v)
@ -48,9 +50,11 @@ func CreateDir(dirs ...string) (err error) {
}
return err
}
// @title cwd
// @description 获取当前工作目录
// @return string
func CWD() string {
path, err := os.Executable()
if err != nil {

Loading…
Cancel
Save