mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 02:04:09 +00:00
fix 🐛 优化迁移功能
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
@@ -424,7 +423,7 @@ func (e *SysUser) GetInfo(c *gin.Context) {
|
||||
var buttons = make([]string, 1)
|
||||
buttons[0] = "*:*:*"
|
||||
|
||||
RoleMenu := models.RoleMenu{}
|
||||
RoleMenu := system.RoleMenu{}
|
||||
RoleMenu.RoleId = user.GetRoleId(c)
|
||||
|
||||
var mp = make(map[string]interface{})
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
)
|
||||
|
||||
// @Summary RoleMenu列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色菜单
|
||||
// @Param RoleId query string false "RoleId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /api/v1/rolemenu [get]
|
||||
// @Security Bearer
|
||||
//func GetRoleMenu(c *gin.Context) {
|
||||
// var Rm models.RoleMenu
|
||||
// err := c.ShouldBind(&Rm)
|
||||
// result, err := Rm.Get()
|
||||
// var res response.Response
|
||||
// if err != nil {
|
||||
// res.Msg = "抱歉未找到相关信息"
|
||||
// c.JSON(http.StatusOK, res.ReturnError(200))
|
||||
// return
|
||||
// }
|
||||
// res.Data = result
|
||||
// c.JSON(http.StatusOK, res.ReturnOK())
|
||||
//}
|
||||
|
||||
type RoleMenuPost struct {
|
||||
RoleId string
|
||||
RoleMenu []models.RoleMenu
|
||||
}
|
||||
|
||||
//func InsertRoleMenu(c *gin.Context) {
|
||||
//
|
||||
// var res response.Response
|
||||
// res.Msg = "添加成功"
|
||||
// c.JSON(http.StatusOK, res.ReturnOK())
|
||||
// return
|
||||
//
|
||||
//}
|
||||
|
||||
// @Summary 删除用户菜单数据
|
||||
// @Description 删除数据
|
||||
// @Tags 角色菜单
|
||||
// @Param id path string true "id"
|
||||
// @Param menu_id query string false "menu_id"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/rolemenu/{id} [delete]
|
||||
//func DeleteRoleMenu(c *gin.Context) {
|
||||
// var t models.RoleMenu
|
||||
// id := c.Param("id")
|
||||
// menuId := c.Request.FormValue("menu_id")
|
||||
// fmt.Println(menuId)
|
||||
// _, err := t.Delete(id, menuId)
|
||||
// if err != nil {
|
||||
// var res response.Response
|
||||
// res.Msg = "删除失败"
|
||||
// c.JSON(http.StatusOK, res.ReturnError(200))
|
||||
// return
|
||||
// }
|
||||
// var res response.Response
|
||||
// res.Msg = "删除成功"
|
||||
// c.JSON(http.StatusOK, res.ReturnOK())
|
||||
// return
|
||||
//}
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
@@ -274,9 +273,9 @@ func (e *SysMenu) GetMenuIDS(c *gin.Context) {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
var data models.RoleMenu
|
||||
var data system.RoleMenu
|
||||
data.RoleName = c.GetString("role")
|
||||
data.UpdateBy = user.GetUserIdStr(c)
|
||||
data.UpdateBy = user.GetUserId(c)
|
||||
result, err := data.GetIDS(db)
|
||||
if err != nil {
|
||||
log.Errorf("GetIDS error, %s", err.Error())
|
||||
|
||||
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"errors"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"go-admin/common/models"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
@@ -33,7 +34,7 @@ type Menu struct {
|
||||
RoleId int `gorm:"-"`
|
||||
Children []Menu `json:"children" gorm:"-"`
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
BaseModel
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (Menu) TableName() string {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package models
|
||||
|
||||
import "go-admin/common/models"
|
||||
|
||||
type SysRole struct {
|
||||
RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码
|
||||
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||
@@ -7,12 +9,11 @@ type SysRole struct {
|
||||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
Flag string `json:"flag" gorm:"size:128;"` //
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Admin bool `json:"admin" gorm:"size:4;"`
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
BaseModel
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type RoleMenu struct {
|
||||
RoleId int `gorm:""`
|
||||
MenuId int `gorm:""`
|
||||
RoleName string `gorm:"size:128)"`
|
||||
CreateBy string `gorm:"size:128)"`
|
||||
UpdateBy string `gorm:"size:128)"`
|
||||
}
|
||||
|
||||
func (RoleMenu) TableName() string {
|
||||
return "sys_role_menu"
|
||||
}
|
||||
|
||||
type MenuPath struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
//func (rm *RoleMenu) Get(tx *gorm.DB) ([]RoleMenu, error) {
|
||||
// var r []RoleMenu
|
||||
// table := tx.Table("sys_role_menu")
|
||||
// if rm.RoleId != 0 {
|
||||
// table = table.Where("role_id = ?", rm.RoleId)
|
||||
//
|
||||
// }
|
||||
// if err := table.Find(&r).Error; err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return r, nil
|
||||
//}
|
||||
|
||||
func (rm *RoleMenu) GetPermis(tx *gorm.DB) ([]string, error) {
|
||||
var r []Menu
|
||||
table := tx.Select("sys_menu.permission").Table("sys_menu").Joins("left join sys_role_menu on sys_menu.menu_id = sys_role_menu.menu_id")
|
||||
|
||||
table = table.Where("role_id = ?", rm.RoleId)
|
||||
|
||||
table = table.Where("sys_menu.menu_type in('F','C')")
|
||||
if err := table.Find(&r).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var list []string
|
||||
for i := 0; i < len(r); i++ {
|
||||
list = append(list, r[i].Permission)
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (rm *RoleMenu) GetIDS(tx *gorm.DB) ([]MenuPath, error) {
|
||||
var r []MenuPath
|
||||
table := tx.Select("sys_menu.path").Table("sys_role_menu")
|
||||
table = table.Joins("left join sys_role on sys_role.role_id=sys_role_menu.role_id")
|
||||
table = table.Joins("left join sys_menu on sys_menu.id=sys_role_menu.menu_id")
|
||||
table = table.Where("sys_role.role_name = ? and sys_menu.type=1", rm.RoleName)
|
||||
if err := table.Find(&r).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
//func (rm *RoleMenu) DeleteRoleMenu(roleId int) (bool, error) {
|
||||
// tx := orm.Eloquent.Begin()
|
||||
// defer func() {
|
||||
// if r := recover(); r != nil {
|
||||
// tx.Rollback()
|
||||
// }
|
||||
// }()
|
||||
//
|
||||
// if err := tx.Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
//
|
||||
// if err := tx.Table("sys_role_dept").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// if err := tx.Table("sys_role_menu").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// var role SysRole
|
||||
// if err := tx.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// sql3 := "delete from sys_casbin_rule where v0= '" + role.RoleKey + "';"
|
||||
// if err := tx.Exec(sql3).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// if err := tx.Commit().Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
//
|
||||
// return true, nil
|
||||
//
|
||||
//}
|
||||
|
||||
// 该方法即将弃用
|
||||
//func (rm *RoleMenu) BatchDeleteRoleMenu(roleIds []int) (bool, error) {
|
||||
// tx := orm.Eloquent.Begin()
|
||||
// defer func() {
|
||||
// if r := recover(); r != nil {
|
||||
// tx.Rollback()
|
||||
// }
|
||||
// }()
|
||||
//
|
||||
// if err := tx.Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
//
|
||||
// if err := tx.Table("sys_role_menu").Where("role_id in (?)", roleIds).Delete(&rm).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// var role []SysRole
|
||||
// if err := tx.Table("sys_role").Where("role_id in (?)", roleIds).Find(&role).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// sql := ""
|
||||
// for i := 0; i < len(role); i++ {
|
||||
// sql += "delete from sys_casbin_rule where v0= '" + role[i].RoleName + "';"
|
||||
// }
|
||||
// if err := tx.Exec(sql).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// if err := tx.Commit().Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
// return true, nil
|
||||
//
|
||||
//}
|
||||
|
||||
//func (rm *RoleMenu) Insert(roleId int, menuId []int) (bool, error) {
|
||||
// var (
|
||||
// role SysRole
|
||||
// menu []Menu
|
||||
// casbinRuleQueue []system.CasbinRule // casbinRule 待插入队列
|
||||
// )
|
||||
//
|
||||
// // 开始事务
|
||||
// tx := orm.Eloquent.Begin()
|
||||
// defer func() {
|
||||
// if r := recover(); r != nil {
|
||||
// tx.Rollback()
|
||||
// }
|
||||
// }()
|
||||
//
|
||||
// if err := tx.Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
//
|
||||
// // 在事务中做一些数据库操作(从这一点使用'tx',而不是'db')
|
||||
// if err := tx.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// if err := tx.Table("sys_menu").Where("menu_id in (?)", menuId).Find(&menu).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// //ORM不支持批量插入所以需要拼接 sql 串
|
||||
// sysRoleMenuSql := "INSERT INTO `sys_role_menu` (`role_id`,`menu_id`,`role_name`) VALUES "
|
||||
// casbinRuleSql := "INSERT INTO `sys_casbin_rule` (`p_type`,`v0`,`v1`,`v2`) VALUES "
|
||||
//
|
||||
// for i, m := range menu {
|
||||
// // 拼装'role_menu'表批量插入SQL语句
|
||||
// sysRoleMenuSql += fmt.Sprintf("(%d,%d,'%s')", role.RoleId, m.MenuId, role.RoleKey)
|
||||
// if i == len(menu)-1 {
|
||||
// sysRoleMenuSql += ";" //最后一条数据 以分号结尾
|
||||
// } else {
|
||||
// sysRoleMenuSql += ","
|
||||
// }
|
||||
// if m.MenuType == "A" {
|
||||
// // 加入队列
|
||||
// casbinRuleQueue = append(casbinRuleQueue,
|
||||
// system.CasbinRule{
|
||||
// V0: role.RoleKey,
|
||||
// V1: m.Path,
|
||||
// V2: m.Action,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// // 执行批量插入sys_role_menu
|
||||
// if err := tx.Exec(sysRoleMenuSql).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
//
|
||||
// // 拼装'sys_casbin_rule'批量插入SQL语句
|
||||
// // TODO: casbinRuleQueue队列不为空时才会拼装,否则直接忽略不执行'for'循环
|
||||
// for i, v := range casbinRuleQueue {
|
||||
// casbinRuleSql += fmt.Sprintf("('p','%s','%s','%s')", v.V0, v.V1, v.V2)
|
||||
// if i == len(casbinRuleQueue)-1 {
|
||||
// casbinRuleSql += ";"
|
||||
// } else {
|
||||
// casbinRuleSql += ","
|
||||
// }
|
||||
// }
|
||||
// // 执行批量插入sys_casbin_rule
|
||||
// if len(casbinRuleQueue) > 0 {
|
||||
// if err := tx.Exec(casbinRuleSql).Error; err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, err
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if err := tx.Commit().Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
// return true, nil
|
||||
//}
|
||||
|
||||
//func (rm *RoleMenu) Delete(RoleId string, MenuID string) (bool, error) {
|
||||
// rm.RoleId, _ = tools.StringToInt(RoleId)
|
||||
// table := orm.Eloquent.Table("sys_role_menu").Where("role_id = ?", RoleId)
|
||||
// if MenuID != "" {
|
||||
// table = table.Where("menu_id = ?", MenuID)
|
||||
// }
|
||||
// if err := table.Delete(&rm).Error; err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
// return true, nil
|
||||
//
|
||||
//}
|
||||
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type SysJob struct {
|
||||
@@ -18,9 +17,8 @@ type SysJob struct {
|
||||
Concurrent int `json:"concurrent" gorm:"size:1;"` // 是否并发
|
||||
Status int `json:"status" gorm:"size:1;"` // 状态
|
||||
EntryId int `json:"entry_id" gorm:"size:11;"` // job启动时返回的id
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||
BaseModel
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
}
|
||||
@@ -39,11 +37,11 @@ func (e *SysJob) GetId() interface{} {
|
||||
}
|
||||
|
||||
func (e *SysJob) SetCreateBy(createBy int) {
|
||||
e.CreateBy = strconv.Itoa(int(createBy))
|
||||
e.CreateBy = createBy
|
||||
}
|
||||
|
||||
func (e *SysJob) SetUpdateBy(updateBy int) {
|
||||
e.UpdateBy = strconv.Itoa(int(updateBy))
|
||||
e.UpdateBy = updateBy
|
||||
}
|
||||
|
||||
// 创建SysJob
|
||||
|
||||
@@ -2,18 +2,19 @@ package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type RoleMenu struct {
|
||||
RoleId int `gorm:""`
|
||||
MenuId int `gorm:""`
|
||||
RoleName string `gorm:"size:128"`
|
||||
CreateBy string `gorm:"size:128"`
|
||||
UpdateBy string `gorm:"size:128"`
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
func (RoleMenu) TableName() string {
|
||||
|
||||
@@ -11,10 +11,9 @@ type DictData struct {
|
||||
IsDefault string `gorm:"size:8;" json:"isDefault"` //
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
Default string `gorm:"size:8;" json:"default"` //
|
||||
CreateBy string `gorm:"size:64;" json:"createBy"` //
|
||||
UpdateBy string `gorm:"size:64;" json:"updateBy"` //
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
BaseModel
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (DictData) TableName() string {
|
||||
|
||||
@@ -5,10 +5,9 @@ type DictType struct {
|
||||
DictName string `gorm:"size:128;" json:"dictName"` //字典名称
|
||||
DictType string `gorm:"size:128;" json:"dictType"` //字典类型
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
CreateBy string `gorm:"size:11;" json:"createBy"` //创建者
|
||||
UpdateBy string `gorm:"size:11;" json:"updateBy"` //更新者
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
BaseModel
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (DictType) TableName() string {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
PostId int `gorm:"primaryKey;autoIncrement" json:"postId"` //岗位编号
|
||||
PostName string `gorm:"size:128;" json:"postName"` //岗位名称
|
||||
@@ -11,11 +7,8 @@ type Post struct {
|
||||
Sort int `gorm:"" json:"sort"` //岗位排序
|
||||
Status string `gorm:"size:4;" json:"status"` //状态
|
||||
Remark string `gorm:"size:255;" json:"remark"` //描述
|
||||
CreateBy string `gorm:"size:128;" json:"createBy"`
|
||||
UpdateBy string `gorm:"size:128;" json:"updateBy"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt *time.Time `json:"deletedAt"`
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (Post) TableName() string {
|
||||
|
||||
@@ -7,12 +7,11 @@ type SysRole struct {
|
||||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||
Flag string `json:"flag" gorm:"size:128;"` //
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Admin bool `json:"admin" gorm:"size:4;"`
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
BaseModel
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
|
||||
@@ -4,8 +4,7 @@ type RoleMenu struct {
|
||||
RoleId int `gorm:""`
|
||||
MenuId int `gorm:""`
|
||||
RoleName string `gorm:"size:128)"`
|
||||
CreateBy string `gorm:"size:128)"`
|
||||
UpdateBy string `gorm:"size:128)"`
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (RoleMenu) TableName() string {
|
||||
|
||||
@@ -2,8 +2,6 @@ package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
@@ -28,7 +26,7 @@ type SysOperaLog struct {
|
||||
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
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysOperaLog) TableName() string {
|
||||
|
||||
@@ -22,10 +22,6 @@ 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:状态"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
PostIds []int `json:"postIds" gorm:"-"`
|
||||
RoleIds []int `json:"roleIds" gorm:"-"`
|
||||
Dept *SysDept `json:"dept"`
|
||||
}
|
||||
|
||||
func (SysUser) TableName() string {
|
||||
|
||||
@@ -33,12 +33,10 @@ type SysColumns struct {
|
||||
FkTableName string `gorm:"" json:"fkTableName"`
|
||||
FkTableNameClass string `gorm:"" json:"fkTableNameClass"`
|
||||
FkTableNamePackage string `gorm:"" json:"fkTableNamePackage"`
|
||||
FkCol []SysColumns `gorm:"-" json:"fkCol"`
|
||||
FkLabelId string `gorm:"" json:"fkLabelId"`
|
||||
FkLabelName string `gorm:"size:255;" json:"fkLabelName"`
|
||||
CreateBy string `gorm:"column:create_by;size:128;" json:"createBy"`
|
||||
UpdateBy string `gorm:"column:update_By;size:128;" json:"updateBy"`
|
||||
BaseModel
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysColumns) TableName() string {
|
||||
|
||||
@@ -12,11 +12,8 @@ type SysJob struct {
|
||||
Concurrent int `json:"concurrent" gorm:"size:1;"` // 是否并发
|
||||
Status int `json:"status" gorm:"size:1;"` // 状态
|
||||
EntryId int `json:"entry_id" gorm:"size:11;"` // job启动时返回的id
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||
BaseModel
|
||||
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysJob) TableName() string {
|
||||
|
||||
@@ -27,10 +27,8 @@ type SysTables struct {
|
||||
IsLogicalDelete string `gorm:"size:1;" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"size:1;" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`
|
||||
CreateBy string `gorm:"size:128;" json:"createBy"`
|
||||
UpdateBy string `gorm:"size:128;" json:"updateBy"`
|
||||
|
||||
BaseModel
|
||||
ModelTime
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysTables) TableName() string {
|
||||
|
||||
@@ -34,26 +34,38 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
}
|
||||
|
||||
list5 := []models.Post{
|
||||
{PostId: 1, PostName: "首席执行官", PostCode: "CEO", Sort: 0, Status: "2", Remark: "首席执行官", CreateBy: "1", UpdateBy: "1", CreatedAt: time.Now(), UpdatedAt: time.Now()},
|
||||
{PostId: 2, PostName: "首席技术执行官", PostCode: "CTO", Sort: 2, Status: "2", Remark: "首席技术执行官", CreateBy: "1", UpdateBy: "1", CreatedAt: time.Now(), UpdatedAt: time.Now()},
|
||||
{PostId: 3, PostName: "首席运营官", PostCode: "COO", Sort: 3, Status: "2", Remark: "测试工程师", CreateBy: "1", UpdateBy: "1", CreatedAt: time.Now(), UpdatedAt: time.Now()},
|
||||
{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{
|
||||
{1, "系统管理员", "2", "admin", 1, "", "1", "0", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{
|
||||
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", CreateBy: "1", UpdateBy: "1", Remark: "系统开关列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 2, DictName: "用户性别", DictType: "sys_user_sex", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "用户性别列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 3, DictName: "菜单状态", DictType: "sys_show_hide", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "菜单状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 4, DictName: "系统是否", DictType: "sys_yes_no", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "系统是否列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 5, DictName: "任务状态", DictType: "sys_job_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "任务状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 6, DictName: "任务分组", DictType: "sys_job_group", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "任务分组列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 7, DictName: "通知类型", DictType: "sys_notice_type", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "通知类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 8, DictName: "系统状态", DictType: "sys_common_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "登录状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 9, DictName: "操作类型", DictType: "sys_oper_type", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "操作类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictId: 10, DictName: "通知状态", DictType: "sys_notice_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "通知状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{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{
|
||||
@@ -85,37 +97,37 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
}
|
||||
|
||||
list9 := []models.DictData{
|
||||
{DictCode: 1, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统正常", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 2, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统停用", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 3, DictSort: 0, DictLabel: "男", DictValue: "0", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别男", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 4, DictSort: 0, DictLabel: "女", DictValue: "1", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别女", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 5, DictSort: 0, DictLabel: "未知", DictValue: "2", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别未知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 6, DictSort: 0, DictLabel: "显示", DictValue: "0", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "显示菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 7, DictSort: 0, DictLabel: "隐藏", DictValue: "1", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "隐藏菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 8, DictSort: 0, DictLabel: "是", DictValue: "Y", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认是", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 9, DictSort: 0, DictLabel: "否", DictValue: "N", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认否", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 10, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 11, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "停用状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 12, DictSort: 0, DictLabel: "默认", DictValue: "DEFAULT", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "默认分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 13, DictSort: 0, DictLabel: "系统", DictValue: "SYSTEM", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 14, DictSort: 0, DictLabel: "通知", DictValue: "1", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "通知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 15, DictSort: 0, DictLabel: "公告", DictValue: "2", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "公告", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 16, DictSort: 0, DictLabel: "正常", DictValue: "0", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 17, DictSort: 0, DictLabel: "关闭", DictValue: "1", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "关闭状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 18, DictSort: 0, DictLabel: "新增", DictValue: "1", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "新增操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 19, DictSort: 0, DictLabel: "修改", DictValue: "2", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "修改操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 20, DictSort: 0, DictLabel: "删除", DictValue: "3", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "删除操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 21, DictSort: 0, DictLabel: "授权", DictValue: "4", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "授权操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 22, DictSort: 0, DictLabel: "导出", DictValue: "5", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导出操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 23, DictSort: 0, DictLabel: "导入", DictValue: "6", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导入操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 24, DictSort: 0, DictLabel: "强退", DictValue: "7", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "强退操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 25, DictSort: 0, DictLabel: "生成代码", DictValue: "8", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "生成操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 26, DictSort: 0, DictLabel: "清空数据", DictValue: "9", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "清空操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 27, DictSort: 0, DictLabel: "成功", DictValue: "0", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "成功状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 28, DictSort: 0, DictLabel: "失败", DictValue: "1", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "失败状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 29, DictSort: 0, DictLabel: "登录", DictValue: "10", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "登录操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 30, DictSort: 0, DictLabel: "退出", DictValue: "11", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DictCode: 31, DictSort: 0, DictLabel: "获取验证码", DictValue: "12", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "获取验证码", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{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{
|
||||
@@ -123,8 +135,48 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
}
|
||||
|
||||
list11 := []models.SysJob{
|
||||
{1, "接口测试", "DEFAULT", 1, "0/5 * * * * ", "http://localhost:8000", "", 1, 1, 1, 0, "", "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ""},
|
||||
{2, "函数测试", "DEFAULT", 2, "0/5 * * * * ", "ExamplesOne", "参数", 1, 1, 1, 0, "", "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ""},
|
||||
{
|
||||
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
|
||||
|
||||
@@ -23,8 +23,7 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
DictName: "内容状态",
|
||||
DictType: "sys_content_status",
|
||||
Status: "2",
|
||||
CreateBy: "1",
|
||||
UpdateBy: "1",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
err := tx.Create(t).Error
|
||||
if err != nil {
|
||||
@@ -38,8 +37,7 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
DictValue: "1",
|
||||
DictType: "sys_content_status",
|
||||
Status: "1",
|
||||
CreateBy: "1",
|
||||
UpdateBy: "1",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
data[1] = models.DictData{
|
||||
DictSort: 1,
|
||||
@@ -47,8 +45,7 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
DictValue: "2",
|
||||
DictType: "sys_content_status",
|
||||
Status: "1",
|
||||
CreateBy: "1",
|
||||
UpdateBy: "1",
|
||||
ControlBy: models.ControlBy{CreateBy: 1, UpdateBy: 1},
|
||||
}
|
||||
err = tx.Create(data).Error
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user