mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 02:04:09 +00:00
@@ -0,0 +1,51 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -1,84 +0,0 @@
|
||||
package sys_content
|
||||
|
||||
//import (
|
||||
// "github.com/gin-gonic/gin"
|
||||
// "github.com/gin-gonic/gin/binding"
|
||||
//
|
||||
// "go-admin/app/admin/models"
|
||||
// "go-admin/tools"
|
||||
// "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
// "github.com/go-admin-team/go-admin-core/sdk/pkg/response/msg"
|
||||
//)
|
||||
//
|
||||
//func GetSysContentList(c *gin.Context) {
|
||||
// var data models.SysContent
|
||||
// var err error
|
||||
// var pageSize = 10
|
||||
// var pageIndex = 1
|
||||
//
|
||||
// if size := c.Request.FormValue("pageSize"); size != "" {
|
||||
// pageSize, err = tools.StringToInt(size)
|
||||
// }
|
||||
// if index := c.Request.FormValue("pageIndex"); index != "" {
|
||||
// pageIndex, err = tools.StringToInt(index)
|
||||
// }
|
||||
//
|
||||
// data.CateId = c.Request.FormValue("cateId")
|
||||
// data.Name = c.Request.FormValue("name")
|
||||
// data.Status = c.Request.FormValue("status")
|
||||
//
|
||||
// data.DataScope = tools.GetUserIdStr(c)
|
||||
// result, count, err := data.GetPage(pageSize, pageIndex)
|
||||
// tools.HasError(err, "", -1)
|
||||
//
|
||||
// app.PageOK(c, result, count, pageIndex, pageSize, "")
|
||||
//}
|
||||
//
|
||||
//func GetSysContent(c *gin.Context) {
|
||||
// var data models.SysContent
|
||||
// data.Id, _ = tools.StringToInt(c.Param("id"))
|
||||
// result, err := data.Get()
|
||||
// tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
//
|
||||
// app.OK(c, result, "")
|
||||
//}
|
||||
//
|
||||
//// @Summary 添加内容管理
|
||||
//// @Description 获取JSON
|
||||
//// @Tags 内容管理
|
||||
//// @Accept application/json
|
||||
//// @Product application/json
|
||||
//// @Param data body models.SysContent true "data"
|
||||
//// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
//// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
//// @Router /api/v1/syscontent [post]
|
||||
//func InsertSysContent(c *gin.Context) {
|
||||
// var data models.SysContent
|
||||
// err := c.ShouldBindJSON(&data)
|
||||
// data.CreateBy = tools.GetUserIdStr(c)
|
||||
// tools.HasError(err, "", 500)
|
||||
// result, err := data.Create()
|
||||
// tools.HasError(err, "", -1)
|
||||
// app.OK(c, result, "")
|
||||
//}
|
||||
//
|
||||
//func UpdateSysContent(c *gin.Context) {
|
||||
// var data models.SysContent
|
||||
// err := c.BindWith(&data, binding.JSON)
|
||||
// tools.HasError(err, "数据解析失败", -1)
|
||||
// data.UpdateBy = tools.GetUserIdStr(c)
|
||||
// result, err := data.Update(data.Id)
|
||||
// tools.HasError(err, "", -1)
|
||||
//
|
||||
// app.OK(c, result, "")
|
||||
//}
|
||||
//
|
||||
//func DeleteSysContent(c *gin.Context) {
|
||||
// var data models.SysContent
|
||||
// data.UpdateBy = tools.GetUserIdStr(c)
|
||||
//
|
||||
// IDS := tools.IdsStrToIdsIntGroup("id", c)
|
||||
// _, err := data.BatchDelete(IDS)
|
||||
// tools.HasError(err, msg.DeletedFail, 500)
|
||||
// app.OK(c, nil, msg.DeletedSuccess)
|
||||
//}
|
||||
@@ -263,7 +263,7 @@ func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
|
||||
GenerateTime string
|
||||
}{tab, i})
|
||||
|
||||
pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+i+"_migrate.go")
|
||||
pkg.FileCreate(b1, "./cmd/migrate/migration/version-local/"+i+"_migrate.go")
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
log "github.com/go-admin-team/go-admin-core/logger"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/storage"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
@@ -43,7 +43,7 @@ func (e *SysLoginLog) GetId() interface{} {
|
||||
}
|
||||
|
||||
// SaveLoginLog 从队列中获取登录日志
|
||||
func SaveLoginLog(message cache.Message) (err error) {
|
||||
func SaveLoginLog(message storage.Messager) (err error) {
|
||||
//准备db
|
||||
db := sdk.Runtime.GetDbByKey(message.GetPrefix())
|
||||
if db == nil {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
log "github.com/go-admin-team/go-admin-core/logger"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/storage"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
@@ -51,7 +51,7 @@ func (e *SysOperaLog) GetId() interface{} {
|
||||
}
|
||||
|
||||
// SaveOperaLog 从队列中获取操作日志
|
||||
func SaveOperaLog(message cache.Message) (err error) {
|
||||
func SaveOperaLog(message storage.Messager) (err error) {
|
||||
//准备db
|
||||
db := sdk.Runtime.GetDbByKey(message.GetPrefix())
|
||||
if db == nil {
|
||||
|
||||
@@ -103,13 +103,13 @@ func registerSysTableRouter(v1 *gin.RouterGroup) {
|
||||
}
|
||||
|
||||
func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
r.POST("/login", authMiddleware.LoginHandler)
|
||||
// Refresh time can be longer than token timeout
|
||||
r.GET("/refresh_token", authMiddleware.RefreshHandler)
|
||||
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/ws/:id/:channel", ws.WebsocketManager.WsClient)
|
||||
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient)
|
||||
v1 := r.Group("/api/v1")
|
||||
|
||||
v1.POST("/login", authMiddleware.LoginHandler)
|
||||
// Refresh time can be longer than token timeout
|
||||
v1.GET("/refresh_token", authMiddleware.RefreshHandler)
|
||||
//registerPageRouter(v1, authMiddleware)
|
||||
registerBaseRouter(v1, authMiddleware)
|
||||
registerDictRouter(v1, authMiddleware)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
vd "github.com/bytedance/go-tagexpr/v2/validator"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
@@ -11,9 +13,9 @@ import (
|
||||
|
||||
type SysCategorySearch struct {
|
||||
dto.Pagination `search:"-"`
|
||||
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
|
||||
CateId int `form:"cateId" search:"type:exact;column:cate_id;table:sys_category" comment:"分类id"`
|
||||
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称" vd:"?"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态" vd:"?"`
|
||||
CateId int `form:"cateId" search:"type:exact;column:cate_id;table:sys_category" comment:"分类id" vd:"?"`
|
||||
}
|
||||
|
||||
func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
||||
@@ -22,10 +24,16 @@ func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
||||
|
||||
func (m *SysCategorySearch) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Debugf("ShouldBind error: %s", err.Error())
|
||||
}
|
||||
|
||||
if err = vd.Validate(m); err != nil {
|
||||
log.Errorf("Validate error: %s", err.Error())
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -36,23 +44,28 @@ func (m *SysCategorySearch) Generate() dto.Index {
|
||||
|
||||
type SysCategoryControl struct {
|
||||
ID int `uri:"Id" comment:"标识"`
|
||||
Name string `json:"name" comment:"名称"`
|
||||
Img string `json:"img" comment:"图标"`
|
||||
Sort int `json:"sort" comment:"排序"`
|
||||
Status int `json:"status" comment:"状态"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Name string `json:"name" comment:"名称" vd:"len($)>0 && $!=' '; msg:'invalid name: 不能是空字符串'"`
|
||||
Img string `json:"img" comment:"图标" vd:"?"`
|
||||
Sort int `json:"sort" comment:"排序" vd:"?"`
|
||||
Status int `json:"status" comment:"状态" vd:"$>0; msg:'invalid status: 状态无效'"`
|
||||
Remark string `json:"remark" comment:"备注" vd:"?"`
|
||||
}
|
||||
|
||||
func (s *SysCategoryControl) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Debugf("ShouldBindUri error: %s", err.Error())
|
||||
return err
|
||||
log.Errorf("ShouldBindUri error: %s", err.Error())
|
||||
return errors.New("数据绑定出错")
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Debugf("ShouldBind error: %s", err.Error())
|
||||
log.Errorf("ShouldBind error: %s", err.Error())
|
||||
err = errors.New("数据绑定出错")
|
||||
}
|
||||
if err1 := vd.Validate(s); err != nil {
|
||||
log.Errorf("Validate error: %s", err1.Error())
|
||||
return err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -78,7 +91,7 @@ func (s *SysCategoryControl) GetId() interface{} {
|
||||
}
|
||||
|
||||
type SysCategoryById struct {
|
||||
dto.ObjectById
|
||||
dto.ObjectById `vd:"?"`
|
||||
}
|
||||
|
||||
func (s *SysCategoryById) Generate() dto.Control {
|
||||
|
||||
+18
-2
@@ -75,11 +75,27 @@ func setup() {
|
||||
//5. 设置验证码store
|
||||
captcha.SetStore(captcha.NewCacheStore(cacheAdapter, 600))
|
||||
|
||||
//6. 设置队列
|
||||
queueAdapter, err := config.QueueConfig.Setup()
|
||||
if err != nil {
|
||||
log.Fatalf("queue setup error, %s\n", err.Error())
|
||||
}
|
||||
sdk.Runtime.SetQueueAdapter(queueAdapter)
|
||||
|
||||
//7. 设置分布式锁
|
||||
lockerAdapter, err := config.LockerConfig.Setup()
|
||||
if err != nil {
|
||||
log.Fatalf("locker setup error, %s\n", err.Error())
|
||||
}
|
||||
sdk.Runtime.SetLockerAdapter(lockerAdapter)
|
||||
|
||||
usageStr := `starting api server...`
|
||||
log.Println(usageStr)
|
||||
//注册监听函数
|
||||
sdk.Runtime.GetCacheAdapter().Register(global.LoginLog, system.SaveLoginLog)
|
||||
sdk.Runtime.GetCacheAdapter().Register(global.OperateLog, system.SaveOperaLog)
|
||||
queue := sdk.Runtime.GetMemoryQueue("")
|
||||
queue.Register(global.LoginLog, system.SaveLoginLog)
|
||||
queue.Register(global.OperateLog, system.SaveOperaLog)
|
||||
go queue.Run()
|
||||
}
|
||||
|
||||
func run() error {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ControlBy struct {
|
||||
CreateBy int `json:"createBy" gorm:"index;comment:创建者"`
|
||||
UpdateBy int `json:"updateBy" gorm:"index;comment:更新者"`
|
||||
}
|
||||
|
||||
type Model struct {
|
||||
Id int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
|
||||
}
|
||||
|
||||
type ModelTime struct {
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
//sys_casbin_rule
|
||||
type CasbinRule struct {
|
||||
PType string `json:"p_type" gorm:"size:100;"`
|
||||
V0 string `json:"v0" gorm:"size:100;"`
|
||||
V1 string `json:"v1" gorm:"size:100;"`
|
||||
V2 string `json:"v2" gorm:"size:100;"`
|
||||
V3 string `json:"v3" gorm:"size:100;"`
|
||||
V4 string `json:"v4" gorm:"size:100;"`
|
||||
V5 string `json:"v5" gorm:"size:100;"`
|
||||
}
|
||||
|
||||
func (CasbinRule) TableName() string {
|
||||
return "sys_casbin_rule"
|
||||
}
|
||||
+2
-6
@@ -1,8 +1,4 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
)
|
||||
package models
|
||||
|
||||
type DictData struct {
|
||||
DictCode int `gorm:"primaryKey;autoIncrement;" json:"dictCode" example:"1"` //字典编码
|
||||
@@ -18,7 +14,7 @@ type DictData struct {
|
||||
CreateBy string `gorm:"size:64;" json:"createBy"` //
|
||||
UpdateBy string `gorm:"size:64;" json:"updateBy"` //
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
models.BaseModel
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (DictData) TableName() string {
|
||||
+2
-6
@@ -1,8 +1,4 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
)
|
||||
package models
|
||||
|
||||
type DictType struct {
|
||||
DictId int `gorm:"primaryKey;autoIncrement;" json:"dictId"`
|
||||
@@ -12,7 +8,7 @@ type DictType struct {
|
||||
CreateBy string `gorm:"size:11;" json:"createBy"` //创建者
|
||||
UpdateBy string `gorm:"size:11;" json:"updateBy"` //更新者
|
||||
Remark string `gorm:"size:255;" json:"remark"` //备注
|
||||
models.BaseModel
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (DictType) TableName() string {
|
||||
@@ -0,0 +1,55 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go-admin/common/global"
|
||||
"gorm.io/gorm"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func InitDb(db *gorm.DB) (err error) {
|
||||
filePath := "config/db.sql"
|
||||
err = ExecSql(db, filePath)
|
||||
if global.Driver == "postgres" {
|
||||
filePath = "config/pg.sql"
|
||||
err = ExecSql(db, filePath)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func ExecSql(db *gorm.DB, filePath string) error {
|
||||
sql, err := Ioutil(filePath)
|
||||
if err != nil {
|
||||
fmt.Println("数据库基础数据初始化脚本读取失败!原因:", err.Error())
|
||||
return err
|
||||
}
|
||||
sqlList := strings.Split(sql, ";")
|
||||
for i := 0; i < len(sqlList)-1; i++ {
|
||||
if strings.Contains(sqlList[i], "--") {
|
||||
fmt.Println(sqlList[i])
|
||||
continue
|
||||
}
|
||||
sql := strings.Replace(sqlList[i]+";", "\n", "", 0)
|
||||
sql = strings.TrimSpace(sql)
|
||||
if err = db.Exec(sql).Error; err != nil {
|
||||
log.Printf("error sql: %s", sql)
|
||||
if !strings.Contains(err.Error(), "Query was empty") {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Ioutil(filePath string) (string, error) {
|
||||
if contents, err := ioutil.ReadFile(filePath); err == nil {
|
||||
//因为contents是[]byte类型,直接转换成string类型后会多一行空格,需要使用strings.Replace替换换行符
|
||||
result := strings.Replace(string(contents), "\n", "", 1)
|
||||
fmt.Println("Use ioutil.ReadFile to read a file:", result)
|
||||
return result, nil
|
||||
} else {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type BaseModel struct {
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt *time.Time `json:"deletedAt"`
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
@@ -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;"` //
|
||||
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
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
return "sys_role"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package models
|
||||
|
||||
//sys_role_dept
|
||||
type SysRoleDept struct {
|
||||
RoleId int `gorm:"size:11;primaryKey"`
|
||||
DeptId int `gorm:"size:11;primaryKey"`
|
||||
}
|
||||
|
||||
func (SysRoleDept) TableName() string {
|
||||
return "sys_role_dept"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package 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)"`
|
||||
}
|
||||
|
||||
func (RoleMenu) TableName() string {
|
||||
return "sys_role_menu"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
type SysConfig struct {
|
||||
Model
|
||||
ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` //
|
||||
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` //
|
||||
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` //
|
||||
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"`
|
||||
IsFrontend int `json:"isFrontend" gorm:"type:varchar(64);comment:是否前台"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` //
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysConfig) TableName() string {
|
||||
return "sys_config"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
type SysDept struct {
|
||||
DeptId int `json:"deptId" gorm:"primaryKey;autoIncrement;"` //部门编码
|
||||
ParentId int `json:"parentId" gorm:""` //上级部门
|
||||
DeptPath string `json:"deptPath" gorm:"size:255;"` //
|
||||
DeptName string `json:"deptName" gorm:"size:128;"` //部门名称
|
||||
Sort int `json:"sort" gorm:""` //排序
|
||||
Leader string `json:"leader" gorm:"size:128;"` //负责人
|
||||
Phone string `json:"phone" gorm:"size:11;"` //手机
|
||||
Email string `json:"email" gorm:"size:64;"` //邮箱
|
||||
Status string `json:"status" gorm:"size:4;"` //状态
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysDept) TableName() string {
|
||||
return "sys_dept"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
type SysFileDir struct {
|
||||
Model
|
||||
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
||||
PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
||||
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
||||
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
||||
Children []SysFileDir `json:"children,omitempty" gorm:"-"` // 下级信息
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysFileDir) TableName() string { /**/
|
||||
return "sys_file_dir"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package models
|
||||
|
||||
type SysFileInfo struct {
|
||||
Model
|
||||
Type string `json:"type" gorm:"type:varchar(255);comment:类型"` //
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||
Size string `json:"size" gorm:"type:int(11);comment:大小"` //
|
||||
PId int `json:"pId" gorm:"type:int(11);comment:目录"` //
|
||||
Source string `json:"source" gorm:"type:varchar(255);comment:来源"` //
|
||||
Url string `json:"url" gorm:"type:varchar(255);comment:地址"` //
|
||||
FullUrl string `json:"fullUrl" gorm:"type:varchar(255);comment:全地址"` //
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysFileInfo) TableName() string {
|
||||
return "sys_file_info"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysLoginLog struct {
|
||||
Model
|
||||
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"`
|
||||
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"`
|
||||
LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"`
|
||||
Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"`
|
||||
Os string `json:"os" gorm:"type:varchar(255);comment:系统"`
|
||||
Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"`
|
||||
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"`
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
ControlBy
|
||||
}
|
||||
|
||||
func (SysLoginLog) TableName() string {
|
||||
return "sys_login_log"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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;"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysMenu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
Model
|
||||
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"`
|
||||
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"`
|
||||
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"`
|
||||
Method string `json:"method" gorm:"type:varchar(128);comment:函数"`
|
||||
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"`
|
||||
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"`
|
||||
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"`
|
||||
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"`
|
||||
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"`
|
||||
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"`
|
||||
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"`
|
||||
OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"`
|
||||
OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"`
|
||||
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"`
|
||||
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"`
|
||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
func (SysOperaLog) TableName() string {
|
||||
return "sys_opera_log"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
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:密码"`
|
||||
NickName string `json:"nickName" gorm:"type:varchar(128);comment:昵称"`
|
||||
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机号"`
|
||||
RoleId int `json:"roleId" gorm:"type:bigint(20);comment:角色ID"`
|
||||
Salt string `json:"-" gorm:"type:varchar(255);comment:加盐"`
|
||||
Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"`
|
||||
Sex string `json:"sex" gorm:"type:varchar(255);comment:性别"`
|
||||
Email string `json:"email" gorm:"type:varchar(128);comment:邮箱"`
|
||||
DeptId int `json:"deptId" gorm:"type:bigint(20);comment:部门"`
|
||||
PostId int `json:"postId" gorm:"type:bigint(20);comment:岗位"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
PostIds []int `json:"postIds" gorm:"-"`
|
||||
RoleIds []int `json:"roleIds" gorm:"-"`
|
||||
Dept *SysDept `json:"dept"`
|
||||
}
|
||||
|
||||
func (SysUser) TableName() string {
|
||||
return "sys_user"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
type SysCategory struct {
|
||||
Model
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||
Img string `json:"img" gorm:"type:varchar(255);comment:图标"` //
|
||||
Sort int `json:"sort" gorm:"type:int(4);comment:排序"` //
|
||||
Status int `json:"status" gorm:"type:int(1);comment:状态"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysCategory) TableName() string {
|
||||
return "sys_category"
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package models
|
||||
|
||||
type SysColumns struct {
|
||||
ColumnId int `gorm:"primaryKey;autoIncrement" json:"columnId"`
|
||||
TableId int `gorm:"" json:"tableId"`
|
||||
ColumnName string `gorm:"size:128;" json:"columnName"`
|
||||
ColumnComment string `gorm:"column:column_comment;size:128;" json:"columnComment"`
|
||||
ColumnType string `gorm:"column:column_type;size:128;" json:"columnType"`
|
||||
GoType string `gorm:"column:go_type;size:128;" json:"goType"`
|
||||
GoField string `gorm:"column:go_field;size:128;" json:"goField"`
|
||||
JsonField string `gorm:"column:json_field;size:128;" json:"jsonField"`
|
||||
IsPk string `gorm:"column:is_pk;size:4;" json:"isPk"`
|
||||
IsIncrement string `gorm:"column:is_increment;size:4;" json:"isIncrement"`
|
||||
IsRequired string `gorm:"column:is_required;size:4;" json:"isRequired"`
|
||||
IsInsert string `gorm:"column:is_insert;size:4;" json:"isInsert"`
|
||||
IsEdit string `gorm:"column:is_edit;size:4;" json:"isEdit"`
|
||||
IsList string `gorm:"column:is_list;size:4;" json:"isList"`
|
||||
IsQuery string `gorm:"column:is_query;size:4;" json:"isQuery"`
|
||||
QueryType string `gorm:"column:query_type;size:128;" json:"queryType"`
|
||||
HtmlType string `gorm:"column:html_type;size:128;" json:"htmlType"`
|
||||
DictType string `gorm:"column:dict_type;size:128;" json:"dictType"`
|
||||
Sort int `gorm:"column:sort;" json:"sort"`
|
||||
List string `gorm:"column:list;size:1;" json:"list"`
|
||||
Pk bool `gorm:"column:pk;size:1;" json:"pk"`
|
||||
Required bool `gorm:"column:required;size:1;" json:"required"`
|
||||
SuperColumn bool `gorm:"column:super_column;size:1;" json:"superColumn"`
|
||||
UsableColumn bool `gorm:"column:usable_column;size:1;" json:"usableColumn"`
|
||||
Increment bool `gorm:"column:increment;size:1;" json:"increment"`
|
||||
Insert bool `gorm:"column:insert;size:1;" json:"insert"`
|
||||
Edit bool `gorm:"column:edit;size:1;" json:"edit"`
|
||||
Query bool `gorm:"column:query;size:1;" json:"query"`
|
||||
Remark string `gorm:"column:remark;size:255;" json:"remark"`
|
||||
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
|
||||
}
|
||||
|
||||
func (SysColumns) TableName() string {
|
||||
return "sys_columns"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
type SysContent struct {
|
||||
Model
|
||||
CateId int `json:"cateId" gorm:"type:int(11);comment:分类id"`
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"`
|
||||
Status int `json:"status" gorm:"type:int(1);comment:状态"`
|
||||
Img string `json:"img" gorm:"type:varchar(255);comment:图片"`
|
||||
Content string `json:"content" gorm:"type:text;comment:内容"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Sort int `json:"sort" gorm:"type:int(4);comment:排序"`
|
||||
ControlBy
|
||||
ModelTime
|
||||
}
|
||||
|
||||
// TableName
|
||||
func (SysContent) TableName() string {
|
||||
return "sys_content"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
type SysJob struct {
|
||||
JobId int `json:"jobId" gorm:"primaryKey;autoIncrement"` // 编码
|
||||
JobName string `json:"jobName" gorm:"size:255;"` // 名称
|
||||
JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组
|
||||
JobType int `json:"jobType" gorm:"size:1;"` // 任务类型
|
||||
CronExpression string `json:"cronExpression" gorm:"size:255;"` // cron表达式
|
||||
InvokeTarget string `json:"invokeTarget" gorm:"size:255;"` // 调用目标
|
||||
Args string `json:"args" gorm:"size:255;"` // 目标参数
|
||||
MisfirePolicy int `json:"misfirePolicy" gorm:"size:255;"` // 执行策略
|
||||
Concurrent int `json:"concurrent" gorm:"size:1;"` // 是否并发
|
||||
Status int `json:"status" gorm:"size:1;"` // 状态
|
||||
EntryId int `json:"entry_id" gorm:"size:11;"` // job启动时返回的id
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||
BaseModel
|
||||
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
}
|
||||
|
||||
func (SysJob) TableName() string {
|
||||
return "sys_job"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package models
|
||||
|
||||
type SysTables struct {
|
||||
TableId int `gorm:"primaryKey;autoIncrement" json:"tableId"` //表编码
|
||||
TBName string `gorm:"column:table_name;size:255;" json:"tableName"` //表名称
|
||||
TableComment string `gorm:"size:255;" json:"tableComment"` //表备注
|
||||
ClassName string `gorm:"size:255;" json:"className"` //类名
|
||||
TplCategory string `gorm:"size:255;" json:"tplCategory"` //
|
||||
PackageName string `gorm:"size:255;" json:"packageName"` //包名
|
||||
ModuleName string `gorm:"size:255;" json:"moduleName"` //模块名
|
||||
BusinessName string `gorm:"size:255;" json:"businessName"` //
|
||||
FunctionName string `gorm:"size:255;" json:"functionName"` //功能名称
|
||||
FunctionAuthor string `gorm:"size:255;" json:"functionAuthor"` //功能作者
|
||||
PkColumn string `gorm:"size:255;" json:"pkColumn"`
|
||||
PkGoField string `gorm:"size:255;" json:"pkGoField"`
|
||||
PkJsonField string `gorm:"size:255;" json:"pkJsonField"`
|
||||
Options string `gorm:"size:255;" json:"options"`
|
||||
TreeCode string `gorm:"size:255;" json:"treeCode"`
|
||||
TreeParentCode string `gorm:"size:255;" json:"treeParentCode"`
|
||||
TreeName string `gorm:"size:255;" json:"treeName"`
|
||||
Tree bool `gorm:"size:1;" json:"tree"`
|
||||
Crud bool `gorm:"size:1;" json:"crud"`
|
||||
Remark string `gorm:"size:255;" json:"remark"`
|
||||
IsDataScope int `gorm:"size:1;" json:"isDataScope"`
|
||||
IsActions int `gorm:"size:1;" json:"isActions"`
|
||||
IsAuth int `gorm:"size:1;" json:"isAuth"`
|
||||
IsLogicalDelete string `gorm:"size:1;" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"size:1;" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`
|
||||
CreateBy string `gorm:"size:128;" json:"createBy"`
|
||||
UpdateBy string `gorm:"size:128;" json:"updateBy"`
|
||||
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (SysTables) TableName() string {
|
||||
return "sys_tables"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package models
|
||||
|
||||
type SysSetting struct {
|
||||
SettingsId int `json:"settings_id" gorm:"primary_key;AUTO_INCREMENT"`
|
||||
Name string `json:"name" gorm:"type:varchar(256);"`
|
||||
Logo string `json:"logo" gorm:"type:varchar(256);"`
|
||||
ModelTime
|
||||
}
|
||||
|
||||
func (SysSetting) TableName() string {
|
||||
return "sys_setting"
|
||||
}
|
||||
@@ -3,12 +3,10 @@ package version
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/tools"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -19,23 +17,23 @@ func init() {
|
||||
|
||||
func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
err := db.Debug().Migrator().AutoMigrate(
|
||||
new(system.CasbinRule),
|
||||
new(system.SysDept),
|
||||
new(system.SysConfig),
|
||||
new(tools.SysTables),
|
||||
new(tools.SysColumns),
|
||||
new(system.SysMenu),
|
||||
new(system.SysLoginLog),
|
||||
new(system.SysOperaLog),
|
||||
new(models.CasbinRule),
|
||||
new(models.SysDept),
|
||||
new(models.SysConfig),
|
||||
new(models.SysTables),
|
||||
new(models.SysColumns),
|
||||
new(models.SysMenu),
|
||||
new(models.SysLoginLog),
|
||||
new(models.SysOperaLog),
|
||||
new(models.RoleMenu),
|
||||
new(system.SysRoleDept),
|
||||
new(system.SysUser),
|
||||
new(system.SysRole),
|
||||
new(Post),
|
||||
new(DictData),
|
||||
new(DictType),
|
||||
new(models.SysRoleDept),
|
||||
new(models.SysUser),
|
||||
new(models.SysRole),
|
||||
new(models.Post),
|
||||
new(models.DictData),
|
||||
new(models.DictType),
|
||||
new(models.SysJob),
|
||||
new(system.SysConfig),
|
||||
new(models.SysConfig),
|
||||
new(models.SysSetting),
|
||||
new(models.SysFileDir),
|
||||
new(models.SysFileInfo),
|
||||
|
||||
@@ -6,9 +6,8 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,31 +19,31 @@ func init() {
|
||||
func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
list3 := []system.SysDept{
|
||||
{DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.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: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.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: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.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: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.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: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
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 := []system.SysConfig{
|
||||
{Model: common.Model{Id: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.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: common.Model{Id: 2}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"},
|
||||
{Model: common.Model{Id: 3}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"},
|
||||
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 := []Post{
|
||||
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()},
|
||||
}
|
||||
|
||||
list6 := []models.SysRole{
|
||||
{1, "系统管理员", "2", "admin", 1, "", "1", "0", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", []int{}, []int{}},
|
||||
{1, "系统管理员", "2", "admin", 1, "", "1", "0", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list7 := []DictType{
|
||||
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()}},
|
||||
@@ -57,13 +56,13 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
{DictId: 10, DictName: "通知状态", DictType: "sys_notice_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "通知状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list8 := []system.SysUser{
|
||||
list8 := []models.SysUser{
|
||||
{
|
||||
ControlBy: common.ControlBy{
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
ModelTime: common.ModelTime{
|
||||
ModelTime: models.ModelTime{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
},
|
||||
@@ -85,7 +84,7 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
//{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 := []DictData{
|
||||
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()}},
|
||||
@@ -120,7 +119,7 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
}
|
||||
|
||||
list10 := []models.SysSetting{
|
||||
{1, "go-admin管理系统", "https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png", common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{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{
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -19,32 +19,32 @@ func _1599190683680Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
var err error
|
||||
|
||||
list := []models.Menu{
|
||||
{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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", 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", CreateBy: "1", UpdateBy: "1", IsFrame: "0"},
|
||||
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
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ func _1600089797118Migrate(db *gorm.DB, version string) error {
|
||||
PId: 0,
|
||||
Sort: "0",
|
||||
Path: "",
|
||||
ControlBy: common.ControlBy{
|
||||
ControlBy: models.ControlBy{
|
||||
CreateBy: 1,
|
||||
UpdateBy: 1,
|
||||
},
|
||||
|
||||
@@ -5,9 +5,8 @@ import (
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -18,13 +17,13 @@ func init() {
|
||||
|
||||
func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Migrator().HasColumn(&system.SysConfig{}, "config_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id")
|
||||
if tx.Migrator().HasColumn(&models.SysConfig{}, "config_id") {
|
||||
err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
list2 := []system.CasbinRule{
|
||||
list2 := []models.CasbinRule{
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"},
|
||||
}
|
||||
err := tx.Create(list2).Error
|
||||
@@ -32,7 +31,7 @@ func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
menu := models.Menu{MenuId: 86, Path: "/api/v1/config"}
|
||||
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
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ func init() {
|
||||
|
||||
func _1603465014697Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
err := tx.Debug().Model(&models.Menu{}).Where("path = ?", "/api/v1/syscategoryList").Update("path", "/api/v1/syscategory").Error
|
||||
err := tx.Debug().Model(&models.SysMenu{}).Where("path = ?", "/api/v1/syscategoryList").Update("path", "/api/v1/syscategory").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -20,15 +20,15 @@ func _1603516925109Test(db *gorm.DB, version string) error {
|
||||
_ = tx.Migrator().RenameTable("sys_operlog", "sys_opera_log")
|
||||
_ = tx.Migrator().RenameTable("sys_loginlog", "sys_login_log")
|
||||
|
||||
if tx.Migrator().HasColumn(&system.SysLoginLog{}, "info_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysLoginLog{}, "info_id", "id")
|
||||
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(&system.SysOperaLog{}, "oper_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysOperaLog{}, "oper_id", "id")
|
||||
if tx.Migrator().HasColumn(&models.SysOperaLog{}, "oper_id") {
|
||||
err := tx.Migrator().RenameColumn(&models.SysOperaLog{}, "oper_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -19,19 +18,19 @@ func init() {
|
||||
func _1606579402398Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
dicData := DictData{}
|
||||
dicData := models.DictData{}
|
||||
err := tx.Model(&dicData).Where("dict_code = ?", 1).Update("dict_value", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dicType := DictType{}
|
||||
dicType := models.DictType{}
|
||||
err = tx.Model(&dicType).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
user := system.SysUser{}
|
||||
user := models.SysUser{}
|
||||
err = tx.Model(&user).Where("user_id = ?", 1).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -19,13 +18,13 @@ func init() {
|
||||
func _1606582844753Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
dept := system.SysDept{}
|
||||
dept := models.SysDept{}
|
||||
err := tx.Model(&dept).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dictData := DictData{}
|
||||
dictData := models.DictData{}
|
||||
err = tx.Model(&dictData).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,7 +19,7 @@ func _1610427732413Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
user := system.SysUser{}
|
||||
user := models.SysUser{}
|
||||
err := tx.Model(&user).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,13 +19,13 @@ func _1610804233204Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
post := system.SysPost{}
|
||||
post := models.Post{}
|
||||
err := tx.Model(&post).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
role := system.SysRole{}
|
||||
role := models.SysRole{}
|
||||
err = tx.Model(&role).Where("status = ?", 0).Update("status", 2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -22,20 +21,20 @@ func _1613638159444Test(db *gorm.DB, version string) error {
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
// TODO: 例如 修改表字段 使用过程中请删除此段代码
|
||||
err := tx.Migrator().AlterColumn(&system.SysRole{}, "create_by")
|
||||
err := tx.Migrator().AlterColumn(&models.SysRole{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysRole{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&system.SysMenu{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysMenu{}, "create_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,20 +19,20 @@ func _1613697961697Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
//修改字段类型
|
||||
err := tx.Migrator().AlterColumn(&system.SysMenu{}, "create_by")
|
||||
err := tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysMenu{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&system.SysRole{}, "create_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysRole{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysRole{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -18,7 +19,7 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
t := &DictType{
|
||||
t := &models.DictType{
|
||||
DictName: "内容状态",
|
||||
DictType: "sys_content_status",
|
||||
Status: "2",
|
||||
@@ -30,8 +31,8 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
data := make([]DictData, 2)
|
||||
data[0] = DictData{
|
||||
data := make([]models.DictData, 2)
|
||||
data[0] = models.DictData{
|
||||
DictSort: 0,
|
||||
DictLabel: "正常",
|
||||
DictValue: "1",
|
||||
@@ -40,7 +41,7 @@ func _1613720892819Test(db *gorm.DB, version string) error {
|
||||
CreateBy: "1",
|
||||
UpdateBy: "1",
|
||||
}
|
||||
data[1] = DictData{
|
||||
data[1] = models.DictData{
|
||||
DictSort: 1,
|
||||
DictLabel: "禁用",
|
||||
DictValue: "2",
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,36 +19,36 @@ func _1613783303115Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
//修改字段类型
|
||||
err := tx.Model(&system.SysDictType{}).Select("create_by").Not("create_by > 0").Update("create_by", "0").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(&system.SysDictType{}).Select("update_by").Not("update_by > 0").Update("update_by", "0").Error
|
||||
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(&system.SysDictData{}).Select("create_by").Not("create_by > 0").Update("create_by", "0").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(&system.SysDictData{}).Select("update_by").Not("update_by > 0").Update("update_by", "0").Error
|
||||
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(&system.SysDictType{}, "create_by")
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysDictType{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Migrator().AlterColumn(&system.SysDictData{}, "create_by")
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysDictData{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.DictType{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ func _1613978564961Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
menu := models.Menu{MenuId: 110, Path: "/api/v1/config"}
|
||||
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
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -18,81 +18,81 @@ func init() {
|
||||
func _1613998164781Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/deptList").Update("path", "/api/v1/dept").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.Menu{}).Where("path = ?", "/api/v1/roleList").Update("path", "/api/v1/role").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/menuList").Update("path", "/api/v1/menu").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/postList").Update("path", "/api/v1/post").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/dict/typelist").Update("path", "/api/v1/dict/type").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/dict/datalist").Update("path", "/api/v1/dict/data").Error
|
||||
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.Menu{}).Where("path like ?", "/api/v1/dict/data").
|
||||
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.Menu{}).Where("path like ?", "/api/v1/dict/data/:id").
|
||||
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.Menu{}).Where("path like ?", "/api/v1/dict/type").
|
||||
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.Menu{}).Where("path like ?", "/api/v1/dict/type/:id").
|
||||
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.Menu{}).Where("path = ?", "/api/v1/operloglist").Update("path", "/api/v1/sys-opera-log").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/loginloglist").Update("path", "/api/v1/sys-login-log").Error
|
||||
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.Menu{}).Where("path = ?", "/api/v1/loginlog/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error
|
||||
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.Menu{}).Where("path like ?", "/api/v1/operloglist%").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error
|
||||
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.Menu{}).Where("path like ?", "/api/v1/role/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/role").Error
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ func _1614073723691Test(db *gorm.DB, version string) error {
|
||||
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
err := tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/syscontentList").Update("path", "/api/v1/syscontent").Error
|
||||
err := tx.Model(&models.SysMenu{}).Where("path = ?", "/api/v1/syscontentList").Update("path", "/api/v1/syscontent").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
"go-admin/cmd/migrate/migration/models"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -20,28 +18,28 @@ func init() {
|
||||
func _1614604763713Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/dict/typeoptionselect").Update("path", "/api/v1/dict/type-option-select").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.Menu{}).Where("action = ?", "GET").
|
||||
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.Menu{}).Where("action = ?", "DELETE").
|
||||
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(&system.SysUser{}, "create_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysUser{}, "create_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Migrator().AlterColumn(&system.SysUser{}, "update_by")
|
||||
err = tx.Migrator().AlterColumn(&models.SysUser{}, "update_by")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -54,13 +52,13 @@ func _1614604763713Test(db *gorm.DB, version string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Model(&models.Menu{}).Where("action = ?", "PUT").
|
||||
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.Menu{}).Where("action = ?", "DELETE").
|
||||
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
|
||||
|
||||
@@ -2,9 +2,10 @@ package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -18,7 +19,7 @@ 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'") {
|
||||
if err != nil && !strings.Contains(err.Error(), "Duplicate column name 'is_frontend'") {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ func CreateAction(control dto.Control) gin.HandlerFunc {
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
response.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
response.Error(c, http.StatusUnprocessableEntity, err, err.Error())
|
||||
return
|
||||
}
|
||||
var object models.ActiveRecord
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
vd "github.com/bytedance/go-tagexpr/v2/validator"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -36,6 +37,10 @@ func (s *ObjectById) Bind(ctx *gin.Context) error {
|
||||
s.Ids = append(s.Ids, s.Id)
|
||||
}
|
||||
}
|
||||
if err = vd.Validate(s); err != nil {
|
||||
log.Errorf("Validate error: %s", err.Error())
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func IdentityHandler(c *gin.Context) interface{} {
|
||||
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param account body system.Login true "account"
|
||||
// @Param account body Login true "account"
|
||||
// @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }"
|
||||
// @Router /login [post]
|
||||
func Authenticator(c *gin.Context) (interface{}, error) {
|
||||
@@ -125,7 +125,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
|
||||
l["username"] = username
|
||||
l["msg"] = msg
|
||||
|
||||
q := sdk.Runtime.GetCachePrefix(c.Request.Host)
|
||||
q := sdk.Runtime.GetMemoryQueue(c.Request.Host)
|
||||
message, err := sdk.Runtime.GetStreamMessage("", global.LoginLog, l)
|
||||
if err != nil {
|
||||
log.Errorf("GetStreamMessage error, %s", err.Error())
|
||||
@@ -149,27 +149,6 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
|
||||
// @Security Bearer
|
||||
func LogOut(c *gin.Context) {
|
||||
LoginLogToDB(c, "2", "退出成功", user.GetUserName(c))
|
||||
//var loginLog system.SysLoginLog
|
||||
//loginLog.Ipaddr = c.ClientIP()
|
||||
//location := pkg.GetLocation(c.ClientIP())
|
||||
//loginLog.LoginLocation = location
|
||||
//loginLog.LoginTime = pkg.GetCurrentTime()
|
||||
//loginLog.Status = "2"
|
||||
//loginLog.Remark = c.Request.UserAgent()
|
||||
//browserName, browserVersion := ua.Browser()
|
||||
//loginLog.Browser = browserName + " " + browserVersion
|
||||
//loginLog.Os = ua.OS()
|
||||
//loginLog.Platform = ua.Platform()
|
||||
//loginLog.Username = user.GetUserName(c)
|
||||
//loginLog.Msg = "退出成功"
|
||||
//db, err := pkg.GetOrm(c)
|
||||
//if err != nil {
|
||||
// log.Errorf("获取Orm失败, error:%s", err)
|
||||
//}
|
||||
//serviceLoginLog := service.SysLoginLog{}
|
||||
//serviceLoginLog.Orm = db
|
||||
//_ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 200,
|
||||
"msg": "退出成功",
|
||||
|
||||
@@ -24,6 +24,10 @@ func LoggerToFile() gin.HandlerFunc {
|
||||
// 处理请求
|
||||
|
||||
c.Next()
|
||||
if strings.Index(c.Request.RequestURI, "/api/v1/logout") > -1 ||
|
||||
strings.Index(c.Request.RequestURI, "/login") > -1 {
|
||||
return
|
||||
}
|
||||
// 结束时间
|
||||
endTime := time.Now()
|
||||
if c.Request.Method == http.MethodOptions {
|
||||
@@ -118,7 +122,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string
|
||||
} else {
|
||||
l["status"] = "1"
|
||||
}
|
||||
q := sdk.Runtime.GetCachePrefix(c.Request.Host)
|
||||
q := sdk.Runtime.GetMemoryQueue(c.Request.Host)
|
||||
message, err := sdk.Runtime.GetStreamMessage("", global.OperateLog, l)
|
||||
if err != nil {
|
||||
log.Errorf("GetStreamMessage error, %s", err.Error())
|
||||
|
||||
+8
-3
@@ -31,9 +31,14 @@ settings:
|
||||
driver: mysql
|
||||
# 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
registers:
|
||||
- sources:
|
||||
- user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
# databases:
|
||||
# 'locaohost:8000':
|
||||
# driver: mysql
|
||||
# # 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
# source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
# registers:
|
||||
# - sources:
|
||||
# - user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||
gen:
|
||||
# 代码生成读取的数据库名称
|
||||
dbname: dbname
|
||||
|
||||
+19
-19
@@ -1826,7 +1826,7 @@ var doc = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/system.Login"
|
||||
"$ref": "#/definitions/handler.Login"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -2230,24 +2230,7 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"system.Login": {
|
||||
"handler.Login": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
@@ -2270,6 +2253,23 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tools.Params": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
+19
-19
@@ -1809,7 +1809,7 @@
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/system.Login"
|
||||
"$ref": "#/definitions/handler.Login"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -2213,24 +2213,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"system.Login": {
|
||||
"handler.Login": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"code",
|
||||
@@ -2253,6 +2236,23 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tools.Params": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
+13
-13
@@ -254,18 +254,7 @@ definitions:
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
response.Response:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
msg:
|
||||
type: string
|
||||
requestId:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
type: object
|
||||
system.Login:
|
||||
handler.Login:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
@@ -281,6 +270,17 @@ definitions:
|
||||
- username
|
||||
- uuid
|
||||
type: object
|
||||
response.Response:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
msg:
|
||||
type: string
|
||||
requestId:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
type: object
|
||||
tools.Params:
|
||||
properties:
|
||||
treeCode:
|
||||
@@ -1605,7 +1605,7 @@ paths:
|
||||
name: account
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.Login'
|
||||
$ref: '#/definitions/handler.Login'
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token":
|
||||
|
||||
@@ -6,9 +6,11 @@ require (
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
|
||||
github.com/alibaba/sentinel-golang v0.6.1
|
||||
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5
|
||||
github.com/bytedance/go-tagexpr/v2 v2.7.10
|
||||
github.com/casbin/casbin/v2 v2.25.1
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/go-admin-team/go-admin-core v1.3.4
|
||||
github.com/go-admin-team/go-admin-core v1.3.5-rc.0
|
||||
github.com/go-admin-team/go-admin-core/sdk v1.3.5-rc.0
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/mssola/user_agent v0.5.2
|
||||
github.com/opentracing/opentracing-go v1.1.0
|
||||
@@ -22,9 +24,8 @@ require (
|
||||
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
|
||||
golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 // indirect
|
||||
gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6
|
||||
gorm.io/driver/postgres v1.0.6-0.20201208020313-1ed927cfab53
|
||||
gorm.io/driver/sqlite v1.1.5-0.20201206014648-c84401fbe3ba
|
||||
gorm.io/gorm v1.21.3
|
||||
gorm.io/gorm v1.21.6
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"go-admin/cmd"
|
||||
)
|
||||
|
||||
//go:generate swag init --parseDependency
|
||||
//go:generate swag init --parseDependency --parseDepth=6
|
||||
|
||||
// @title go-admin API
|
||||
// @version 1.3.1
|
||||
|
||||
+27
-11
@@ -1,6 +1,8 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
vd "github.com/bytedance/go-tagexpr/v2/validator"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
|
||||
@@ -10,12 +12,12 @@ import (
|
||||
)
|
||||
|
||||
type {{.ClassName}}Search struct {
|
||||
dto.Pagination `search:"-"`
|
||||
dto.Pagination `search:"-" vd:"-"`
|
||||
{{ $tablename := .TBName -}}
|
||||
{{ range .Columns -}}
|
||||
{{$z := .IsQuery}}
|
||||
{{- if ($z) -}}
|
||||
{{.GoField}} {{.GoType}} `form:"{{.JsonField}}" search:"type:{{if eq .QueryType "EQ"}}exact{{ else if eq .QueryType "NE"}}iexact{{ else if eq .QueryType "LIKE"}}contains{{ else if eq .QueryType "GT"}}gt{{ else if eq .QueryType "GTE"}}gte{{ else if eq .QueryType "LT"}}lt{{ else if eq .QueryType "LTE"}}lte{{- end }};column:{{.ColumnName}};table:{{$tablename}}" comment:"{{.ColumnComment}}"`
|
||||
{{.GoField}} {{.GoType}} `form:"{{.JsonField}}" vd:"?" search:"type:{{if eq .QueryType "EQ"}}exact{{ else if eq .QueryType "NE"}}iexact{{ else if eq .QueryType "LIKE"}}contains{{ else if eq .QueryType "GT"}}gt{{ else if eq .QueryType "GTE"}}gte{{ else if eq .QueryType "LT"}}lt{{ else if eq .QueryType "LTE"}}lte{{- end }};column:{{.ColumnName}};table:{{$tablename}}" comment:"{{.ColumnComment}}"`
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
}
|
||||
@@ -33,7 +35,11 @@ func (m *{{.ClassName}}Search) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBind error: %s", err.Error())
|
||||
log.Errorf("ShouldBind error: %s", err.Error())
|
||||
}
|
||||
if err1 := vd.Validate(s); err != nil {
|
||||
log.Errorf("Validate error: %s", err1.Error())
|
||||
return err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -42,14 +48,14 @@ type {{.ClassName}}Control struct {
|
||||
{{ range .Columns -}}
|
||||
{{$x := .Pk}}
|
||||
{{- if ($x) }}
|
||||
{{.GoField}} {{.GoType}} `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}}
|
||||
{{.GoField}} {{.GoType}} `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}" vd:"?"` // {{.ColumnComment}}
|
||||
{{- else if eq .GoField "CreatedAt" -}}
|
||||
{{- else if eq .GoField "UpdatedAt" -}}
|
||||
{{- else if eq .GoField "DeletedAt" -}}
|
||||
{{- else if eq .GoField "CreateBy" -}}
|
||||
{{- else if eq .GoField "UpdateBy" -}}
|
||||
{{- else }}
|
||||
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" comment:"{{.ColumnComment}}"`
|
||||
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" comment:"{{.ColumnComment}}" vd:"?"`
|
||||
{{end -}}
|
||||
{{- end }}
|
||||
}
|
||||
@@ -63,12 +69,17 @@ func (s *{{.ClassName}}Control) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBindUri error: %s", err.Error())
|
||||
return err
|
||||
log.Errorf("ShouldBindUri error: %s", err.Error())
|
||||
return errors.New("数据绑定出错")
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBind error: %s", err.Error())
|
||||
log.Errorf("ShouldBind error: %s", err.Error())
|
||||
err = errors.New("数据绑定出错")
|
||||
}
|
||||
if err1 := vd.Validate(s); err != nil {
|
||||
log.Errorf("Validate error: %s", err1.Error())
|
||||
return err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -111,13 +122,18 @@ func (s *{{.ClassName}}ById) Bind(ctx *gin.Context) error {
|
||||
log := api.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBindUri error: %s", err.Error())
|
||||
return err
|
||||
log.Errorf("ShouldBindUri error: %s", err.Error())
|
||||
return errors.New("数据绑定出错")
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBind error: %s", err.Error())
|
||||
log.Errorf("ShouldBind error: %s", err.Error())
|
||||
err = errors.New("数据绑定出错")
|
||||
}
|
||||
if err1 := vd.Validate(s); err != nil {
|
||||
log.Errorf("Validate error: %s", err1.Error())
|
||||
return err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func init() {
|
||||
routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
// register{{.ClassName}}Router
|
||||
func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
api := &{{.ModuleName}}.{{.ClassName}}{}
|
||||
r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
|
||||
@@ -11,7 +11,7 @@ func init() {
|
||||
routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
// register{{.ClassName}}Router
|
||||
func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
api := &{{.ModuleName}}.{{.ClassName}}{}
|
||||
r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc())
|
||||
|
||||
Reference in New Issue
Block a user