Merge branch 'dev'
This commit is contained in:
commit
372248c819
219 files changed
+9367
-8029
No files matched your search
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
//sys_casbin_rule
|
||||
type CasbinRule struct {
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
+120
-309
@@ -1,343 +1,154 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"go-admin/common/models"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
)
|
||||
|
||||
type Menu struct {
|
||||
MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
|
||||
MenuName string `json:"menuName" gorm:"size:128;"`
|
||||
Title string `json:"title" gorm:"size:128;"`
|
||||
Icon string `json:"icon" gorm:"size:128;"`
|
||||
Path string `json:"path" gorm:"size:128;"`
|
||||
Paths string `json:"paths" gorm:"size:128;"`
|
||||
MenuType string `json:"menuType" gorm:"size:1;"`
|
||||
Action string `json:"action" gorm:"size:16;"`
|
||||
Permission string `json:"permission" gorm:"size:255;"`
|
||||
ParentId int `json:"parentId" gorm:"size:11;"`
|
||||
NoCache bool `json:"noCache" gorm:"size:8;"`
|
||||
Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
|
||||
Component string `json:"component" gorm:"size:255;"`
|
||||
Sort int `json:"sort" gorm:"size:4;"`
|
||||
Visible string `json:"visible" gorm:"size:1;"`
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"`
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
RoleId int `gorm:"-"`
|
||||
Children []Menu `json:"children" gorm:"-"`
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (Menu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
|
||||
type MenuLable struct {
|
||||
Id int `json:"id" gorm:"-"`
|
||||
Label string `json:"label" gorm:"-"`
|
||||
Children []MenuLable `json:"children" gorm:"-"`
|
||||
}
|
||||
|
||||
type Menus struct {
|
||||
MenuId int `json:"menuId" gorm:"column:menu_id;primaryKey;autoIncrement;"`
|
||||
MenuName string `json:"menuName" gorm:"column:menu_name"`
|
||||
Title string `json:"title" gorm:"column:title"`
|
||||
Icon string `json:"icon" gorm:"column:icon"`
|
||||
Path string `json:"path" gorm:"column:path"`
|
||||
MenuType string `json:"menuType" gorm:"column:menu_type"`
|
||||
Action string `json:"action" gorm:"column:action"`
|
||||
Permission string `json:"permission" gorm:"column:permission"`
|
||||
ParentId int `json:"parentId" gorm:"column:parent_id"`
|
||||
NoCache bool `json:"noCache" gorm:"column:no_cache"`
|
||||
Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"`
|
||||
Component string `json:"component" gorm:"column:component"`
|
||||
Sort int `json:"sort" gorm:"column:sort"`
|
||||
|
||||
Visible string `json:"visible" gorm:"column:visible"`
|
||||
Children []Menu `json:"children" gorm:"-"`
|
||||
|
||||
CreateBy string `json:"createBy" gorm:"column:create_by"`
|
||||
UpdateBy string `json:"updateBy" gorm:"column:update_by"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (Menus) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
|
||||
type MenuRole struct {
|
||||
Menus
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
}
|
||||
|
||||
type MS []Menu
|
||||
|
||||
//func (e *Menu) GetByMenuId() (Menu Menu, err error) {
|
||||
//type Menu struct {
|
||||
// MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
|
||||
// MenuName string `json:"menuName" gorm:"size:128;"`
|
||||
// Title string `json:"title" gorm:"size:128;"`
|
||||
// Icon string `json:"icon" gorm:"size:128;"`
|
||||
// Path string `json:"path" gorm:"size:128;"`
|
||||
// Paths string `json:"paths" gorm:"size:128;"`
|
||||
// MenuType string `json:"menuType" gorm:"size:1;"`
|
||||
// Action string `json:"action" gorm:"size:16;"`
|
||||
// Permission string `json:"permission" gorm:"size:255;"`
|
||||
// ParentId int `json:"parentId" gorm:"size:11;"`
|
||||
// NoCache bool `json:"noCache" gorm:"size:8;"`
|
||||
// Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
|
||||
// Component string `json:"component" gorm:"size:255;"`
|
||||
// Sort int `json:"sort" gorm:"size:4;"`
|
||||
// Visible string `json:"visible" gorm:"size:1;"`
|
||||
// CreateBy string `json:"createBy" gorm:"size:128;"`
|
||||
// UpdateBy string `json:"updateBy" gorm:"size:128;"`
|
||||
// IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
// DataScope string `json:"dataScope" gorm:"-"`
|
||||
// Params string `json:"params" gorm:"-"`
|
||||
// RoleId int `gorm:"-"`
|
||||
// Children []Menu `json:"children" gorm:"-"`
|
||||
// IsSelect bool `json:"is_select" gorm:"-"`
|
||||
//
|
||||
// table := orm.Eloquent.Table(e.TableName())
|
||||
// table = table.Where("menu_id = ?", e.MenuId)
|
||||
// if err = table.Find(&Menu).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// models.ModelTime
|
||||
//}
|
||||
|
||||
//func (e *Menu) SetMenu() (m []Menu, err error) {
|
||||
// menulist, err := e.GetPage()
|
||||
//
|
||||
// m = make([]Menu, 0)
|
||||
// for i := 0; i < len(menulist); i++ {
|
||||
// if menulist[i].ParentId != 0 {
|
||||
// continue
|
||||
// }
|
||||
// menusInfo := DiguiMenu(&menulist, menulist[i])
|
||||
//
|
||||
// m = append(m, menusInfo)
|
||||
// }
|
||||
// return
|
||||
//func (Menu) TableName() string {
|
||||
// return "sys_menu"
|
||||
//}
|
||||
|
||||
//func DiguiMenu(menulist *[]Menu, menu Menu) Menu {
|
||||
// list := *menulist
|
||||
//
|
||||
// min := make([]Menu, 0)
|
||||
// for j := 0; j < len(list); j++ {
|
||||
//
|
||||
// if menu.MenuId != list[j].ParentId {
|
||||
// continue
|
||||
// }
|
||||
// mi := Menu{}
|
||||
// mi.MenuId = list[j].MenuId
|
||||
// mi.MenuName = list[j].MenuName
|
||||
// mi.Title = list[j].Title
|
||||
// mi.Icon = list[j].Icon
|
||||
// mi.Path = list[j].Path
|
||||
// mi.MenuType = list[j].MenuType
|
||||
// mi.Action = list[j].Action
|
||||
// mi.Permission = list[j].Permission
|
||||
// mi.ParentId = list[j].ParentId
|
||||
// mi.NoCache = list[j].NoCache
|
||||
// mi.Breadcrumb = list[j].Breadcrumb
|
||||
// mi.Component = list[j].Component
|
||||
// mi.Sort = list[j].Sort
|
||||
// mi.Visible = list[j].Visible
|
||||
// mi.CreatedAt = list[j].CreatedAt
|
||||
// mi.Children = []Menu{}
|
||||
//
|
||||
// if mi.MenuType != "F" {
|
||||
// ms := DiguiMenu(menulist, mi)
|
||||
// min = append(min, ms)
|
||||
//
|
||||
// } else {
|
||||
// min = append(min, mi)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// menu.Children = min
|
||||
// return menu
|
||||
//type MenuLable struct {
|
||||
// Id int `json:"id" gorm:"-"`
|
||||
// Label string `json:"label" gorm:"-"`
|
||||
// Children []MenuLable `json:"children" gorm:"-"`
|
||||
//}
|
||||
|
||||
//func (e *Menu) SetMenuLabel() (m *[]MenuLable, err error) {
|
||||
// menulist, err := e.Get()
|
||||
//
|
||||
// ml := make([]MenuLable, 0)
|
||||
// for i := 0; i < len(menulist); i++ {
|
||||
// if menulist[i].ParentId != 0 {
|
||||
// continue
|
||||
// }
|
||||
// e := MenuLable{}
|
||||
// e.Id = menulist[i].MenuId
|
||||
// e.Label = menulist[i].Title
|
||||
// menusInfo := MenuLabelCall(&menulist, e)
|
||||
//type Menus struct {
|
||||
// MenuId int `json:"menuId" gorm:"column:menu_id;primaryKey;autoIncrement;"`
|
||||
// MenuName string `json:"menuName" gorm:"column:menu_name"`
|
||||
// Title string `json:"title" gorm:"column:title"`
|
||||
// Icon string `json:"icon" gorm:"column:icon"`
|
||||
// Path string `json:"path" gorm:"column:path"`
|
||||
// MenuType string `json:"menuType" gorm:"column:menu_type"`
|
||||
// Action string `json:"action" gorm:"column:action"`
|
||||
// Permission string `json:"permission" gorm:"column:permission"`
|
||||
// ParentId int `json:"parentId" gorm:"column:parent_id"`
|
||||
// NoCache bool `json:"noCache" gorm:"column:no_cache"`
|
||||
// Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"`
|
||||
// Component string `json:"component" gorm:"column:component"`
|
||||
// Sort int `json:"sort" gorm:"column:sort"`
|
||||
//
|
||||
// ml = append(ml, menusInfo)
|
||||
// }
|
||||
// return &ml, err
|
||||
// Visible string `json:"visible" gorm:"column:visible"`
|
||||
// Children []Menu `json:"children" gorm:"-"`
|
||||
//
|
||||
// CreateBy string `json:"createBy" gorm:"column:create_by"`
|
||||
// UpdateBy string `json:"updateBy" gorm:"column:update_by"`
|
||||
// DataScope string `json:"dataScope" gorm:"-"`
|
||||
// Params string `json:"params" gorm:"-"`
|
||||
// BaseModel
|
||||
//}
|
||||
|
||||
//func MenuLabelCall(menulist *[]Menu, menu MenuLable) MenuLable {
|
||||
// list := *menulist
|
||||
//
|
||||
// min := make([]MenuLable, 0)
|
||||
// for j := 0; j < len(list); j++ {
|
||||
//
|
||||
// if menu.Id != list[j].ParentId {
|
||||
// continue
|
||||
// }
|
||||
// mi := MenuLable{}
|
||||
// mi.Id = list[j].MenuId
|
||||
// mi.Label = list[j].Title
|
||||
// mi.Children = []MenuLable{}
|
||||
// if list[j].MenuType != "F" {
|
||||
// ms := MenuLabelCall(menulist, mi)
|
||||
// min = append(min, ms)
|
||||
// } else {
|
||||
// min = append(min, mi)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if len(min) > 0 {
|
||||
// menu.Children = min
|
||||
// } else {
|
||||
// menu.Children = nil
|
||||
// }
|
||||
// return menu
|
||||
//func (Menus) TableName() string {
|
||||
// return "sys_menu"
|
||||
//}
|
||||
|
||||
//func (e *Menu) SetMenuRole(roleName string) (m []Menu, err error) {
|
||||
//
|
||||
// menus, err := e.GetByRoleName(roleName)
|
||||
//
|
||||
// m = make([]Menu, 0)
|
||||
// for i := 0; i < len(menus); i++ {
|
||||
// if menus[i].ParentId != 0 {
|
||||
// continue
|
||||
// }
|
||||
// menusInfo := DiguiMenu(&menus, menus[i])
|
||||
//
|
||||
// m = append(m, menusInfo)
|
||||
// }
|
||||
// return
|
||||
//type MenuRole struct {
|
||||
// Menus
|
||||
// IsSelect bool `json:"is_select" gorm:"-"`
|
||||
//}
|
||||
|
||||
//func (e *MenuRole) Get(tx *gorm.DB) (Menus []MenuRole, err error) {
|
||||
//
|
||||
//type MS []Menu
|
||||
//
|
||||
//func (e *Menu) Get(tx *gorm.DB) (Menus []Menu, err error) {
|
||||
// table := tx.Table(e.TableName())
|
||||
// if e.MenuName != "" {
|
||||
// table = table.Where("menu_name = ?", e.MenuName)
|
||||
// }
|
||||
// if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
// return
|
||||
// if e.Path != "" {
|
||||
// table = table.Where("path = ?", e.Path)
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
|
||||
//func (e *Menu) GetByRoleName(roleName string) (Menus []Menu, err error) {
|
||||
// var table *gorm.DB
|
||||
// if roleName == "admin" {
|
||||
// table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*")
|
||||
// table = table.Where(" menu_type in ('M','C')")
|
||||
// } else {
|
||||
// table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id")
|
||||
// table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", roleName)
|
||||
// if e.Action != "" {
|
||||
// table = table.Where("action = ?", e.Action)
|
||||
// }
|
||||
// if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
|
||||
func (e *Menu) Get(tx *gorm.DB) (Menus []Menu, err error) {
|
||||
table := tx.Table(e.TableName())
|
||||
if e.MenuName != "" {
|
||||
table = table.Where("menu_name = ?", e.MenuName)
|
||||
}
|
||||
if e.Path != "" {
|
||||
table = table.Where("path = ?", e.Path)
|
||||
}
|
||||
if e.Action != "" {
|
||||
table = table.Where("action = ?", e.Action)
|
||||
}
|
||||
if e.MenuType != "" {
|
||||
table = table.Where("menu_type = ?", e.MenuType)
|
||||
}
|
||||
|
||||
if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (e *Menu) GetPage(tx *gorm.DB) (Menus []Menu, err error) {
|
||||
table := tx.Table(e.TableName())
|
||||
if e.MenuName != "" {
|
||||
table = table.Where("menu_name = ?", e.MenuName)
|
||||
}
|
||||
if e.Title != "" {
|
||||
table = table.Where("title = ?", e.Title)
|
||||
}
|
||||
if e.Visible != "" {
|
||||
table = table.Where("visible = ?", e.Visible)
|
||||
}
|
||||
if e.MenuType != "" {
|
||||
table = table.Where("menu_type = ?", e.MenuType)
|
||||
}
|
||||
|
||||
// 数据权限控制
|
||||
dataPermission := new(system.DataPermission)
|
||||
dataPermission.UserId, _ = pkg.StringToInt(e.DataScope)
|
||||
table, err = dataPermission.GetDataScope("sys_menu", table)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (e *Menu) Create(tx *gorm.DB) (id int, err error) {
|
||||
result := tx.Table(e.TableName()).Create(&e)
|
||||
if result.Error != nil {
|
||||
err = result.Error
|
||||
return
|
||||
}
|
||||
err = InitPaths(tx, e)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
id = e.MenuId
|
||||
return
|
||||
}
|
||||
|
||||
func InitPaths(tx *gorm.DB, menu *Menu) (err error) {
|
||||
parentMenu := new(Menu)
|
||||
if menu.ParentId != 0 {
|
||||
tx.Table("sys_menu").Where("menu_id = ?", menu.ParentId).First(parentMenu)
|
||||
if parentMenu.Paths == "" {
|
||||
err = errors.New("父级paths异常,请尝试对当前节点父级菜单进行更新操作!")
|
||||
return
|
||||
}
|
||||
menu.Paths = parentMenu.Paths + "/" + pkg.IntToString(menu.MenuId)
|
||||
} else {
|
||||
menu.Paths = "/0/" + pkg.IntToString(menu.MenuId)
|
||||
}
|
||||
tx.Table("sys_menu").Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths)
|
||||
return
|
||||
}
|
||||
|
||||
//func (e *Menu) Update(tx *gorm.DB, id int) (update Menu, err error) {
|
||||
// if err = tx.Table(e.TableName()).First(&update, id).Error; err != nil {
|
||||
// return
|
||||
// if e.MenuType != "" {
|
||||
// table = table.Where("menu_type = ?", e.MenuType)
|
||||
// }
|
||||
//
|
||||
// //参数1:是要修改的数据
|
||||
// //参数2:是修改的数据
|
||||
// if err = tx.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
// if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//func (e *Menu) GetPage(tx *gorm.DB) (Menus []Menu, err error) {
|
||||
// table := tx.Table(e.TableName())
|
||||
// if e.MenuName != "" {
|
||||
// table = table.Where("menu_name = ?", e.MenuName)
|
||||
// }
|
||||
// if e.Title != "" {
|
||||
// table = table.Where("title = ?", e.Title)
|
||||
// }
|
||||
// if e.Visible != "" {
|
||||
// table = table.Where("visible = ?", e.Visible)
|
||||
// }
|
||||
// if e.MenuType != "" {
|
||||
// table = table.Where("menu_type = ?", e.MenuType)
|
||||
// }
|
||||
//
|
||||
// // 数据权限控制
|
||||
// dataPermission := new(DataPermission)
|
||||
// dataPermission.UserId, _ = pkg.StringToInt(e.DataScope)
|
||||
// table, err = dataPermission.GetDataScope("sys_menu", table)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//func (e *Menu) Create(tx *gorm.DB) (id int, err error) {
|
||||
// result := tx.Table(e.TableName()).Create(&e)
|
||||
// if result.Error != nil {
|
||||
// err = result.Error
|
||||
// return
|
||||
// }
|
||||
// err = InitPaths(tx, e)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// id = e.MenuId
|
||||
// return
|
||||
//}
|
||||
|
||||
//func (e *Menu) Delete(tx *gorm.DB, id int) (success bool, err error) {
|
||||
// if err = tx.Table(e.TableName()).Where("menu_id = ?", id).Delete(&Menu{}).Error; err != nil {
|
||||
// success = false
|
||||
// return
|
||||
//
|
||||
//func InitPaths(tx *gorm.DB, menu *Menu) (err error) {
|
||||
// parentMenu := new(Menu)
|
||||
// if menu.ParentId != 0 {
|
||||
// tx.Table("sys_menu").Where("menu_id = ?", menu.ParentId).First(parentMenu)
|
||||
// if parentMenu.Paths == "" {
|
||||
// err = errors.New("父级paths异常,请尝试对当前节点父级菜单进行更新操作!")
|
||||
// return
|
||||
// }
|
||||
// menu.Paths = parentMenu.Paths + "/" + pkg.IntToString(menu.MenuId)
|
||||
// } else {
|
||||
// menu.Paths = "/0/" + pkg.IntToString(menu.MenuId)
|
||||
// }
|
||||
// success = true
|
||||
// tx.Table("sys_menu").Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths)
|
||||
// return
|
||||
//}
|
||||
+21
-23
@@ -1,28 +1,26 @@
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
type SysRole struct {
|
||||
RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
|
||||
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||
Status string `json:"status" gorm:"size:4;"` //
|
||||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
Flag string `json:"flag" gorm:"size:128;"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Admin bool `json:"admin" gorm:"size:4;"`
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
//type SysRole struct {
|
||||
// RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
|
||||
// RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||
// Status string `json:"status" gorm:"size:4;"` //
|
||||
// RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
// RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
// Flag string `json:"flag" gorm:"size:128;"` //
|
||||
// Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
// Admin bool `json:"admin" gorm:"size:4;"`
|
||||
// DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
// models.ModelTime
|
||||
// models.ControlBy
|
||||
//
|
||||
// Params string `json:"params" gorm:"-"`
|
||||
// MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
// DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
//}
|
||||
//
|
||||
//func (SysRole) TableName() string {
|
||||
// return "sys_role"
|
||||
//}
|
||||
|
||||
type MenuIdList struct {
|
||||
MenuId int `json:"menuId"`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
//sys_role_dept
|
||||
type SysRoleDept struct {
|
||||
@@ -1,8 +1,7 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"gorm.io/gorm"
|
||||
@@ -0,0 +1,74 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/runtime"
|
||||
"github.com/go-admin-team/go-admin-core/storage"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysApi struct {
|
||||
Id int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
|
||||
Handle string `json:"handle" gorm:"size:128;comment:handle"`
|
||||
Title string `json:"title" gorm:"size:128;comment:标题"`
|
||||
Path string `json:"path" gorm:"size:128;comment:地址"`
|
||||
Action string `json:"action" gorm:"size:16;comment:请求类型"`
|
||||
Type string `json:"type" gorm:"size:16;comment:接口类型"`
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
func (SysApi) TableName() string {
|
||||
return "sys_api"
|
||||
}
|
||||
|
||||
func (e *SysApi) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysApi) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
|
||||
func SaveSysApi(message storage.Messager) (err error) {
|
||||
var rb []byte
|
||||
rb, err = json.Marshal(message.GetValues())
|
||||
if err != nil {
|
||||
fmt.Errorf("json Marshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
var l runtime.Routers
|
||||
err = json.Unmarshal(rb, &l)
|
||||
if err != nil {
|
||||
fmt.Errorf("json Unmarshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
dbList := sdk.Runtime.GetDb()
|
||||
for _, d := range dbList {
|
||||
for _, v := range l.List {
|
||||
if v.HttpMethod != "HEAD" ||
|
||||
strings.Contains(v.RelativePath, "/swagger/") ||
|
||||
strings.Contains(v.RelativePath, "/static/") ||
|
||||
strings.Contains(v.RelativePath, "/form-generator/") ||
|
||||
strings.Contains(v.RelativePath, "/sys/tables") {
|
||||
err := d.Debug().Where(SysApi{Path: v.RelativePath, Action: v.HttpMethod}).
|
||||
Attrs(SysApi{Handle: v.Handler}).
|
||||
FirstOrCreate(&SysApi{}).
|
||||
//Update("handle", v.Handler).
|
||||
Error
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Models SaveSysApi error: %s \r\n ", err.Error())
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysCategory struct {
|
||||
models.Model
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||
Img string `json:"img" gorm:"type:varchar(255);comment:图标"` //
|
||||
Sort int `json:"sort" gorm:"type:int(4);comment:排序"` //
|
||||
Status int `json:"status" gorm:"type:int(1);comment:状态"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysCategory) TableName() string {
|
||||
return "sys_category"
|
||||
}
|
||||
|
||||
func (e *SysCategory) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysCategory) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysChinaAreaData struct {
|
||||
models.Model
|
||||
|
||||
PId string `json:"pId" gorm:"type:int(11);comment:上级编码"`
|
||||
Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysChinaAreaData) TableName() string {
|
||||
return "sys_china_area_data"
|
||||
}
|
||||
|
||||
func (e *SysChinaAreaData) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysChinaAreaData) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysConfig struct {
|
||||
models.Model
|
||||
ConfigName string `json:"configName" gorm:"size:128;comment:ConfigName"` //
|
||||
ConfigKey string `json:"configKey" gorm:"size:128;comment:ConfigKey"` //
|
||||
ConfigValue string `json:"configValue" gorm:"size:255;comment:ConfigValue"` //
|
||||
ConfigType string `json:"configType" gorm:"size:64;comment:ConfigType"`
|
||||
IsFrontend int `json:"isFrontend" gorm:"size:64;comment:是否前台"` //
|
||||
Remark string `json:"remark" gorm:"size:128;comment:Remark"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysConfig) TableName() string {
|
||||
return "sys_config"
|
||||
}
|
||||
|
||||
func (e *SysConfig) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysConfig) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysContent struct {
|
||||
models.Model
|
||||
CateId int `json:"cateId" gorm:"type:int(11);comment:分类id"`
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"`
|
||||
Status int `json:"status" gorm:"type:int(1);comment:状态"`
|
||||
Img string `json:"img" gorm:"type:varchar(255);comment:图片"`
|
||||
Content string `json:"content" gorm:"type:text;comment:内容"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Sort int `json:"sort" gorm:"type:int(4);comment:排序"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
// TableName
|
||||
func (SysContent) TableName() string {
|
||||
return "sys_content"
|
||||
}
|
||||
|
||||
// Generate
|
||||
func (e *SysContent) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysContent) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysDictData struct {
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
DictCode int `json:"dictCode" gorm:"primaryKey;column:dict_code;autoIncrement;comment:主键编码"`
|
||||
DictSort int `json:"dictSort" gorm:"size:20;comment:DictSort"`
|
||||
DictLabel string `json:"dictLabel" gorm:"size:128;comment:DictLabel"`
|
||||
DictValue string `json:"dictValue" gorm:"size:255;comment:DictValue"`
|
||||
DictType string `json:"dictType" gorm:"size:64;comment:DictType"`
|
||||
CssClass string `json:"cssClass" gorm:"size:128;comment:CssClass"`
|
||||
ListClass string `json:"listClass" gorm:"size:128;comment:ListClass"`
|
||||
IsDefault string `json:"isDefault" gorm:"size:8;comment:IsDefault"`
|
||||
Status string `json:"status" gorm:"size:4;comment:Status"`
|
||||
Default string `json:"default" gorm:"size:8;comment:Default"`
|
||||
Remark string `json:"remark" gorm:"size:255;comment:Remark"`
|
||||
}
|
||||
|
||||
func (SysDictData) TableName() string {
|
||||
return "sys_dict_data"
|
||||
}
|
||||
|
||||
func (e *SysDictData) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysDictData) GetId() interface{} {
|
||||
return e.DictCode
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
@@ -9,10 +9,10 @@ type SysDictType struct {
|
||||
models.ModelTime
|
||||
|
||||
ID int `json:"id" gorm:"primaryKey;column:dict_id;autoIncrement;comment:主键编码"`
|
||||
DictName string `json:"dictName" gorm:"type:varchar(128);comment:DictName"`
|
||||
DictType string `json:"dictType" gorm:"type:varchar(128);comment:DictType"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:Status"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"`
|
||||
DictName string `json:"dictName" gorm:"size:128;comment:DictName"`
|
||||
DictType string `json:"dictType" gorm:"size:128;comment:DictType"`
|
||||
Status string `json:"status" gorm:"size:4;comment:Status"`
|
||||
Remark string `json:"remark" gorm:"size:255;comment:Remark"`
|
||||
}
|
||||
|
||||
func (SysDictType) TableName() string {
|
||||
@@ -1,40 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysFileDir struct {
|
||||
models.Model
|
||||
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
||||
PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
||||
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
||||
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
||||
Children []SysFileDir `json:"children,omitempty" gorm:"-"` // 下级信息
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
type SysFileDirL struct {
|
||||
models.Model
|
||||
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
||||
PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
||||
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
||||
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
Children []SysFileDirL `json:"children,omitempty" gorm:"-"` // 下级信息
|
||||
}
|
||||
|
||||
func (SysFileDir) TableName() string { /**/
|
||||
return "sys_file_dir"
|
||||
}
|
||||
|
||||
func (e *SysFileDir) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysFileDir) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysFileInfo struct {
|
||||
models.Model
|
||||
Type string `json:"type" gorm:"type:varchar(255);comment:类型"` //
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||
Size string `json:"size" gorm:"type:int(11);comment:大小"` //
|
||||
PId int `json:"pId" gorm:"type:int(11);comment:目录"` //
|
||||
Source string `json:"source" gorm:"type:varchar(255);comment:来源"` //
|
||||
Url string `json:"url" gorm:"type:varchar(255);comment:地址"` //
|
||||
FullUrl string `json:"fullUrl" gorm:"type:varchar(255);comment:全地址"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysFileInfo) TableName() string {
|
||||
return "sys_file_info"
|
||||
}
|
||||
|
||||
func (e *SysFileInfo) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysFileInfo) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SysJob struct {
|
||||
JobId int `json:"jobId" gorm:"primaryKey;autoIncrement"` // 编码
|
||||
JobName string `json:"jobName" gorm:"size:255;"` // 名称
|
||||
JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组
|
||||
JobType int `json:"jobType" gorm:"size:1;"` // 任务类型
|
||||
CronExpression string `json:"cronExpression" gorm:"size:255;"` // cron表达式
|
||||
InvokeTarget string `json:"invokeTarget" gorm:"size:255;"` // 调用目标
|
||||
Args string `json:"args" gorm:"size:255;"` // 目标参数
|
||||
MisfirePolicy int `json:"misfirePolicy" gorm:"size:255;"` // 执行策略
|
||||
Concurrent int `json:"concurrent" gorm:"size:1;"` // 是否并发
|
||||
Status int `json:"status" gorm:"size:1;"` // 状态
|
||||
EntryId int `json:"entry_id" gorm:"size:11;"` // job启动时返回的id
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
}
|
||||
|
||||
func (SysJob) TableName() string {
|
||||
return "sys_job"
|
||||
}
|
||||
|
||||
func (e *SysJob) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysJob) GetId() interface{} {
|
||||
return e.JobId
|
||||
}
|
||||
|
||||
func (e *SysJob) SetCreateBy(createBy int) {
|
||||
e.CreateBy = createBy
|
||||
}
|
||||
|
||||
func (e *SysJob) SetUpdateBy(updateBy int) {
|
||||
e.UpdateBy = updateBy
|
||||
}
|
||||
|
||||
// 创建SysJob
|
||||
//func (e *SysJob) Create() (err error) {
|
||||
// return orm.Eloquent.Table(e.TableName()).Create(e).Error
|
||||
//}
|
||||
|
||||
// 获取SysJob
|
||||
//func (e *SysJob) Get(id interface{}) (err error) {
|
||||
// return orm.Eloquent.Table(e.TableName()).First(e, id).Error
|
||||
//}
|
||||
|
||||
// 获取SysJob带分页
|
||||
//func (e *SysJob) GetPage(pageSize int, pageIndex int, v interface{}, list interface{}) (int, error) {
|
||||
// table := orm.Eloquent.Table(e.TableName()).Scopes(dto.MakeCondition(v))
|
||||
//
|
||||
// // 数据权限控制(如果不需要数据权限请将此处去掉)
|
||||
// //dataPermission := new(DataPermission)
|
||||
// userid, _ := tools.StringToInt(e.DataScope)
|
||||
//
|
||||
// var count int64
|
||||
//
|
||||
// if err := table.Scopes(system.DataScopes(e.TableName(), userid), dto.Paginate(pageSize, pageIndex)).Find(list).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
// return 0, err
|
||||
// }
|
||||
// return int(count), nil
|
||||
//}
|
||||
|
||||
func (e *SysJob) GetList(tx *gorm.DB, list interface{}) (err error) {
|
||||
return tx.Table(e.TableName()).Where("status = ?", 2).Find(list).Error
|
||||
}
|
||||
|
||||
// 更新SysJob
|
||||
func (e *SysJob) Update(tx *gorm.DB, id interface{}) (err error) {
|
||||
return tx.Table(e.TableName()).Where(id).Updates(&e).Error
|
||||
}
|
||||
|
||||
func (e *SysJob) RemoveAllEntryID(tx *gorm.DB) (update SysJob, err error) {
|
||||
if err = tx.Table(e.TableName()).Where("entry_id > ?", 0).Update("entry_id", 0).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//func (e *SysJob) RemoveEntryID(entryID int) (update SysJob, err error) {
|
||||
// if err = orm.Eloquent.Table(e.TableName()).Where("entry_id = ?", entryID).Updates(map[string]interface{}{"entry_id": 0}).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
|
||||
// 删除SysJob
|
||||
//func (e *SysJob) Delete(id int) (success bool, err error) {
|
||||
// if err = orm.Eloquent.Table(e.TableName()).Where(id).Delete(&SysJob{}).Error; err != nil {
|
||||
// success = false
|
||||
// return
|
||||
// }
|
||||
// success = true
|
||||
// return
|
||||
//}
|
||||
|
||||
//批量删除
|
||||
//func (e *SysJob) BatchDelete(id []int) error {
|
||||
// return orm.Eloquent.Table(e.TableName()).Where(id).Delete(&SysJob{}).Error
|
||||
//}
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -14,16 +14,16 @@ import (
|
||||
|
||||
type SysLoginLog struct {
|
||||
models.Model
|
||||
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"`
|
||||
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"`
|
||||
LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"`
|
||||
Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"`
|
||||
Os string `json:"os" gorm:"type:varchar(255);comment:系统"`
|
||||
Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"`
|
||||
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"`
|
||||
Username string `json:"username" gorm:"size:128;comment:用户名"`
|
||||
Status string `json:"status" gorm:"size:4;comment:状态"`
|
||||
Ipaddr string `json:"ipaddr" gorm:"size:255;comment:ip地址"`
|
||||
LoginLocation string `json:"loginLocation" gorm:"size:255;comment:归属地"`
|
||||
Browser string `json:"browser" gorm:"size:255;comment:浏览器"`
|
||||
Os string `json:"os" gorm:"size:255;comment:系统"`
|
||||
Platform string `json:"platform" gorm:"size:255;comment:固件"`
|
||||
LoginTime time.Time `json:"loginTime" gorm:"comment:登录时间"`
|
||||
Remark string `json:"remark" gorm:"size:255;comment:备注"`
|
||||
Msg string `json:"msg" gorm:"size:255;comment:信息"`
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
models.ControlBy
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
@@ -19,37 +19,17 @@ type SysMenu struct {
|
||||
Sort int `json:"sort" gorm:"size:4;"`
|
||||
Visible string `json:"visible" gorm:"size:1;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
SysApi []SysApi `json:"sysApi" gorm:"many2many:sys_menu_api_rule"`
|
||||
Apis []int `json:"apis" gorm:"-"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
RoleId int `gorm:"-"`
|
||||
Children []SysMenu `json:"children" gorm:"-"`
|
||||
Children []SysMenu `json:"children,omitempty" gorm:"-"`
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
type SysMenus struct {
|
||||
MenuId int `json:"menuId" gorm:"column:menu_id;primaryKey;autoIncrement;"`
|
||||
MenuName string `json:"menuName" gorm:"column:menu_name"`
|
||||
Title string `json:"title" gorm:"column:title"`
|
||||
Icon string `json:"icon" gorm:"column:icon"`
|
||||
Path string `json:"path" gorm:"column:path"`
|
||||
MenuType string `json:"menuType" gorm:"column:menu_type"`
|
||||
Action string `json:"action" gorm:"column:action"`
|
||||
Permission string `json:"permission" gorm:"column:permission"`
|
||||
ParentId int `json:"parentId" gorm:"column:parent_id"`
|
||||
NoCache bool `json:"noCache" gorm:"column:no_cache"`
|
||||
Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"`
|
||||
Component string `json:"component" gorm:"column:component"`
|
||||
Sort int `json:"sort" gorm:"column:sort"`
|
||||
Visible string `json:"visible" gorm:"column:visible"`
|
||||
Children []SysMenu `json:"children" gorm:"-"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
}
|
||||
|
||||
func (SysMenu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
@@ -61,4 +41,4 @@ func (e *SysMenu) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysMenu) GetId() interface{} {
|
||||
return e.MenuId
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
log "github.com/go-admin-team/go-admin-core/logger"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/storage"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
models.Model
|
||||
Title string `json:"title" gorm:"size:255;comment:操作模块"`
|
||||
BusinessType string `json:"businessType" gorm:"size:128;comment:操作类型"`
|
||||
BusinessTypes string `json:"businessTypes" gorm:"size:128;comment:BusinessTypes"`
|
||||
Method string `json:"method" gorm:"size:128;comment:函数"`
|
||||
RequestMethod string `json:"requestMethod" gorm:"size:128;comment:请求方式"`
|
||||
OperatorType string `json:"operatorType" gorm:"size:128;comment:操作类型"`
|
||||
OperName string `json:"operName" gorm:"size:128;comment:操作者"`
|
||||
DeptName string `json:"deptName" gorm:"size:128;comment:部门名称"`
|
||||
OperUrl string `json:"operUrl" gorm:"size:255;comment:访问地址"`
|
||||
OperIp string `json:"operIp" gorm:"size:128;comment:客户端ip"`
|
||||
OperLocation string `json:"operLocation" gorm:"size:128;comment:访问位置"`
|
||||
OperParam string `json:"operParam" gorm:"size:255;comment:请求参数"`
|
||||
Status string `json:"status" gorm:"size:4;comment:操作状态"`
|
||||
OperTime time.Time `json:"operTime" gorm:"comment:操作时间"`
|
||||
JsonResult string `json:"jsonResult" gorm:"size:255;comment:返回数据"`
|
||||
Remark string `json:"remark" gorm:"size:255;comment:备注"`
|
||||
LatencyTime string `json:"latencyTime" gorm:"size:128;comment:耗时"`
|
||||
UserAgent string `json:"userAgent" gorm:"size:255;comment:ua"`
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
func (SysOperaLog) TableName() string {
|
||||
return "sys_opera_log"
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
|
||||
// SaveOperaLog 从队列中获取操作日志
|
||||
func SaveOperaLog(message storage.Messager) (err error) {
|
||||
//准备db
|
||||
db := sdk.Runtime.GetDbByKey(message.GetPrefix())
|
||||
if db == nil {
|
||||
err = errors.New("db not exist")
|
||||
log.Errorf("host[%s]'s %s", message.GetPrefix(), err.Error())
|
||||
return err
|
||||
}
|
||||
var rb []byte
|
||||
rb, err = json.Marshal(message.GetValues())
|
||||
if err != nil {
|
||||
log.Errorf("json Marshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
var l SysOperaLog
|
||||
err = json.Unmarshal(rb, &l)
|
||||
if err != nil {
|
||||
log.Errorf("json Unmarshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
err = db.Create(&l).Error
|
||||
if err != nil {
|
||||
log.Errorf("db create error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
@@ -6,7 +6,7 @@ type SysPost struct {
|
||||
PostId int `gorm:"primaryKey;autoIncrement" json:"postId"` //岗位编号
|
||||
PostName string `gorm:"size:128;" json:"postName"` //岗位名称
|
||||
PostCode string `gorm:"size:128;" json:"postCode"` //岗位代码
|
||||
Sort int `gorm:"" json:"sort"` //岗位排序
|
||||
Sort int `gorm:"size:4;" json:"sort"` //岗位排序
|
||||
Status int `gorm:"size:4;" json:"status"` //状态
|
||||
Remark string `gorm:"size:255;" json:"remark"` //描述
|
||||
models.ControlBy
|
||||
@@ -27,4 +27,4 @@ func (e *SysPost) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysPost) GetId() interface{} {
|
||||
return e.PostId
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
type SysRole struct {
|
||||
RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
|
||||
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||
Status string `json:"status" gorm:"size:4;"` //
|
||||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
Flag string `json:"flag" gorm:"size:128;"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Admin bool `json:"admin" gorm:"size:4;"`
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
SysMenu *[]SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
|
||||
func (e *SysRole) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysRole) GetId() interface{} {
|
||||
return e.RoleId
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package system
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
@@ -10,19 +10,19 @@ type SysUser struct {
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
UserId int `gorm:"primaryKey;autoIncrement;comment:编码" json:"userId"`
|
||||
Username string `json:"username" gorm:"type:varchar(64);comment:用户名"`
|
||||
Password string `json:"-" gorm:"type:varchar(128);comment:密码"`
|
||||
NickName string `json:"nickName" gorm:"type:varchar(128);comment:昵称"`
|
||||
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机号"`
|
||||
RoleId int `json:"roleId" gorm:"type:bigint(20);comment:角色ID"`
|
||||
Salt string `json:"-" gorm:"type:varchar(255);comment:加盐"`
|
||||
Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"`
|
||||
Sex string `json:"sex" gorm:"type:varchar(255);comment:性别"`
|
||||
Email string `json:"email" gorm:"type:varchar(128);comment:邮箱"`
|
||||
DeptId int `json:"deptId" gorm:"type:bigint(20);comment:部门"`
|
||||
PostId int `json:"postId" gorm:"type:bigint(20);comment:岗位"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"`
|
||||
Username string `json:"username" gorm:"size:64;comment:用户名"`
|
||||
Password string `json:"-" gorm:"size:128;comment:密码"`
|
||||
NickName string `json:"nickName" gorm:"size:128;comment:昵称"`
|
||||
Phone string `json:"phone" gorm:"size:11;comment:手机号"`
|
||||
RoleId int `json:"roleId" gorm:"size:20;comment:角色ID"`
|
||||
Salt string `json:"-" gorm:"size:255;comment:加盐"`
|
||||
Avatar string `json:"avatar" gorm:"size:255;comment:头像"`
|
||||
Sex string `json:"sex" gorm:"size:255;comment:性别"`
|
||||
Email string `json:"email" gorm:"size:128;comment:邮箱"`
|
||||
DeptId int `json:"deptId" gorm:"size:20;comment:部门"`
|
||||
PostId int `json:"postId" gorm:"size:20;comment:岗位"`
|
||||
Remark string `json:"remark" gorm:"size:255;comment:备注"`
|
||||
Status string `json:"status" gorm:"size:4;comment:状态"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
PostIds []int `json:"postIds" gorm:"-"`
|
||||
RoleIds []int `json:"roleIds" gorm:"-"`
|
||||
@@ -1,44 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysSetting struct {
|
||||
SettingsId int `json:"settings_id" gorm:"primary_key;AUTO_INCREMENT"`
|
||||
Name string `json:"name" gorm:"type:varchar(256);"`
|
||||
Logo string `json:"logo" gorm:"type:varchar(256);"`
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysSetting) TableName() string {
|
||||
return "sys_setting"
|
||||
}
|
||||
|
||||
func (s *SysSetting) GetId() interface{} {
|
||||
return s.SettingsId
|
||||
}
|
||||
|
||||
//查询
|
||||
//func (s *SysSetting) Get() (create SysSetting, err error) {
|
||||
// result := orm.Eloquent.Table("sys_setting").First(&create)
|
||||
// if result.Error != nil {
|
||||
// err = result.Error
|
||||
// return
|
||||
// }
|
||||
// return create, nil
|
||||
//}
|
||||
|
||||
//修改
|
||||
//func (s *SysSetting) Update() (update SysSetting, err error) {
|
||||
// if err = orm.Eloquent.Table("sys_setting").Model(&update).Where("settings_id = ?", s.SettingsId).Updates(&s).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
|
||||
type ResponseSystemConfig struct {
|
||||
Name string `json:"name" binding:"required"` // 名称
|
||||
Logo string `json:"logo" binding:"required"` // 头像
|
||||
SettingsId int `json:"settings_id" binding:"required"` // 头像
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysConfig struct {
|
||||
models.Model
|
||||
ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` //
|
||||
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` //
|
||||
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` //
|
||||
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"`
|
||||
IsFrontend int `json:"isFrontend" gorm:"type:varchar(64);comment:是否前台"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysConfig) TableName() string {
|
||||
return "sys_config"
|
||||
}
|
||||
|
||||
func (e *SysConfig) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysConfig) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysDictData struct {
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
DictCode int `json:"dictCode" gorm:"primaryKey;column:dict_code;autoIncrement;comment:主键编码"`
|
||||
DictSort int `json:"dictSort" gorm:"type:bigint(20);comment:DictSort"`
|
||||
DictLabel string `json:"dictLabel" gorm:"type:varchar(128);comment:DictLabel"`
|
||||
DictValue string `json:"dictValue" gorm:"type:varchar(255);comment:DictValue"`
|
||||
DictType string `json:"dictType" gorm:"type:varchar(64);comment:DictType"`
|
||||
CssClass string `json:"cssClass" gorm:"type:varchar(128);comment:CssClass"`
|
||||
ListClass string `json:"listClass" gorm:"type:varchar(128);comment:ListClass"`
|
||||
IsDefault string `json:"isDefault" gorm:"type:varchar(8);comment:IsDefault"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:Status"`
|
||||
Default string `json:"default" gorm:"type:varchar(8);comment:Default"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"`
|
||||
}
|
||||
|
||||
func (SysDictData) TableName() string {
|
||||
return "sys_dict_data"
|
||||
}
|
||||
|
||||
func (e *SysDictData) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysDictData) GetId() interface{} {
|
||||
return e.DictCode
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
log "github.com/go-admin-team/go-admin-core/logger"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/storage"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
models.Model
|
||||
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"`
|
||||
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"`
|
||||
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"`
|
||||
Method string `json:"method" gorm:"type:varchar(128);comment:函数"`
|
||||
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"`
|
||||
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"`
|
||||
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"`
|
||||
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"`
|
||||
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"`
|
||||
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"`
|
||||
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"`
|
||||
OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"`
|
||||
OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"`
|
||||
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"`
|
||||
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"`
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
func (SysOperaLog) TableName() string {
|
||||
return "sys_opera_log"
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
|
||||
// SaveOperaLog 从队列中获取操作日志
|
||||
func SaveOperaLog(message storage.Messager) (err error) {
|
||||
//准备db
|
||||
db := sdk.Runtime.GetDbByKey(message.GetPrefix())
|
||||
if db == nil {
|
||||
err = errors.New("db not exist")
|
||||
log.Errorf("host[%s]'s %s", message.GetPrefix(), err.Error())
|
||||
return err
|
||||
}
|
||||
var rb []byte
|
||||
rb, err = json.Marshal(message.GetValues())
|
||||
if err != nil {
|
||||
log.Errorf("json Marshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
var l SysOperaLog
|
||||
err = json.Unmarshal(rb, &l)
|
||||
if err != nil {
|
||||
log.Errorf("json Unmarshal error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
if l.Title == "" {
|
||||
m := &SysMenu{}
|
||||
db.Model(m).Select("Title").Where("action = ?", l.Method).Where("path = ?", message.GetValues()["_fullPath"]).First(m)
|
||||
l.Title = m.Title
|
||||
}
|
||||
err = db.Create(&l).Error
|
||||
if err != nil {
|
||||
log.Errorf("db create error, %s", err.Error())
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package system
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
type SysRole struct {
|
||||
RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
|
||||
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||
Status string `json:"status" gorm:"size:4;"` //
|
||||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
Flag string `json:"flag" gorm:"size:128;"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Admin bool `json:"admin" gorm:"size:4;"`
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
|
||||
func (e *SysRole) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysRole) GetId() interface{} {
|
||||
return e.RoleId
|
||||
}
|
||||
@@ -2,11 +2,10 @@ package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/config"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type DBColumns struct {
|
||||
@@ -68,4 +67,4 @@ func (e *DBColumns) GetList(tx *gorm.DB) ([]DBColumns, error) {
|
||||
return doc, err
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,47 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
common "go-admin/common/models"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
)
|
||||
|
||||
type SysTables struct {
|
||||
TableId int `gorm:"primaryKey;autoIncrement" json:"tableId"` //表编码
|
||||
TBName string `gorm:"column:table_name;size:255;" json:"tableName"` //表名称
|
||||
TableComment string `gorm:"size:255;" json:"tableComment"` //表备注
|
||||
ClassName string `gorm:"size:255;" json:"className"` //类名
|
||||
TplCategory string `gorm:"size:255;" json:"tplCategory"` //
|
||||
PackageName string `gorm:"size:255;" json:"packageName"` //包名
|
||||
ModuleName string `gorm:"size:255;" json:"moduleName"` //模块名
|
||||
BusinessName string `gorm:"size:255;" json:"businessName"` //
|
||||
FunctionName string `gorm:"size:255;" json:"functionName"` //功能名称
|
||||
FunctionAuthor string `gorm:"size:255;" json:"functionAuthor"` //功能作者
|
||||
PkColumn string `gorm:"size:255;" json:"pkColumn"`
|
||||
PkGoField string `gorm:"size:255;" json:"pkGoField"`
|
||||
PkJsonField string `gorm:"size:255;" json:"pkJsonField"`
|
||||
Options string `gorm:"size:255;" json:"options"`
|
||||
TreeCode string `gorm:"size:255;" json:"treeCode"`
|
||||
TreeParentCode string `gorm:"size:255;" json:"treeParentCode"`
|
||||
TreeName string `gorm:"size:255;" json:"treeName"`
|
||||
Tree bool `gorm:"size:1;" json:"tree"`
|
||||
Crud bool `gorm:"size:1;" json:"crud"`
|
||||
Remark string `gorm:"size:255;" json:"remark"`
|
||||
IsDataScope int `gorm:"size:1;" json:"isDataScope"`
|
||||
IsActions int `gorm:"size:1;" json:"isActions"`
|
||||
IsAuth int `gorm:"size:1;" json:"isAuth"`
|
||||
IsLogicalDelete string `gorm:"size:1;" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"size:1;" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`
|
||||
CreateBy int `gorm:"size:128;" json:"createBy"`
|
||||
UpdateBy int `gorm:"size:128;" json:"updateBy"`
|
||||
DataScope string `gorm:"-" json:"dataScope"`
|
||||
Params Params `gorm:"-" json:"params"`
|
||||
Columns []SysColumns `gorm:"-" json:"columns"`
|
||||
TableId int `gorm:"primaryKey;autoIncrement" json:"tableId"` //表编码
|
||||
TBName string `gorm:"column:table_name;size:255;" json:"tableName"` //表名称
|
||||
TableComment string `gorm:"size:255;" json:"tableComment"` //表备注
|
||||
ClassName string `gorm:"size:255;" json:"className"` //类名
|
||||
TplCategory string `gorm:"size:255;" json:"tplCategory"` //
|
||||
PackageName string `gorm:"size:255;" json:"packageName"` //包名
|
||||
ModuleName string `gorm:"size:255;" json:"moduleName"` //go文件名
|
||||
ModuleFrontName string `gorm:"size:255;comment:前端文件名;" json:"moduleFrontName"` //前端文件名
|
||||
BusinessName string `gorm:"size:255;" json:"businessName"` //
|
||||
FunctionName string `gorm:"size:255;" json:"functionName"` //功能名称
|
||||
FunctionAuthor string `gorm:"size:255;" json:"functionAuthor"` //功能作者
|
||||
PkColumn string `gorm:"size:255;" json:"pkColumn"`
|
||||
PkGoField string `gorm:"size:255;" json:"pkGoField"`
|
||||
PkJsonField string `gorm:"size:255;" json:"pkJsonField"`
|
||||
Options string `gorm:"size:255;" json:"options"`
|
||||
TreeCode string `gorm:"size:255;" json:"treeCode"`
|
||||
TreeParentCode string `gorm:"size:255;" json:"treeParentCode"`
|
||||
TreeName string `gorm:"size:255;" json:"treeName"`
|
||||
Tree bool `gorm:"size:1;default:0;" json:"tree"`
|
||||
Crud bool `gorm:"size:1;default:1;" json:"crud"`
|
||||
Remark string `gorm:"size:255;" json:"remark"`
|
||||
IsDataScope int `gorm:"size:1;" json:"isDataScope"`
|
||||
IsActions int `gorm:"size:1;" json:"isActions"`
|
||||
IsAuth int `gorm:"size:1;" json:"isAuth"`
|
||||
IsLogicalDelete string `gorm:"size:1;" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"size:1;" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`
|
||||
common.ModelTime
|
||||
common.ControlBy
|
||||
DataScope string `gorm:"-" json:"dataScope"`
|
||||
Params Params `gorm:"-" json:"params"`
|
||||
Columns []SysColumns `gorm:"-" json:"columns"`
|
||||
|
||||
models.BaseModel
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user