Merge branch 'dev' of https://github.com/go-admin-team/go-admin into dev
This commit is contained in:
commit
897b9e6919
45 files changed
+4186
-6199
No files matched your search
@@ -30,28 +30,6 @@ type SysMenu struct {
|
||||
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"
|
||||
}
|
||||
@@ -63,4 +41,4 @@ func (e *SysMenu) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysMenu) GetId() interface{} {
|
||||
return e.MenuId
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
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/sdk/middleware"
|
||||
common "go-admin/common/middleware"
|
||||
)
|
||||
|
||||
@@ -25,6 +26,8 @@ func InitRouter() {
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
r.Use(middleware.Metrics())
|
||||
|
||||
//r.Use(common.Sentinel()).
|
||||
// Use(common.RequestId(pkg.TrafficKey))
|
||||
common.InitMiddleware(r)
|
||||
|
||||
+1
-6
@@ -58,8 +58,7 @@ func setup() {
|
||||
// 注入配置扩展项
|
||||
config.ExtendConfig = &ext.ExtConfig
|
||||
//1. 读取配置
|
||||
config.Setup(file.NewSource, file.WithPath(configYml))
|
||||
go config.Watch()
|
||||
config.Setup(file.NewSource(file.WithPath(configYml)))
|
||||
//2. 设置日志
|
||||
sdk.Runtime.SetLogger(
|
||||
logger.SetupLogger(
|
||||
@@ -70,8 +69,6 @@ func setup() {
|
||||
//3. 初始化数据库链接
|
||||
database.Setup()
|
||||
|
||||
//list := sdk.Runtime.GetDb()
|
||||
//list["*"]
|
||||
//4. 设置缓存
|
||||
cacheAdapter, err := config.CacheConfig.Setup()
|
||||
if err != nil {
|
||||
@@ -113,8 +110,6 @@ func setup() {
|
||||
}
|
||||
|
||||
func run() error {
|
||||
defer config.Stop()
|
||||
|
||||
if config.ApplicationConfig.Mode == pkg.ModeProd.String() {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
}
|
||||
|
||||
func run() {
|
||||
config.Setup(file.NewSource, file.WithPath(configYml))
|
||||
config.Setup(file.NewSource(file.WithPath(configYml)))
|
||||
|
||||
application, errs := json.MarshalIndent(config.ApplicationConfig, "", " ") //转换成JSON返回的是byte[]
|
||||
if errs != nil {
|
||||
|
||||
File renamed without changes.
@@ -1,19 +0,0 @@
|
||||
package 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;"`
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package models
|
||||
|
||||
type RoleMenu struct {
|
||||
RoleId int `gorm:""`
|
||||
MenuId int `gorm:""`
|
||||
RoleName string `gorm:"size:128)"`
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (RoleMenu) TableName() string {
|
||||
return "sys_role_menu"
|
||||
}
|
||||
@@ -1,30 +1,16 @@
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
type SysApi struct {
|
||||
Id int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
|
||||
Handle string `json:"handle" gorm:"type:varchar(128);comment:handle"`
|
||||
Title string `json:"title" gorm:"type:varchar(128);comment:标题"`
|
||||
Permission string `json:"permission" gorm:"size:255;"`
|
||||
Path string `json:"path" gorm:"type:varchar(128);comment:地址"`
|
||||
Paths string `json:"paths" gorm:"type:varchar(128);comment:Paths"`
|
||||
Action string `json:"action" gorm:"type:varchar(16);comment:类型"`
|
||||
ParentId int `json:"parentId" gorm:"comment:按钮id"`
|
||||
Sort int `json:"sort" gorm:"type:tinyint(4);comment:排序"`
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
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:接口类型"`
|
||||
ModelTime
|
||||
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
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,29 +1,27 @@
|
||||
package models
|
||||
|
||||
type SysMenu 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;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
SysApi []SysApi `gorm:"many2many:sys_menu_api_rule"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
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;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
SysApi []SysApi `json:"sysApi" gorm:"many2many:sys_menu_api_rule"`
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysMenu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package models
|
||||
|
||||
type Post struct {
|
||||
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"` //岗位排序
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
Sort int `gorm:"size:4;" json:"sort"` //岗位排序
|
||||
Status int `gorm:"size:4;" json:"status"` //状态
|
||||
Remark string `gorm:"size:255;" json:"remark"` //描述
|
||||
ModelTime
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (Post) TableName() string {
|
||||
func (SysPost) TableName() string {
|
||||
return "sys_post"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package 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;"`
|
||||
SysMenu []SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
)
|
||||
|
||||
type SysUser struct {
|
||||
ControlBy
|
||||
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:密码"`
|
||||
@@ -22,6 +20,8 @@ type SysUser struct {
|
||||
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:状态"`
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysUser) TableName() string {
|
||||
@@ -45,4 +45,4 @@ func (e *SysUser) Encrypt() (err error) {
|
||||
|
||||
func (e *SysUser) BeforeCreate(_ *gorm.DB) error {
|
||||
return e.Encrypt()
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -25,11 +25,10 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
new(models.SysMenu),
|
||||
new(models.SysLoginLog),
|
||||
new(models.SysOperaLog),
|
||||
new(models.RoleMenu),
|
||||
new(models.SysRoleDept),
|
||||
new(models.SysUser),
|
||||
new(models.SysRole),
|
||||
new(models.Post),
|
||||
new(models.SysPost),
|
||||
new(models.DictData),
|
||||
new(models.DictType),
|
||||
new(models.SysJob),
|
||||
@@ -47,4 +46,4 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
return db.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1599190683670Test)
|
||||
}
|
||||
|
||||
func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
list3 := []models.SysDept{
|
||||
{DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list4 := []models.SysConfig{
|
||||
{Model: models.Model{Id: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"},
|
||||
{Model: models.Model{Id: 2}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"},
|
||||
{Model: models.Model{Id: 3}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"},
|
||||
}
|
||||
|
||||
list5 := []models.Post{
|
||||
{PostId: 1, PostName: "首席执行官", PostCode: "CEO", Sort: 0, Status: "2", Remark: "首席执行官", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{PostId: 2, PostName: "首席技术执行官", PostCode: "CTO", Sort: 2, Status: "2", Remark: "首席技术执行官", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{PostId: 3, PostName: "首席运营官", PostCode: "COO", Sort: 3, Status: "2", Remark: "测试工程师", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list6 := []models.SysRole{
|
||||
{
|
||||
RoleId: 1,
|
||||
RoleName: "系统管理员",
|
||||
Status: "2",
|
||||
RoleKey: "admin",
|
||||
RoleSort: 1,
|
||||
Flag: "",
|
||||
Remark: "",
|
||||
Admin: true,
|
||||
DataScope: "",
|
||||
ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()},
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
},
|
||||
}
|
||||
|
||||
list7 := []models.DictType{
|
||||
{DictId: 1, DictName: "系统开关", DictType: "sys_normal_disable", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统开关列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 2, DictName: "用户性别", DictType: "sys_user_sex", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "用户性别列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 3, DictName: "菜单状态", DictType: "sys_show_hide", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "菜单状态列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 4, DictName: "系统是否", DictType: "sys_yes_no", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统是否列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 5, DictName: "任务状态", DictType: "sys_job_status", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "任务状态列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 6, DictName: "任务分组", DictType: "sys_job_group", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "任务分组列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 7, DictName: "通知类型", DictType: "sys_notice_type", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "通知类型列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 8, DictName: "系统状态", DictType: "sys_common_status", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "登录状态列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 9, DictName: "操作类型", DictType: "sys_oper_type", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "操作类型列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 10, DictName: "通知状态", DictType: "sys_notice_status", Status: "2", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "通知状态列表", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list8 := []models.SysUser{
|
||||
{
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
ModelTime: models.ModelTime{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
UserId: 1,
|
||||
Username: "admin",
|
||||
Password: "123456",
|
||||
NickName: "zhangwj",
|
||||
Phone: "13818888888",
|
||||
RoleId: 1,
|
||||
Salt: "",
|
||||
Avatar: "",
|
||||
Sex: "1",
|
||||
Email: "1@qq.com",
|
||||
DeptId: 1,
|
||||
PostId: 1,
|
||||
Remark: "",
|
||||
Status: "2",
|
||||
},
|
||||
//{models.SysUserId{1}, models.LoginM{models.UserName{"admin"}, models.PassWord{"$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2"}}, models.SysUserB{"zhangwj", "13818888888", 1, "", "", "0", "1@qq.com", 1, 1, "1", "1", "", "2", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", ""}},
|
||||
}
|
||||
|
||||
list9 := []models.DictData{
|
||||
{DictCode: 1, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统正常", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 2, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统停用", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 3, DictSort: 0, DictLabel: "男", DictValue: "0", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "性别男", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 4, DictSort: 0, DictLabel: "女", DictValue: "1", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "性别女", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 5, DictSort: 0, DictLabel: "未知", DictValue: "2", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "性别未知", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 6, DictSort: 0, DictLabel: "显示", DictValue: "0", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "显示菜单", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 7, DictSort: 0, DictLabel: "隐藏", DictValue: "1", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "隐藏菜单", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 8, DictSort: 0, DictLabel: "是", DictValue: "Y", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统默认是", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 9, DictSort: 0, DictLabel: "否", DictValue: "N", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统默认否", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 10, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "正常状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 11, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "停用状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 12, DictSort: 0, DictLabel: "默认", DictValue: "DEFAULT", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "默认分组", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 13, DictSort: 0, DictLabel: "系统", DictValue: "SYSTEM", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "系统分组", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 14, DictSort: 0, DictLabel: "通知", DictValue: "1", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "通知", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 15, DictSort: 0, DictLabel: "公告", DictValue: "2", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "公告", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 16, DictSort: 0, DictLabel: "正常", DictValue: "0", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "正常状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 17, DictSort: 0, DictLabel: "关闭", DictValue: "1", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "关闭状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 18, DictSort: 0, DictLabel: "新增", DictValue: "1", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "新增操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 19, DictSort: 0, DictLabel: "修改", DictValue: "2", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "修改操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 20, DictSort: 0, DictLabel: "删除", DictValue: "3", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "删除操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 21, DictSort: 0, DictLabel: "授权", DictValue: "4", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "授权操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 22, DictSort: 0, DictLabel: "导出", DictValue: "5", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "导出操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 23, DictSort: 0, DictLabel: "导入", DictValue: "6", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "导入操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 24, DictSort: 0, DictLabel: "强退", DictValue: "7", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "强退操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 25, DictSort: 0, DictLabel: "生成代码", DictValue: "8", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "生成操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 26, DictSort: 0, DictLabel: "清空数据", DictValue: "9", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "清空操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 27, DictSort: 0, DictLabel: "成功", DictValue: "0", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "成功状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 28, DictSort: 0, DictLabel: "失败", DictValue: "1", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "失败状态", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 29, DictSort: 0, DictLabel: "登录", DictValue: "10", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "登录操作", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 30, DictSort: 0, DictLabel: "退出", DictValue: "11", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 31, DictSort: 0, DictLabel: "获取验证码", DictValue: "12", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, Remark: "获取验证码", ModelTime: models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list10 := []models.SysSetting{
|
||||
{1, "go-admin管理系统", "https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png", models.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list11 := []models.SysJob{
|
||||
{
|
||||
JobId: 1,
|
||||
JobName: "接口测试",
|
||||
JobGroup: "DEFAULT",
|
||||
JobType: 1,
|
||||
CronExpression: "0/5 * * * * ",
|
||||
InvokeTarget: "http://localhost:8000",
|
||||
Args: "",
|
||||
MisfirePolicy: 1,
|
||||
Concurrent: 1,
|
||||
Status: 1,
|
||||
EntryId: 0,
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
ModelTime: models.ModelTime{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
},
|
||||
models.SysJob{
|
||||
JobId: 2,
|
||||
JobName: "函数测试",
|
||||
JobGroup: "DEFAULT",
|
||||
JobType: 2,
|
||||
CronExpression: "0/5 * * * * ",
|
||||
InvokeTarget: "ExamplesOne",
|
||||
Args: "参数",
|
||||
MisfirePolicy: 1,
|
||||
Concurrent: 1,
|
||||
Status: 1,
|
||||
EntryId: 0,
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
ModelTime: models.ModelTime{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := tx.Create(list3).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list4).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list5).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list6).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list7).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list8).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list9).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list10).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list11).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := models.InitDb(tx); err != nil {
|
||||
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1599190683680Test)
|
||||
}
|
||||
|
||||
func _1599190683680Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
var err error
|
||||
|
||||
list := []models.SysMenu{
|
||||
{MenuId: 496, MenuName: "Sources", Title: "资源管理", Icon: "network", Path: "/sources", Paths: "/0/496", MenuType: "M", Action: "无", Permission: "", ParentId: 0, NoCache: true, Breadcrumb: "", Component: "Layout", Sort: 3, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "1"},
|
||||
{MenuId: 497, MenuName: "File", Title: "文件管理", Icon: "documentation", Path: "file-manage", Paths: "/0/496/497", MenuType: "C", Action: "", Permission: "", ParentId: 496, NoCache: true, Breadcrumb: "", Component: "/fileManage/index", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "1"},
|
||||
{MenuId: 498, MenuName: "", Title: "内容管理", Icon: "pass", Path: "/content", Paths: "/0/498", MenuType: "M", Action: "无", Permission: "", ParentId: 0, NoCache: true, Breadcrumb: "", Component: "Layout", Sort: 4, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "1"},
|
||||
{MenuId: 499, MenuName: "SysCategory", Title: "分类", Icon: "pass", Path: "syscategory", Paths: "/0/498/499", MenuType: "C", Action: "无", Permission: "syscategory:syscategory:list", ParentId: 498, NoCache: true, Breadcrumb: "", Component: "/syscategory/index", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 500, MenuName: "", Title: "分页获取分类", Icon: "pass", Path: "", Paths: "/0/498/499/500", MenuType: "F", Action: "无", Permission: "syscategory:syscategory:query", ParentId: 499, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 501, MenuName: "", Title: "创建分类", Icon: "pass", Path: "", Paths: "/0/498/499/501", MenuType: "F", Action: "无", Permission: "syscategory:syscategory:add", ParentId: 499, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 502, MenuName: "", Title: "修改分类", Icon: "pass", Path: "", Paths: "/0/498/499/502", MenuType: "F", Action: "无", Permission: "syscategory:syscategory:edit", ParentId: 499, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 503, MenuName: "", Title: "删除分类", Icon: "pass", Path: "", Paths: "/0/498/499/503", MenuType: "F", Action: "无", Permission: "syscategory:syscategory:remove", ParentId: 499, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 504, MenuName: "Category", Title: "分类", Icon: "bug", Path: "category", Paths: "/0/63/504", MenuType: "M", Action: "无", Permission: "", ParentId: 63, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 505, MenuName: "", Title: "分页获取分类", Icon: "bug", Path: "/api/v1/syscategoryList", Paths: "/0/63/504/505", MenuType: "A", Action: "GET", Permission: "", ParentId: 504, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 506, MenuName: "", Title: "根据id获取分类", Icon: "bug", Path: "/api/v1/syscategory/:id", Paths: "/0/63/504/506", MenuType: "A", Action: "GET", Permission: "", ParentId: 504, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 507, MenuName: "", Title: "创建分类", Icon: "bug", Path: "/api/v1/syscategory", Paths: "/0/63/504/507", MenuType: "A", Action: "POST", Permission: "", ParentId: 504, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 508, MenuName: "", Title: "修改分类", Icon: "bug", Path: "/api/v1/syscategory", Paths: "/0/63/504/508", MenuType: "A", Action: "PUT", Permission: "", ParentId: 504, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 509, MenuName: "", Title: "删除分类", Icon: "bug", Path: "/api/v1/syscategory/:id", Paths: "/0/63/504/509", MenuType: "A", Action: "DELETE", Permission: "", ParentId: 504, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 511, MenuName: "SysContent", Title: "内容管理", Icon: "pass", Path: "syscontent", Paths: "/0/498/511", MenuType: "C", Action: "无", Permission: "syscontent:syscontent:list", ParentId: 498, NoCache: true, Breadcrumb: "", Component: "/syscontent/index", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 512, MenuName: "", Title: "分页获取内容管理", Icon: "pass", Path: "", Paths: "/0/510/511/512", MenuType: "F", Action: "无", Permission: "syscontent:syscontent:query", ParentId: 511, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 513, MenuName: "", Title: "创建内容管理", Icon: "pass", Path: "", Paths: "/0/510/511/513", MenuType: "F", Action: "无", Permission: "syscontent:syscontent:add", ParentId: 511, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 514, MenuName: "", Title: "修改内容管理", Icon: "pass", Path: "", Paths: "/0/510/511/514", MenuType: "F", Action: "无", Permission: "syscontent:syscontent:edit", ParentId: 511, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 515, MenuName: "", Title: "删除内容管理", Icon: "pass", Path: "", Paths: "/0/510/511/515", MenuType: "F", Action: "无", Permission: "syscontent:syscontent:remove", ParentId: 511, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "0", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 516, MenuName: "Content", Title: "内容管理", Icon: "bug", Path: "content", Paths: "/0/63/516", MenuType: "M", Action: "无", Permission: "", ParentId: 63, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 517, MenuName: "", Title: "分页获取内容管理", Icon: "bug", Path: "/api/v1/syscontentList", Paths: "/0/63/516/517", MenuType: "A", Action: "GET", Permission: "", ParentId: 516, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 518, MenuName: "", Title: "根据id获取内容管理", Icon: "bug", Path: "/api/v1/syscontent/:id", Paths: "/0/63/516/518", MenuType: "A", Action: "GET", Permission: "", ParentId: 516, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 519, MenuName: "", Title: "创建内容管理", Icon: "bug", Path: "/api/v1/syscontent", Paths: "/0/63/516/519", MenuType: "A", Action: "POST", Permission: "", ParentId: 516, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 520, MenuName: "", Title: "修改内容管理", Icon: "bug", Path: "/api/v1/syscontent", Paths: "/0/63/516/520", MenuType: "A", Action: "PUT", Permission: "", ParentId: 516, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
{MenuId: 521, MenuName: "", Title: "删除内容管理", Icon: "bug", Path: "/api/v1/syscontent/:id", Paths: "/0/63/516/521", MenuType: "A", Action: "DELETE", Permission: "", ParentId: 516, NoCache: true, Breadcrumb: "", Component: "", Sort: 0, Visible: "1", ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1}, IsFrame: "0"},
|
||||
}
|
||||
|
||||
err = tx.Create(list).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1600089797118Migrate)
|
||||
}
|
||||
|
||||
func _1600089797118Migrate(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
f := &models.SysFileDir{
|
||||
Label: "根目录",
|
||||
PId: 0,
|
||||
Sort: "0",
|
||||
Path: "",
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
}
|
||||
err := tx.Create(f).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1602644950000Test)
|
||||
}
|
||||
|
||||
func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Migrator().HasColumn(&models.SysConfig{}, "config_id") {
|
||||
err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
list2 := []models.CasbinRule{
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"},
|
||||
}
|
||||
err := tx.Create(list2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
menu := models.SysMenu{MenuId: 86, Path: "/api/v1/config"}
|
||||
err = tx.Model(&menu).Where("menu_id = ?", 86).Update("Path", "/api/v1/config").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603465014697Test)
|
||||
}
|
||||
|
||||
func _1603465014697Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
err := tx.Debug().Model(&models.SysMenu{}).Where("path = ?", "/api/v1/syscategoryList").Update("path", "/api/v1/syscategory").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603516925109Test)
|
||||
}
|
||||
|
||||
func _1603516925109Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
_ = tx.Migrator().RenameTable("sys_operlog", "sys_opera_log")
|
||||
_ = tx.Migrator().RenameTable("sys_loginlog", "sys_login_log")
|
||||
|
||||
if tx.Migrator().HasColumn(&models.SysLoginLog{}, "info_id") {
|
||||
err := tx.Migrator().RenameColumn(&models.SysLoginLog{}, "info_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if tx.Migrator().HasColumn(&models.SysOperaLog{}, "oper_id") {
|
||||
err := tx.Migrator().RenameColumn(&models.SysOperaLog{}, "oper_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1606579402398Test)
|
||||
}
|
||||
|
||||
func _1606579402398Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
dicData := models.DictData{}
|
||||
err := tx.Model(&dicData).Where("dict_code = ?", 1).Update("dict_value", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dicType := models.DictType{}
|
||||
err = tx.Model(&dicType).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
user := models.SysUser{}
|
||||
err = tx.Model(&user).Where("user_id = ?", 1).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1606582844753Test)
|
||||
}
|
||||
|
||||
func _1606582844753Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
dept := models.SysDept{}
|
||||
err := tx.Model(&dept).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dictData := models.DictData{}
|
||||
err = tx.Model(&dictData).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (522, 'SysContentCreate', '新增', 'form', 'syscontent/create', '/0/498/522', 'C', '', 'syscontent:syscontent:add', 498, 0, '', '/syscontent/create.vue', 0, '1', '1', '1', '1', '2020-11-08 17:00:35.259', '2020-11-12 22:55:50.739', NULL);"
|
||||
sql2 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (523, 'SysContentEdit', '编辑', 'edit', 'syscontent/edit:id', '/0/498/523', 'C', '', 'syscontent:syscontent:edit', 498, 0, '', '/syscontent/edit.vue', 0, '1', '1', '1', '1', '2020-11-12 22:53:42.643', '2020-11-12 22:54:56.852', NULL);"
|
||||
|
||||
err = tx.Exec(sql1).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Exec(sql2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1610427732413Test)
|
||||
}
|
||||
|
||||
func _1610427732413Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
user := models.SysUser{}
|
||||
err := tx.Model(&user).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1610804233204Test)
|
||||
}
|
||||
|
||||
func _1610804233204Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
post := models.Post{}
|
||||
err := tx.Model(&post).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
role := models.SysRole{}
|
||||
err = tx.Model(&role).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613638159444Test)
|
||||
}
|
||||
|
||||
func _1613638159444Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
// TODO: 例如 修改表字段 使用过程中请删除此段代码
|
||||
err := tx.Migrator().AlterColumn(&models.SysRole{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613697961697Test)
|
||||
}
|
||||
|
||||
func _1613697961697Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
//修改字段类型
|
||||
err := tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613720892819Test)
|
||||
}
|
||||
|
||||
func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
t := &models.DictType{
|
||||
DictName: "内容状态",
|
||||
DictType: "sys_content_status",
|
||||
Status: "2",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
err := tx.Create(t).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
data := make([]models.DictData, 2)
|
||||
data[0] = models.DictData{
|
||||
DictSort: 0,
|
||||
DictLabel: "正常",
|
||||
DictValue: "1",
|
||||
DictType: "sys_content_status",
|
||||
Status: "1",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
data[1] = models.DictData{
|
||||
DictSort: 1,
|
||||
DictLabel: "禁用",
|
||||
DictValue: "2",
|
||||
DictType: "sys_content_status",
|
||||
Status: "1",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
err = tx.Create(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: 例如 修改表字段 使用过程中请删除此段代码
|
||||
//err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
// TODO: 例如 新增表结构 使用过程中请删除此段代码
|
||||
//err = tx.Debug().Migrator().AutoMigrate(
|
||||
// new(models.CasbinRule),
|
||||
// )
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613783303115Test)
|
||||
}
|
||||
|
||||
func _1613783303115Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
//修改字段类型
|
||||
err := tx.Model(&models.DictType{}).Select("create_by").Not("create_by > 0").Update("create_by", "0").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Model(&models.DictType{}).Select("update_by").Not("update_by > 0").Update("update_by", "0").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Model(&models.DictType{}).Select("create_by").Not("create_by > 0").Update("create_by", "0").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Model(&models.DictType{}).Select("update_by").Not("update_by > 0").Update("update_by", "0").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613978564961Test)
|
||||
}
|
||||
|
||||
func _1613978564961Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
menu := models.SysMenu{MenuId: 110, Path: "/api/v1/config"}
|
||||
err := tx.Model(&menu).Where("menu_id = ?", 110).Update("Path", "/api/v1/dict/data-all").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613998164781Test)
|
||||
}
|
||||
|
||||
func _1613998164781Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/deptList").Update("path", "/api/v1/dept").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/roleList").Update("path", "/api/v1/role").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/menuList").Update("path", "/api/v1/menu").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/postList").Update("path", "/api/v1/post").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/dict/typelist").Update("path", "/api/v1/dict/type").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/dict/datalist").Update("path", "/api/v1/dict/data").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/dict/data").
|
||||
Where("action = ?", "PUT").Update("path", "/api/v1/dict/data/:id").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/dict/data/:id").
|
||||
Where("action = ?", "DELETE").Update("path", "/api/v1/dict/data").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/dict/type").
|
||||
Where("action = ?", "PUT").Update("path", "/api/v1/dict/type/:id").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/dict/type/:id").
|
||||
Where("action = ?", "DELETE").Update("path", "/api/v1/dict/type").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/operloglist").Update("path", "/api/v1/sys-opera-log").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/loginloglist").Update("path", "/api/v1/sys-login-log").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/loginlog/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/operloglist%").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("path like ?", "/api/v1/role/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/role").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1614073723691Test)
|
||||
}
|
||||
|
||||
func _1614073723691Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
err := tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/syscontentList").Update("path", "/api/v1/syscontent").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1614159531111Test)
|
||||
}
|
||||
|
||||
func _1614159531111Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `is_frame`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (525, '', '公共资源目录获取', 'bug', '/api/v1/sysfiledir', '', 'A', 'GET', '', 256, 0, '', '', 0, '1', '1', 1, 1, '2021-02-24 17:36:02.900', '2021-02-24 17:36:16.600', NULL);"
|
||||
sql2 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `is_frame`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (526, '', '公共资源获取', 'bug', '/api/v1/sysfileinfo', '', 'A', 'GET', '', 256, 0, '', '', 0, '1', '1', 1, 0, '2021-02-24 17:36:49.575', '2021-02-24 17:36:49.575', NULL);"
|
||||
err := tx.Exec(sql1).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Exec(sql2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1614604763713Test)
|
||||
}
|
||||
|
||||
func _1614604763713Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/dict/typeoptionselect").Update("path", "/api/v1/dict/type-option-select").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("action = ?", "GET").
|
||||
Where("path = ?", "/api/v1/sysUserList").Update("path", "/api/v1/sysUser").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("action = ?", "DELETE").
|
||||
Where("path = ?", "/api/v1/sysUser/:id").Update("path", "/api/v1/sysUser").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&models.SysUser{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysUser{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&models.SysContent{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysContent{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Model(&models.SysMenu{}).Where("action = ?", "PUT").
|
||||
Where("path = ?", "/api/v1/syscontent").Update("path", "/api/v1/syscontent/:id").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Model(&models.SysMenu{}).Where("action = ?", "DELETE").
|
||||
Where("path = ?", "/api/v1/syscontent/:id").Update("path", "/api/v1/syscontent").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1615447091566Test)
|
||||
}
|
||||
|
||||
func _1615447091566Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
// TODO: 例如 修改表字段 使用过程中请删除此段代码
|
||||
sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (522, 'SysContentCreate', '新增', 'form', 'syscontent/create', '/0/498/522', 'C', '', 'syscontent:syscontent:add', 498, 0, '', '/syscontent/create.vue', 0, '1', '1', '1', '1', '2020-11-08 17:00:35.259', '2020-11-12 22:55:50.739', NULL);"
|
||||
|
||||
err := tx.Exec(sql1).Error
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1615948084336Test)
|
||||
}
|
||||
|
||||
func _1615948084336Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error
|
||||
if err != nil && !strings.Contains(err.Error(), "Duplicate column name 'is_frontend'") {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1615950701614Test)
|
||||
}
|
||||
|
||||
func _1615950701614Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Exec("UPDATE sys_dict_data t SET t.dict_value = '2' WHERE t.dict_code = 16").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Exec("UPDATE sys_opera_log t SET t.status = '2' WHERE t.status = '0'").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1615961953379Test)
|
||||
}
|
||||
|
||||
func _1615961953379Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Exec("INSERT INTO `sys_config` (`id`, `config_name`, `config_key`, `config_value`, `config_type`, `is_frontend`, `remark`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (4, '系统名称', 'sys_app_name', 'go-admin管理系统', 'Y', 1, '', 1, 0, '2021-03-17 08:52:06.067', '2021-03-17 08:52:06.067', NULL);").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Exec("INSERT INTO `sys_config` (`id`, `config_name`, `config_key`, `config_value`, `config_type`, `is_frontend`, `remark`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (5, '系统logo', 'sys_app_logo', 'https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png', 'Y', 1, '', 1, 0, '2021-03-17 08:53:19.462', '2021-03-17 08:53:19.462', NULL);").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1619418811873Test)
|
||||
}
|
||||
|
||||
func _1619418811873Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
err := tx.Migrator().AlterColumn(&models.SysRole{}, "CreateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "UpdateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysJob{}, "CreateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.SysJob{}, "UpdateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.RoleMenu{}, "CreateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&models.RoleMenu{}, "UpdateBy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func run() {
|
||||
if !generate {
|
||||
fmt.Println(`start init`)
|
||||
//1. 读取配置
|
||||
config.Setup(file.NewSource, file.WithPath(configYml))
|
||||
config.Setup(file.NewSource(file.WithPath(configYml)))
|
||||
//2. 设置日志
|
||||
sdk.Runtime.SetLogger(
|
||||
logger.SetupLogger(
|
||||
|
||||
+4114
-155
File diff suppressed because it is too large.
Load diff
@@ -9,18 +9,19 @@ require (
|
||||
github.com/bytedance/go-tagexpr/v2 v2.7.10
|
||||
github.com/casbin/casbin/v2 v2.25.1
|
||||
github.com/gin-gonic/gin v1.7.1
|
||||
github.com/go-admin-team/go-admin-core v1.3.5-rc.0
|
||||
github.com/go-admin-team/go-admin-core/sdk v1.3.0-rc.3.0.20210519112810-242d8766f4b9
|
||||
github.com/go-admin-team/go-admin-core v1.3.5-rc.3.0.20210609131805-5526c5244c52
|
||||
github.com/go-admin-team/go-admin-core/sdk v1.3.0-rc.3.0.20210609131805-5526c5244c52
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/mssola/user_agent v0.5.2
|
||||
github.com/opentracing/opentracing-go v1.1.0
|
||||
github.com/prometheus/client_golang v1.1.0
|
||||
github.com/prometheus/client_golang v1.11.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/shirou/gopsutil v2.20.7+incompatible
|
||||
github.com/shirou/gopsutil v3.21.5+incompatible
|
||||
github.com/spf13/cast v1.3.1
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/swaggo/gin-swagger v1.2.0
|
||||
github.com/swaggo/swag v1.6.7
|
||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||
github.com/unrolled/secure v1.0.8
|
||||
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
|
||||
|
||||
Reference in new issue
Block a user