模块化变更

This commit is contained in:
pixel
2021-07-16 20:08:11 +08:00
parent 73a8052c08
commit b5c1babec9
121 changed files with 643 additions and 574 deletions

View File

@@ -1,14 +0,0 @@
package model
import (
"gin-vue-admin/global"
)
type ExaCustomer struct {
global.GVA_MODEL
CustomerName string `json:"customerName" form:"customerName" gorm:"comment:客户名"` // 客户名
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:客户手机号"` // 客户手机号
SysUserID uint `json:"sysUserId" form:"sysUserId" gorm:"comment:管理ID"` // 管理ID
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:管理角色ID"` // 管理角色ID
SysUser SysUser `json:"sysUser" form:"sysUser" gorm:"comment:管理详情"` // 管理详情
}

View File

@@ -1,6 +0,0 @@
package model
type ExcelInfo struct {
FileName string `json:"fileName"` // 文件名
InfoList []SysBaseMenu `json:"infoList"`
}

View File

@@ -1,4 +1,4 @@
package model
package example
import (
"gin-vue-admin/global"

View File

@@ -0,0 +1,15 @@
package example
import (
"gin-vue-admin/global"
"gin-vue-admin/model/system"
)
type ExaCustomer struct {
global.GVA_MODEL
CustomerName string `json:"customerName" form:"customerName" gorm:"comment:客户名"` // 客户名
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:客户手机号"` // 客户手机号
SysUserID uint `json:"sysUserId" form:"sysUserId" gorm:"comment:管理ID"` // 管理ID
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:管理角色ID"` // 管理角色ID
SysUser system.SysUser `json:"sysUser" form:"sysUser" gorm:"comment:管理详情"` // 管理详情
}

View File

@@ -0,0 +1,8 @@
package example
import "gin-vue-admin/model/system"
type ExcelInfo struct {
FileName string `json:"fileName"` // 文件名
InfoList []system.SysBaseMenu `json:"infoList"`
}

View File

@@ -1,4 +1,4 @@
package model
package example
import (
"gin-vue-admin/global"

View File

@@ -1,4 +1,4 @@
package model
package example
type ExaSimpleUploader struct {
ChunkNumber string `json:"chunkNumber" gorm:"comment:当前切片标记"`

View File

@@ -0,0 +1,23 @@
package request
// Paging common input parameter structure
type PageInfo struct {
Page int `json:"page" form:"page"` // 页码
PageSize int `json:"pageSize" form:"pageSize"` // 每页大小
}
// Find by id structure
type GetById struct {
ID float64 `json:"id" form:"id"` // 主键ID
}
type IdsReq struct {
Ids []int `json:"ids" form:"ids"`
}
// Get role by id structure
type GetAuthorityId struct {
AuthorityId string // 角色ID
}
type Empty struct{}

View File

@@ -0,0 +1,17 @@
package request
import (
"github.com/dgrijalva/jwt-go"
uuid "github.com/satori/go.uuid"
)
// Custom claims structure
type CustomClaims struct {
UUID uuid.UUID
ID uint
Username string
NickName string
AuthorityId string
BufferTime int64
jwt.StandardClaims
}

View File

@@ -1,11 +1,11 @@
package response
import "gin-vue-admin/model"
import "gin-vue-admin/model/example"
type FilePathResponse struct {
FilePath string `json:"filePath"`
}
type FileResponse struct {
File model.ExaFile `json:"file"`
File example.ExaFile `json:"file"`
}

View File

@@ -0,0 +1,7 @@
package response
import "gin-vue-admin/model/example"
type ExaCustomerResponse struct {
Customer example.ExaCustomer `json:"customer"`
}

View File

@@ -0,0 +1,7 @@
package response
import "gin-vue-admin/model/example"
type ExaFileResponse struct {
File example.ExaFileUploadAndDownload `json:"file"`
}

View File

@@ -1,8 +0,0 @@
package request
import "gin-vue-admin/model"
type SysDictionarySearch struct {
model.SysDictionary
PageInfo
}

View File

@@ -1,8 +0,0 @@
package request
import "gin-vue-admin/model"
type SysDictionaryDetailSearch struct {
model.SysDictionaryDetail
PageInfo
}

View File

@@ -1,8 +0,0 @@
package request
import "gin-vue-admin/model"
type SysOperationRecordSearch struct {
model.SysOperationRecord
PageInfo
}

View File

@@ -1,7 +0,0 @@
package response
import "gin-vue-admin/model"
type ExaCustomerResponse struct {
Customer model.ExaCustomer `json:"customer"`
}

View File

@@ -1,7 +0,0 @@
package response
import "gin-vue-admin/model"
type ExaFileResponse struct {
File model.ExaFileUploadAndDownload `json:"file"`
}

View File

@@ -1,11 +0,0 @@
package response
import "gin-vue-admin/model"
type SysAPIResponse struct {
Api model.SysApi `json:"api"`
}
type SysAPIListResponse struct {
Apis []model.SysApi `json:"apis"`
}

View File

@@ -1,12 +0,0 @@
package response
import "gin-vue-admin/model"
type SysAuthorityResponse struct {
Authority model.SysAuthority `json:"authority"`
}
type SysAuthorityCopyResponse struct {
Authority model.SysAuthority `json:"authority"`
OldAuthorityId string `json:"oldAuthorityId"` // 旧角色ID
}

View File

@@ -1,15 +0,0 @@
package response
import "gin-vue-admin/model"
type SysMenusResponse struct {
Menus []model.SysMenu `json:"menus"`
}
type SysBaseMenusResponse struct {
Menus []model.SysBaseMenu `json:"menus"`
}
type SysBaseMenuResponse struct {
Menu model.SysBaseMenu `json:"menu"`
}

View File

@@ -1,15 +0,0 @@
package response
import (
"gin-vue-admin/model"
)
type SysUserResponse struct {
User model.SysUser `json:"user"`
}
type LoginResponse struct {
User model.SysUser `json:"user"`
Token string `json:"token"`
ExpiresAt int64 `json:"expiresAt"`
}

View File

@@ -1,36 +0,0 @@
package model
import (
"gin-vue-admin/global"
)
type SysBaseMenu struct {
global.GVA_MODEL
MenuLevel uint `json:"-"`
ParentId string `json:"parentId" gorm:"comment:父菜单ID"` // 父菜单ID
Path string `json:"path" gorm:"comment:路由path"` // 路由path
Name string `json:"name" gorm:"comment:路由name"` // 路由name
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` // 是否在列表隐藏
Component string `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
Sort int `json:"sort" gorm:"comment:排序标记"` // 排序标记
Meta `json:"meta" gorm:"comment:附加属性"` // 附加属性
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
Children []SysBaseMenu `json:"children" gorm:"-"`
Parameters []SysBaseMenuParameter `json:"parameters"`
}
type Meta struct {
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"` // 是否缓存
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
Title string `json:"title" gorm:"comment:菜单名"` // 菜单名
Icon string `json:"icon" gorm:"comment:菜单图标"` // 菜单图标
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
}
type SysBaseMenuParameter struct {
global.GVA_MODEL
SysBaseMenuID uint
Type string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
Key string `json:"key" gorm:"comment:地址栏携带参数的key"` // 地址栏携带参数的key
Value string `json:"value" gorm:"comment:地址栏携带参数的值"` // 地址栏携带参数的值
}

View File

@@ -1,10 +1,12 @@
package request
import "gin-vue-admin/model"
import (
"gin-vue-admin/model/system"
)
// api分页条件查询及排序结构体
type SearchApiParams struct {
model.SysApi
system.SysApi
PageInfo
OrderKey string `json:"orderKey"` // 排序
Desc bool `json:"desc"` // 排序方式:升序false(默认)|降序true

View File

@@ -1,7 +1,9 @@
package request
import "gin-vue-admin/model/request"
type SysAutoHistory struct {
PageInfo
request.PageInfo
}
type AutoHistoryByID struct {

View File

@@ -0,0 +1,11 @@
package request
import (
"gin-vue-admin/model/request"
"gin-vue-admin/model/system"
)
type SysDictionarySearch struct {
system.SysDictionary
request.PageInfo
}

View File

@@ -0,0 +1,11 @@
package request
import (
"gin-vue-admin/model/request"
"gin-vue-admin/model/system"
)
type SysDictionaryDetailSearch struct {
system.SysDictionaryDetail
request.PageInfo
}

View File

@@ -2,24 +2,24 @@ package request
import (
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/model/system"
)
// Add menu authority info structure
type AddMenuAuthorityInfo struct {
Menus []model.SysBaseMenu
Menus []system.SysBaseMenu
AuthorityId string // 角色ID
}
func DefaultMenu() []model.SysBaseMenu {
return []model.SysBaseMenu{{
func DefaultMenu() []system.SysBaseMenu {
return []system.SysBaseMenu{{
GVA_MODEL: global.GVA_MODEL{ID: 1},
ParentId: "0",
Path: "dashboard",
Name: "dashboard",
Component: "view/dashboard/index.vue",
Sort: 1,
Meta: model.Meta{
Meta: system.Meta{
Title: "仪表盘",
Icon: "setting",
},

View File

@@ -0,0 +1,11 @@
package request
import (
"gin-vue-admin/model/request"
"gin-vue-admin/model/system"
)
type SysOperationRecordSearch struct {
system.SysOperationRecord
request.PageInfo
}

View File

@@ -0,0 +1,8 @@
package response
type PageResult struct {
List interface{} `json:"list"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}

View File

@@ -0,0 +1,11 @@
package response
import "gin-vue-admin/model/system"
type SysAPIResponse struct {
Api system.SysApi `json:"api"`
}
type SysAPIListResponse struct {
Apis []system.SysApi `json:"apis"`
}

View File

@@ -0,0 +1,12 @@
package response
import "gin-vue-admin/model/system"
type SysAuthorityResponse struct {
Authority system.SysAuthority `json:"authority"`
}
type SysAuthorityCopyResponse struct {
Authority system.SysAuthority `json:"authority"`
OldAuthorityId string `json:"oldAuthorityId"` // 旧角色ID
}

View File

@@ -1,6 +1,8 @@
package response
import "gin-vue-admin/model/request"
import (
"gin-vue-admin/model/system/request"
)
type PolicyPathResponse struct {
Paths []request.CasbinInfo `json:"paths"`

View File

@@ -0,0 +1,15 @@
package response
import "gin-vue-admin/model/system"
type SysMenusResponse struct {
Menus []system.SysMenu `json:"menus"`
}
type SysBaseMenusResponse struct {
Menus []system.SysBaseMenu `json:"menus"`
}
type SysBaseMenuResponse struct {
Menu system.SysBaseMenu `json:"menu"`
}

View File

@@ -0,0 +1,15 @@
package response
import (
"gin-vue-admin/model/system"
)
type SysUserResponse struct {
User system.SysUser `json:"user"`
}
type LoginResponse struct {
User system.SysUser `json:"user"`
Token string `json:"token"`
ExpiresAt int64 `json:"expiresAt"`
}

View File

@@ -1,4 +1,4 @@
package model
package system
import (
"gin-vue-admin/global"
@@ -6,8 +6,8 @@ import (
type SysApi struct {
global.GVA_MODEL
Path string `json:"path" gorm:"comment:api路径"` // api路径
Description string `json:"description" gorm:"comment:api中文描述"` // api中文描述
ApiGroup string `json:"apiGroup" gorm:"comment:api组"` // api组
Path string `json:"path" gorm:"comment:api路径"` // api路径
Description string `json:"description" gorm:"comment:api中文描述"` // api中文描述
ApiGroup string `json:"apiGroup" gorm:"comment:api组"` // api组
Method string `json:"method" gorm:"default:POST;comment:方法"` // 方法:创建POST(默认)|查看GET|更新PUT|删除DELETE
}

View File

@@ -1,4 +1,4 @@
package model
package system
import (
"time"

View File

@@ -1,4 +1,4 @@
package model
package system
type SysMenu struct {
SysBaseMenu

View File

@@ -1,4 +1,4 @@
package model
package system
import "errors"

View File

@@ -1,4 +1,4 @@
package model
package system
import "gin-vue-admin/global"

View File

@@ -0,0 +1,36 @@
package system
import (
"gin-vue-admin/global"
)
type SysBaseMenu struct {
global.GVA_MODEL
MenuLevel uint `json:"-"`
ParentId string `json:"parentId" gorm:"comment:父菜单ID"` // 父菜单ID
Path string `json:"path" gorm:"comment:路由path"` // 路由path
Name string `json:"name" gorm:"comment:路由name"` // 路由name
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` // 是否在列表隐藏
Component string `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
Sort int `json:"sort" gorm:"comment:排序标记"` // 排序标记
Meta `json:"meta" gorm:"comment:附加属性"` // 附加属性
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
Children []SysBaseMenu `json:"children" gorm:"-"`
Parameters []SysBaseMenuParameter `json:"parameters"`
}
type Meta struct {
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"` // 是否缓存
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
Title string `json:"title" gorm:"comment:菜单名"` // 菜单名
Icon string `json:"icon" gorm:"comment:菜单图标"` // 菜单图标
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
}
type SysBaseMenuParameter struct {
global.GVA_MODEL
SysBaseMenuID uint
Type string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
Key string `json:"key" gorm:"comment:地址栏携带参数的key"` // 地址栏携带参数的key
Value string `json:"value" gorm:"comment:地址栏携带参数的值"` // 地址栏携带参数的值
}

View File

@@ -1,4 +1,4 @@
package model
package system
type CasbinModel struct {
Ptype string `json:"ptype" gorm:"column:ptype"`

View File

@@ -1,5 +1,5 @@
// 自动生成模板SysDictionary
package model
package system
import (
"gin-vue-admin/global"

View File

@@ -1,5 +1,5 @@
// 自动生成模板SysDictionaryDetail
package model
package system
import (
"gin-vue-admin/global"

View File

@@ -1,4 +1,4 @@
package model
package system
type InitDBFunc interface {
Init() (err error)

View File

@@ -1,4 +1,4 @@
package model
package system
import (
"gin-vue-admin/global"

View File

@@ -1,5 +1,5 @@
// 自动生成模板SysOperationRecord
package model
package system
import (
"gin-vue-admin/global"

View File

@@ -1,4 +1,4 @@
package model
package system
import (
"gin-vue-admin/config"

View File

@@ -1,4 +1,4 @@
package model
package system
import (
"gin-vue-admin/global"
@@ -13,8 +13,8 @@ type SysUser struct {
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
HeaderImg string `json:"headerImg" gorm:"default:http://qmplusimg.henrongyi.top/head.png;comment:用户头像"` // 用户头像
Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID
SideMode string `json:"sideMode" gorm:"default:dark;comment:用户角色ID"` // 用户侧边主题
ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:用户角色ID"` // 活跃颜色
BaseColor string `json:"baseColor" gorm:"default:#fff;comment:用户角色ID"` // 基础颜色
AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID
SideMode string `json:"sideMode" gorm:"default:dark;comment:用户角色ID"` // 用户侧边主题
ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:用户角色ID"` // 活跃颜色
BaseColor string `json:"baseColor" gorm:"default:#fff;comment:用户角色ID"` // 基础颜色
}