From 7c8c8d703cab88e9a5e90d87bdfeefdb27ccf4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=90=89=E5=85=86?= <303176530@qq.com> Date: Fri, 19 Nov 2021 22:20:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0pgsql=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 231 +++++++++------------ server/core/server_other.go | 4 +- server/core/server_win.go | 4 +- server/model/system/request/sys_init.go | 2 +- server/source/admin.go | 37 ---- server/source/api.go | 113 ---------- server/source/authorities_menus.go | 78 ------- server/source/authority.go | 37 ---- server/source/authority_menu.go | 25 --- server/source/casbin.go | 190 ----------------- server/source/data_authorities.go | 41 ---- server/source/dictionary.go | 42 ---- server/source/dictionary_details.go | 58 ------ server/source/example/file_pgsql.go | 2 +- server/source/file.go | 35 ---- server/source/menu.go | 58 ------ server/source/user_authority.go | 34 --- web/src/view/init/index.vue | 47 ++++- web/src/view/init/init.vue | 106 ---------- web/src/view/systemTools/system/system.vue | 25 +++ 20 files changed, 162 insertions(+), 1007 deletions(-) delete mode 100644 server/source/admin.go delete mode 100644 server/source/api.go delete mode 100644 server/source/authorities_menus.go delete mode 100644 server/source/authority.go delete mode 100644 server/source/authority_menu.go delete mode 100644 server/source/casbin.go delete mode 100644 server/source/data_authorities.go delete mode 100644 server/source/dictionary.go delete mode 100644 server/source/dictionary_details.go delete mode 100644 server/source/file.go delete mode 100644 server/source/menu.go delete mode 100644 server/source/user_authority.go delete mode 100644 web/src/view/init/init.vue diff --git a/server/config.yaml b/server/config.yaml index a258fc10..4a1cd1d0 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -1,98 +1,13 @@ -# github.com/flipped-aurora/gin-vue-admin/server Global Configuration - -# jwt configuration -jwt: - signing-key: 'qmPlus' - expires-time: 604800 - buffer-time: 86400 - issuer: 'qmPlus' -# zap logger configuration -zap: - level: 'info' - format: 'console' - prefix: '[github.com/flipped-aurora/gin-vue-admin/server]' - director: 'log' - show-line: true - encode-level: 'LowercaseColorLevelEncoder' - stacktrace-key: 'stacktrace' - log-in-console: true - -# redis configuration -redis: - db: 0 - addr: '127.0.0.1:6379' - password: '' - -# email configuration -email: - to: 'xxx@qq.com' - port: 465 - from: 'xxx@163.com' - host: 'smtp.163.com' - is-ssl: true - secret: 'xxx' - nickname: 'test' - -# casbin configuration -casbin: - model-path: './resource/rbac_model.conf' - -# system configuration -system: - env: 'public' # Change to "develop" to skip authentication for development mode - addr: 8888 - db-type: 'mysql' - oss-type: 'local' # 控制oss选择走本期还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置 - use-multipoint: false - # IP限制次数 一个小时15000次 - iplimit-count: 15000 - # IP限制一个小时 - iplimit-time: 3600 - -# captcha configuration -captcha: - key-long: 6 - img-width: 240 - img-height: 80 - -# mysql connect configuration -# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://www.github.com/flipped-aurora/gin-vue-admin/server.com/docs/first) -mysql: - path: '' - port: '' - config: '' - db-name: '' - username: '' - password: '' - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false - -# pgsql connect configuration -# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://www.github.com/flipped-aurora/gin-vue-admin/server.com/docs/first) -pgsql: - path: '' - port: '' - config: '' - db-name: '' - username: '' - password: '' - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false - -# local configuration -local: - path: 'uploads/file' - -# autocode configuration +aliyun-oss: + endpoint: yourEndpoint + access-key-id: yourAccessKeyId + access-key-secret: yourAccessKeySecret + bucket-name: yourBucketName + bucket-url: yourBucketUrl + base-path: yourBasePath autocode: transfer-restart: true - # root 自动适配项目根目录 - # 请不要手动配置,他会在项目加载的时候识别出根路径 - root: "" + root: E:\gin-vue-admin server: /server server-api: /api/v1/autocode server-initialize: /initialize @@ -104,52 +19,94 @@ autocode: web-api: /api web-form: /view web-table: /view - -# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址) +captcha: + key-long: 6 + img-width: 240 + img-height: 80 +casbin: + model-path: ./resource/rbac_model.conf +email: + to: xxx@qq.com + port: 465 + from: xxx@163.com + host: smtp.163.com + is-ssl: true + secret: xxx + nickname: test +excel: + dir: ./resource/excel/ +jwt: + buffer-time: 86400 + expires-time: 604800 + issuer: qmPlus + signing-key: 67d683af-8da0-4384-bb67-1fcbdf3a5f6b +local: + path: uploads/file +mysql: + path: "" + port: "" + config: "" + db-name: "" + username: "" + password: "" + max-idle-conns: 10 + max-open-conns: 100 + log-mode: "" + log-zap: false +pgsql: + path: 127.0.0.1 + port: "5432" + config: sslmode=disable TimeZone=Asia/Shanghai + db-name: gva + username: postgres + password: Aa@6447985 + max-idle-conns: 0 + max-open-conns: 0 + log-mode: "" + log-zap: false qiniu: - zone: 'ZoneHuaDong' - bucket: '' - img-path: '' + zone: ZoneHuaDong + bucket: "" + img-path: "" use-https: false - access-key: '' - secret-key: '' + access-key: "" + secret-key: "" use-cdn-domains: false - - -# aliyun oss configuration -aliyun-oss: - endpoint: 'yourEndpoint' - access-key-id: 'yourAccessKeyId' - access-key-secret: 'yourAccessKeySecret' - bucket-name: 'yourBucketName' - bucket-url: 'yourBucketUrl' - base-path: 'yourBasePath' - -# tencent cos configuration +redis: + db: 0 + addr: 127.0.0.1:6379 + password: "" +system: + env: public + addr: 8888 + db-type: pgsql + oss-type: local + use-multipoint: false + iplimit-count: 15000 + iplimit-time: 3600 tencent-cos: - bucket: 'xxxxx-10005608' - region: 'ap-shanghai' - secret-id: 'xxxxxxxx' - secret-key: 'xxxxxxxx' - base-url: 'https://gin.vue.admin' - path-prefix: 'github.com/flipped-aurora/gin-vue-admin/server' - -# excel configuration -excel: - dir: './resource/excel/' - - -# timer task db clear table -Timer: + bucket: xxxxx-10005608 + region: ap-shanghai + secret-id: xxxxxxxx + secret-key: xxxxxxxx + base-url: https://gin.vue.admin + path-prefix: github.com/flipped-aurora/gin-vue-admin/server +timer: start: true - spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3 - detail: [ - # tableName: 需要清理的表名 - # compareField: 需要比较时间的字段 - # interval: 时间间隔, 具体配置详看 time.ParseDuration() 中字符串表示 且不能为负数 - # 2160h = 24 * 30 * 3 -> 三个月 - { tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" }, - { tableName: "jwt_blacklists" , compareField: "created_at", interval: "168h" } - #{ tableName: "log2" , compareField: "created_at", interval: "2160h" } - ] - + spec: '@daily' + detail: + - tableName: sys_operation_records + compareField: created_at + interval: 2160h + - tableName: jwt_blacklists + compareField: created_at + interval: 168h +zap: + level: info + format: console + prefix: '[github.com/flipped-aurora/gin-vue-admin/server]' + director: log + showLine: true + encode-level: LowercaseColorLevelEncoder + stacktrace-key: stacktrace + log-in-console: true diff --git a/server/core/server_other.go b/server/core/server_other.go index ce159fe3..a2786620 100644 --- a/server/core/server_other.go +++ b/server/core/server_other.go @@ -11,8 +11,8 @@ import ( func initServer(address string, router *gin.Engine) server { s := endless.NewServer(address, router) - s.ReadHeaderTimeout = 10 * time.Millisecond - s.WriteTimeout = 10 * time.Second + s.ReadHeaderTimeout = 20 * time.Second + s.WriteTimeout = 20 * time.Second s.MaxHeaderBytes = 1 << 20 return s } diff --git a/server/core/server_win.go b/server/core/server_win.go index 60fb2681..e1c874ec 100644 --- a/server/core/server_win.go +++ b/server/core/server_win.go @@ -13,8 +13,8 @@ func initServer(address string, router *gin.Engine) server { return &http.Server{ Addr: address, Handler: router, - ReadTimeout: 10 * time.Second, - WriteTimeout: 10 * time.Second, + ReadTimeout: 20 * time.Second, + WriteTimeout: 20 * time.Second, MaxHeaderBytes: 1 << 20, } } diff --git a/server/model/system/request/sys_init.go b/server/model/system/request/sys_init.go index da12652d..d93602e6 100644 --- a/server/model/system/request/sys_init.go +++ b/server/model/system/request/sys_init.go @@ -6,7 +6,7 @@ import ( ) type InitDB struct { - DBType string `json:"DBType"` // 数据库类型 + DBType string `json:"dbType"` // 数据库类型 Host string `json:"host"` // 服务器地址 Port string `json:"port"` // 数据库连接端口 UserName string `json:"userName" binding:"required"` // 数据库用户名 diff --git a/server/source/admin.go b/server/source/admin.go deleted file mode 100644 index 713035a1..00000000 --- a/server/source/admin.go +++ /dev/null @@ -1,37 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - uuid "github.com/satori/go.uuid" - "gorm.io/gorm" -) - -var Admin = new(admin) - -type admin struct{} - -var admins = []system.SysUser{ - {GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "admin", Password: "e10adc3949ba59abbe56e057f20f883e", NickName: "超级管理员", HeaderImg: "https:///qmplusimg.henrongyi.top/gva_header.jpg", AuthorityId: "888"}, - {GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "a303176530", Password: "3ec063004a6f31642261936a379fde3d", NickName: "QMPlusUser", HeaderImg: "https:///qmplusimg.henrongyi.top/1572075907logo.png", AuthorityId: "9528"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_users 表数据初始化 -func (a *admin) Init() error { - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 2}).Find(&[]system.SysUser{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_users 表的初始数据已存在!") - return nil - } - if err := tx.Create(&admins).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_users 表初始数据成功!") - return nil - }) -} diff --git a/server/source/api.go b/server/source/api.go deleted file mode 100644 index 51b33cdb..00000000 --- a/server/source/api.go +++ /dev/null @@ -1,113 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - "gorm.io/gorm" -) - -var Api = new(api) - -type api struct{} - -var apis = []system.SysApi{ - {global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/base/login", "用户登录(必选)", "base", "POST"}, - {global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/register", "用户注册(必选)", "user", "POST"}, - {global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/createApi", "创建api", "api", "POST"}, - {global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiList", "获取api列表", "api", "POST"}, - {global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getApiById", "获取api详细信息", "api", "POST"}, - {global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApi", "删除Api", "api", "POST"}, - {global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/updateApi", "更新Api", "api", "POST"}, - {global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/getAllApis", "获取所有api", "api", "POST"}, - {global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/createAuthority", "创建角色", "authority", "POST"}, - {global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/deleteAuthority", "删除角色", "authority", "POST"}, - {global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/getAuthorityList", "获取角色列表", "authority", "POST"}, - {global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenu", "获取菜单树(必选)", "menu", "POST"}, - {global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuList", "分页获取基础menu列表", "menu", "POST"}, - {global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addBaseMenu", "新增菜单", "menu", "POST"}, - {global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuTree", "获取用户动态路由", "menu", "POST"}, - {global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/addMenuAuthority", "增加menu和角色关联关系", "menu", "POST"}, - {global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getMenuAuthority", "获取指定角色menu", "menu", "POST"}, - {global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/deleteBaseMenu", "删除菜单", "menu", "POST"}, - {global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/updateBaseMenu", "更新菜单", "menu", "POST"}, - {global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/menu/getBaseMenuById", "根据id获取菜单", "menu", "POST"}, - {global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/changePassword", "修改密码(建议选择)", "user", "POST"}, - {global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/getUserList", "获取用户列表", "user", "POST"}, - {global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserAuthority", "修改用户角色(必选)", "user", "POST"}, - {global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/upload", "文件上传示例", "fileUploadAndDownload", "POST"}, - {global.GVA_MODEL{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/getFileList", "获取上传文件列表", "fileUploadAndDownload", "POST"}, - {global.GVA_MODEL{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/updateCasbin", "更改角色api权限", "casbin", "POST"}, - {global.GVA_MODEL{ID: 28, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/getPolicyPathByAuthorityId", "获取权限列表", "casbin", "POST"}, - {global.GVA_MODEL{ID: 29, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/fileUploadAndDownload/deleteFile", "删除文件", "fileUploadAndDownload", "POST"}, - {global.GVA_MODEL{ID: 30, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/jwt/jsonInBlacklist", "jwt加入黑名单(退出,必选)", "jwt", "POST"}, - {global.GVA_MODEL{ID: 31, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/setDataAuthority", "设置角色资源权限", "authority", "POST"}, - {global.GVA_MODEL{ID: 32, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/getSystemConfig", "获取配置文件内容", "system", "POST"}, - {global.GVA_MODEL{ID: 33, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/setSystemConfig", "设置配置文件内容", "system", "POST"}, - {global.GVA_MODEL{ID: 34, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "创建客户", "customer", "POST"}, - {global.GVA_MODEL{ID: 35, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "更新客户", "customer", "PUT"}, - {global.GVA_MODEL{ID: 36, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "删除客户", "customer", "DELETE"}, - {global.GVA_MODEL{ID: 37, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customer", "获取单一客户", "customer", "GET"}, - {global.GVA_MODEL{ID: 38, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/customer/customerList", "获取客户列表", "customer", "GET"}, - {global.GVA_MODEL{ID: 39, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/casbin/casbinTest/:pathParam", "RESTFUL模式测试", "casbin", "GET"}, - {global.GVA_MODEL{ID: 40, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/createTemp", "自动化代码", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 41, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/updateAuthority", "更新角色信息", "authority", "PUT"}, - {global.GVA_MODEL{ID: 42, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/authority/copyAuthority", "拷贝角色", "authority", "POST"}, - {global.GVA_MODEL{ID: 43, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/deleteUser", "删除用户", "user", "DELETE"}, - {global.GVA_MODEL{ID: 44, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/createSysDictionaryDetail", "新增字典内容", "sysDictionaryDetail", "POST"}, - {global.GVA_MODEL{ID: 45, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/deleteSysDictionaryDetail", "删除字典内容", "sysDictionaryDetail", "DELETE"}, - {global.GVA_MODEL{ID: 46, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/updateSysDictionaryDetail", "更新字典内容", "sysDictionaryDetail", "PUT"}, - {global.GVA_MODEL{ID: 47, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/findSysDictionaryDetail", "根据ID获取字典内容", "sysDictionaryDetail", "GET"}, - {global.GVA_MODEL{ID: 48, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionaryDetail/getSysDictionaryDetailList", "获取字典内容列表", "sysDictionaryDetail", "GET"}, - {global.GVA_MODEL{ID: 49, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/createSysDictionary", "新增字典", "sysDictionary", "POST"}, - {global.GVA_MODEL{ID: 50, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/deleteSysDictionary", "删除字典", "sysDictionary", "DELETE"}, - {global.GVA_MODEL{ID: 51, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/updateSysDictionary", "更新字典", "sysDictionary", "PUT"}, - {global.GVA_MODEL{ID: 52, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/findSysDictionary", "根据ID获取字典", "sysDictionary", "GET"}, - {global.GVA_MODEL{ID: 53, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysDictionary/getSysDictionaryList", "获取字典列表", "sysDictionary", "GET"}, - {global.GVA_MODEL{ID: 54, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/createSysOperationRecord", "新增操作记录", "sysOperationRecord", "POST"}, - {global.GVA_MODEL{ID: 55, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecord", "删除操作记录", "sysOperationRecord", "DELETE"}, - {global.GVA_MODEL{ID: 56, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/findSysOperationRecord", "根据ID获取操作记录", "sysOperationRecord", "GET"}, - {global.GVA_MODEL{ID: 57, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/getSysOperationRecordList", "获取操作记录列表", "sysOperationRecord", "GET"}, - {global.GVA_MODEL{ID: 58, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getTables", "获取数据库表", "autoCode", "GET"}, - {global.GVA_MODEL{ID: 59, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getDB", "获取所有数据库", "autoCode", "GET"}, - {global.GVA_MODEL{ID: 60, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getColumn", "获取所选table的所有字段", "autoCode", "GET"}, - {global.GVA_MODEL{ID: 61, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/sysOperationRecord/deleteSysOperationRecordByIds", "批量删除操作历史", "sysOperationRecord", "DELETE"}, - {global.GVA_MODEL{ID: 62, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/upload", "插件版分片上传", "simpleUploader", "POST"}, - {global.GVA_MODEL{ID: 63, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/checkFileMd5", "文件完整度验证", "simpleUploader", "GET"}, - {global.GVA_MODEL{ID: 64, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/simpleUploader/mergeFileMd5", "上传完成合并文件", "simpleUploader", "GET"}, - {global.GVA_MODEL{ID: 65, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserInfo", "设置用户信息(必选)", "user", "PUT"}, - {global.GVA_MODEL{ID: 66, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/system/getServerInfo", "获取服务器信息", "system", "POST"}, - {global.GVA_MODEL{ID: 67, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/email/emailTest", "发送测试邮件", "email", "POST"}, - {global.GVA_MODEL{ID: 80, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/preview", "预览自动化代码", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 81, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/importExcel", "导入excel", "excel", "POST"}, - {global.GVA_MODEL{ID: 82, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/loadExcel", "下载excel", "excel", "GET"}, - {global.GVA_MODEL{ID: 83, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/exportExcel", "导出excel", "excel", "POST"}, - {global.GVA_MODEL{ID: 84, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/downloadTemplate", "下载excel模板", "excel", "GET"}, - {global.GVA_MODEL{ID: 85, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApisByIds", "批量删除api", "api", "DELETE"}, - {global.GVA_MODEL{ID: 86, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getSysHistory", "查询回滚记录", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 87, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/rollback", "回滚自动生成代码", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 88, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/getMeta", "获取meta信息", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 89, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/autoCode/delSysHistory", "删除回滚记录", "autoCode", "POST"}, - {global.GVA_MODEL{ID: 90, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/setUserAuthorities", "设置权限组", "user", "POST"}, - {global.GVA_MODEL{ID: 91, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/getUserInfo", "获取自身信息(必选)", "user", "GET"}, - {global.GVA_MODEL{ID: 92, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/user/resetPassword", "重置指定用户密码", "user", "POST"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_apis 表数据初始化 -func (a *api) Init() error { - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 67}).Find(&[]system.SysApi{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_apis 表的初始数据已存在!") - return nil - } - if err := tx.Create(&apis).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_apis 表初始数据成功!") - return nil - }) -} diff --git a/server/source/authorities_menus.go b/server/source/authorities_menus.go deleted file mode 100644 index d89af818..00000000 --- a/server/source/authorities_menus.go +++ /dev/null @@ -1,78 +0,0 @@ -package source - -import ( - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/gookit/color" - "gorm.io/gorm" -) - -var AuthoritiesMenus = new(authoritiesMenus) - -type authoritiesMenus struct{} - -type AuthorityMenus struct { - AuthorityId string `gorm:"column:sys_authority_authority_id"` - BaseMenuId uint `gorm:"column:sys_base_menu_id"` -} - -var authorityMenus = []AuthorityMenus{ - {"888", 1}, - {"888", 2}, - {"888", 3}, - {"888", 4}, - {"888", 5}, - {"888", 6}, - {"888", 7}, - {"888", 8}, - {"888", 9}, - {"888", 10}, - {"888", 11}, - {"888", 12}, - {"888", 13}, - {"888", 14}, - {"888", 15}, - {"888", 16}, - {"888", 17}, - {"888", 18}, - {"888", 19}, - {"888", 20}, - {"888", 22}, - {"888", 23}, - {"888", 24}, - {"888", 25}, - {"8881", 1}, - {"8881", 2}, - {"8881", 8}, - {"9528", 1}, - {"9528", 2}, - {"9528", 3}, - {"9528", 4}, - {"9528", 5}, - {"9528", 6}, - {"9528", 7}, - {"9528", 8}, - {"9528", 9}, - {"9528", 10}, - {"9528", 11}, - {"9528", 12}, - {"9528", 14}, - {"9528", 15}, - {"9528", 16}, - {"9528", 17}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_authority_menus 表数据初始化 -func (a *authoritiesMenus) Init() error { - return global.GVA_DB.Table("sys_authority_menus").Transaction(func(tx *gorm.DB) error { - if tx.Where("sys_authority_authority_id IN ('888', '8881', '9528')").Find(&[]AuthorityMenus{}).RowsAffected == 48 { - color.Danger.Println("\n[Mysql] --> sys_authority_menus 表的初始数据已存在!") - return nil - } - if err := tx.Create(&authorityMenus).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_authority_menus 表初始数据成功!") - return nil - }) -} diff --git a/server/source/authority.go b/server/source/authority.go deleted file mode 100644 index 716c0291..00000000 --- a/server/source/authority.go +++ /dev/null @@ -1,37 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - "gorm.io/gorm" -) - -var Authority = new(authority) - -type authority struct{} - -var authorities = []system.SysAuthority{ - {CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "888", AuthorityName: "普通用户", ParentId: "0", DefaultRouter: "dashboard"}, - {CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "8881", AuthorityName: "普通用户子角色", ParentId: "888", DefaultRouter: "dashboard"}, - {CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "9528", AuthorityName: "测试角色", ParentId: "0", DefaultRouter: "dashboard"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_authorities 表数据初始化 -func (a *authority) Init() error { - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("authority_id IN ? ", []string{"888", "9528"}).Find(&[]system.SysAuthority{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_authorities 表的初始数据已存在!") - return nil - } - if err := tx.Create(&authorities).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_authorities 表初始数据成功!") - return nil - }) -} diff --git a/server/source/authority_menu.go b/server/source/authority_menu.go deleted file mode 100644 index 1579bfd6..00000000 --- a/server/source/authority_menu.go +++ /dev/null @@ -1,25 +0,0 @@ -package source - -import ( - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" -) - -var AuthorityMenu = new(authorityMenu) - -type authorityMenu struct{} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: authority_menu 视图数据初始化 -func (a *authorityMenu) Init() error { - if global.GVA_DB.Migrator().HasTable("authority_menu") && global.GVA_DB.Find(&[]system.SysMenu{}).RowsAffected > 0 { - color.Danger.Println("\n[Mysql] --> authority_menu 视图已存在!") - return nil - } - if err := global.GVA_DB.Exec("CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`, `sys_base_menus`.`updated_at` AS `updated_at`, `sys_base_menus`.`deleted_at` AS `deleted_at`, `sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`, `sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`close_tab` AS `close_tab`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on ((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`)))").Error; err != nil { - return err - } - color.Info.Println("\n[Mysql] --> authority_menu 视图创建成功!") - return nil -} diff --git a/server/source/casbin.go b/server/source/casbin.go deleted file mode 100644 index bdaf1747..00000000 --- a/server/source/casbin.go +++ /dev/null @@ -1,190 +0,0 @@ -package source - -import ( - "github.com/flipped-aurora/gin-vue-admin/server/global" - - gormadapter "github.com/casbin/gorm-adapter/v3" - "github.com/gookit/color" - "gorm.io/gorm" -) - -var Casbin = new(casbin) - -type casbin struct{} - -var carbines = []gormadapter.CasbinRule{ - {PType: "p", V0: "888", V1: "/base/login", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/register", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/createApi", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/getApiList", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/getApiById", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/deleteApi", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/updateApi", V2: "POST"}, - {PType: "p", V0: "888", V1: "/api/getAllApis", V2: "POST"}, - {PType: "p", V0: "888", V1: "/authority/createAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/authority/deleteAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/authority/getAuthorityList", V2: "POST"}, - {PType: "p", V0: "888", V1: "/authority/setDataAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/authority/updateAuthority", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/authority/copyAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/getMenu", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/getMenuList", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/addBaseMenu", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/getBaseMenuTree", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/addMenuAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/getMenuAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/deleteBaseMenu", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/updateBaseMenu", V2: "POST"}, - {PType: "p", V0: "888", V1: "/menu/getBaseMenuById", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/changePassword", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/getUserList", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/setUserAuthority", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/deleteUser", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/fileUploadAndDownload/upload", V2: "POST"}, - {PType: "p", V0: "888", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, - {PType: "p", V0: "888", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, - {PType: "p", V0: "888", V1: "/casbin/updateCasbin", V2: "POST"}, - {PType: "p", V0: "888", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, - {PType: "p", V0: "888", V1: "/casbin/casbinTest/:pathParam", V2: "GET"}, - {PType: "p", V0: "888", V1: "/jwt/jsonInBlacklist", V2: "POST"}, - {PType: "p", V0: "888", V1: "/system/getSystemConfig", V2: "POST"}, - {PType: "p", V0: "888", V1: "/system/setSystemConfig", V2: "POST"}, - {PType: "p", V0: "888", V1: "/system/getServerInfo", V2: "POST"}, - {PType: "p", V0: "888", V1: "/customer/customer", V2: "POST"}, - {PType: "p", V0: "888", V1: "/customer/customer", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/customer/customer", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/customer/customer", V2: "GET"}, - {PType: "p", V0: "888", V1: "/customer/customerList", V2: "GET"}, - {PType: "p", V0: "888", V1: "/autoCode/createTemp", V2: "POST"}, - {PType: "p", V0: "888", V1: "/autoCode/preview", V2: "POST"}, - {PType: "p", V0: "888", V1: "/autoCode/getTables", V2: "GET"}, - {PType: "p", V0: "888", V1: "/autoCode/getDB", V2: "GET"}, - {PType: "p", V0: "888", V1: "/autoCode/getColumn", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysDictionaryDetail/createSysDictionaryDetail", V2: "POST"}, - {PType: "p", V0: "888", V1: "/sysDictionaryDetail/deleteSysDictionaryDetail", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/sysDictionaryDetail/updateSysDictionaryDetail", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/sysDictionaryDetail/findSysDictionaryDetail", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysDictionaryDetail/getSysDictionaryDetailList", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysDictionary/createSysDictionary", V2: "POST"}, - {PType: "p", V0: "888", V1: "/sysDictionary/deleteSysDictionary", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/sysDictionary/updateSysDictionary", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/sysDictionary/findSysDictionary", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysDictionary/getSysDictionaryList", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/createSysOperationRecord", V2: "POST"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecord", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/updateSysOperationRecord", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/findSysOperationRecord", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/getSysOperationRecordList", V2: "GET"}, - {PType: "p", V0: "888", V1: "/sysOperationRecord/deleteSysOperationRecordByIds", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/user/setUserInfo", V2: "PUT"}, - {PType: "p", V0: "888", V1: "/email/emailTest", V2: "POST"}, - {PType: "p", V0: "888", V1: "/simpleUploader/upload", V2: "POST"}, - {PType: "p", V0: "888", V1: "/simpleUploader/checkFileMd5", V2: "GET"}, - {PType: "p", V0: "888", V1: "/simpleUploader/mergeFileMd5", V2: "GET"}, - {PType: "p", V0: "888", V1: "/excel/importExcel", V2: "POST"}, - {PType: "p", V0: "888", V1: "/excel/loadExcel", V2: "GET"}, - {PType: "p", V0: "888", V1: "/excel/exportExcel", V2: "POST"}, - {PType: "p", V0: "888", V1: "/excel/downloadTemplate", V2: "GET"}, - {PType: "p", V0: "888", V1: "/api/deleteApisByIds", V2: "DELETE"}, - {PType: "p", V0: "888", V1: "/autoCode/getSysHistory", V2: "POST"}, - {PType: "p", V0: "888", V1: "/autoCode/rollback", V2: "POST"}, - {PType: "p", V0: "888", V1: "/autoCode/getMeta", V2: "POST"}, - {PType: "p", V0: "888", V1: "/autoCode/delSysHistory", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/setUserAuthorities", V2: "POST"}, - {PType: "p", V0: "888", V1: "/user/getUserInfo", V2: "GET"}, - {PType: "p", V0: "888", V1: "/user/resetPassword", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/base/login", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/user/register", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/createApi", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/getApiList", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/getApiById", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/deleteApi", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/updateApi", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/api/getAllApis", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/authority/createAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/authority/deleteAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/authority/getAuthorityList", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/authority/setDataAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/getMenu", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/getMenuList", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/addBaseMenu", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/getBaseMenuTree", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/addMenuAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/getMenuAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/deleteBaseMenu", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/updateBaseMenu", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/menu/getBaseMenuById", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/user/changePassword", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/user/getUserList", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/user/setUserAuthority", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/fileUploadAndDownload/upload", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/casbin/updateCasbin", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/jwt/jsonInBlacklist", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/system/getSystemConfig", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/system/setSystemConfig", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/customer/customer", V2: "POST"}, - {PType: "p", V0: "8881", V1: "/customer/customer", V2: "PUT"}, - {PType: "p", V0: "8881", V1: "/customer/customer", V2: "DELETE"}, - {PType: "p", V0: "8881", V1: "/customer/customer", V2: "GET"}, - {PType: "p", V0: "8881", V1: "/customer/customerList", V2: "GET"}, - {PType: "p", V0: "8881", V1: "/user/getUserInfo", V2: "GET"}, - {PType: "p", V0: "9528", V1: "/base/login", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/user/register", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/createApi", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/getApiList", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/getApiById", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/deleteApi", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/updateApi", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/api/getAllApis", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/authority/createAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/authority/deleteAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/authority/getAuthorityList", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/authority/setDataAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/getMenu", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/getMenuList", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/addBaseMenu", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/getBaseMenuTree", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/addMenuAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/getMenuAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/deleteBaseMenu", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/updateBaseMenu", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/menu/getBaseMenuById", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/user/changePassword", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/user/getUserList", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/user/setUserAuthority", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/fileUploadAndDownload/upload", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/fileUploadAndDownload/getFileList", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/fileUploadAndDownload/deleteFile", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/casbin/updateCasbin", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/casbin/getPolicyPathByAuthorityId", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/jwt/jsonInBlacklist", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/system/getSystemConfig", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/system/setSystemConfig", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/customer/customer", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/customer/customer", V2: "PUT"}, - {PType: "p", V0: "9528", V1: "/customer/customer", V2: "DELETE"}, - {PType: "p", V0: "9528", V1: "/customer/customer", V2: "GET"}, - {PType: "p", V0: "9528", V1: "/customer/customerList", V2: "GET"}, - {PType: "p", V0: "9528", V1: "/autoCode/createTemp", V2: "POST"}, - {PType: "p", V0: "9528", V1: "/user/getUserInfo", V2: "GET"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: casbin_rule 表数据初始化 -func (c *casbin) Init() error { - global.GVA_DB.AutoMigrate(gormadapter.CasbinRule{}) - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Find(&[]gormadapter.CasbinRule{}).RowsAffected == 154 { - color.Danger.Println("\n[Mysql] --> casbin_rule 表的初始数据已存在!") - return nil - } - if err := tx.Create(&carbines).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> casbin_rule 表初始数据成功!") - return nil - }) -} diff --git a/server/source/data_authorities.go b/server/source/data_authorities.go deleted file mode 100644 index 840dc27e..00000000 --- a/server/source/data_authorities.go +++ /dev/null @@ -1,41 +0,0 @@ -package source - -import ( - "github.com/flipped-aurora/gin-vue-admin/server/global" - - "github.com/gookit/color" - "gorm.io/gorm" -) - -var DataAuthorities = new(dataAuthorities) - -type dataAuthorities struct{} - -type DataAuthority struct { - AuthorityId string `gorm:"column:sys_authority_authority_id"` - DataAuthority string `gorm:"column:data_authority_id_authority_id"` -} - -var infos = []DataAuthority{ - {"888", "888"}, - {"888", "8881"}, - {"888", "9528"}, - {"9528", "8881"}, - {"9528", "9528"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_data_authority_id 表数据初始化 -func (d *dataAuthorities) Init() error { - return global.GVA_DB.Table("sys_data_authority_id").Transaction(func(tx *gorm.DB) error { - if tx.Where("sys_authority_authority_id IN ('888', '9528') ").Find(&[]DataAuthority{}).RowsAffected == 5 { - color.Danger.Println("\n[Mysql] --> sys_data_authority_id 表初始数据已存在!") - return nil - } - if err := tx.Create(&infos).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_data_authority_id 表初始数据成功!") - return nil - }) -} diff --git a/server/source/dictionary.go b/server/source/dictionary.go deleted file mode 100644 index 3dbc1bbf..00000000 --- a/server/source/dictionary.go +++ /dev/null @@ -1,42 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - "gorm.io/gorm" -) - -var Dictionary = new(dictionary) - -type dictionary struct{} - -var status = new(bool) - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_dictionaries 表数据初始化 -func (d *dictionary) Init() error { - *status = true - var dictionaries = []system.SysDictionary{ - {GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"}, - {GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"}, - {GVA_MODEL: global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"}, - {GVA_MODEL: global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库浮点型", Type: "float64", Status: status, Desc: "数据库浮点型"}, - {GVA_MODEL: global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库字符串", Type: "string", Status: status, Desc: "数据库字符串"}, - {GVA_MODEL: global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"}, - } - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 6}).Find(&[]system.SysDictionary{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_dictionaries 表初始数据已存在!") - return nil - } - if err := tx.Create(&dictionaries).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_dictionaries 表初始数据成功!") - return nil - }) -} diff --git a/server/source/dictionary_details.go b/server/source/dictionary_details.go deleted file mode 100644 index 254fbe5e..00000000 --- a/server/source/dictionary_details.go +++ /dev/null @@ -1,58 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - "gorm.io/gorm" -) - -var DictionaryDetail = new(dictionaryDetail) - -type dictionaryDetail struct{} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: dictionary_details 表数据初始化 -func (d *dictionaryDetail) Init() error { - var details = []system.SysDictionaryDetail{ - {global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "smallint", 1, status, 1, 2}, - {global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumint", 2, status, 2, 2}, - {global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "int", 3, status, 3, 2}, - {global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "bigint", 4, status, 4, 2}, - {global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "date", 0, status, 0, 3}, - {global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "time", 1, status, 1, 3}, - {global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "year", 2, status, 2, 3}, - {global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "datetime", 3, status, 3, 3}, - {global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "timestamp", 5, status, 5, 3}, - {global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "float", 0, status, 0, 4}, - {global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "double", 1, status, 1, 4}, - {global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "decimal", 2, status, 2, 4}, - {global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "char", 0, status, 0, 5}, - {global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "varchar", 1, status, 1, 5}, - {global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyblob", 2, status, 2, 5}, - {global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinytext", 3, status, 3, 5}, - {global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "text", 4, status, 4, 5}, - {global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "blob", 5, status, 5, 5}, - {global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumblob", 6, status, 6, 5}, - {global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "mediumtext", 7, status, 7, 5}, - {global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longblob", 8, status, 8, 5}, - {global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longtext", 9, status, 9, 5}, - {global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyint", 0, status, 0, 6}, - {global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "男", 0, status, 0, 1}, - {global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "女", 1, status, 1, 1}, - } - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 23}).Find(&[]system.SysDictionaryDetail{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_dictionary_details 表的初始数据已存在!") - return nil - } - if err := tx.Create(&details).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_dictionary_details 表初始数据成功!") - return nil - }) -} diff --git a/server/source/example/file_pgsql.go b/server/source/example/file_pgsql.go index cfe1b87c..de40be90 100644 --- a/server/source/example/file_pgsql.go +++ b/server/source/example/file_pgsql.go @@ -7,7 +7,7 @@ import ( "gorm.io/gorm" ) -var FilePgsql = new(fileMysql) +var FilePgsql = new(filePgsql) type filePgsql struct{} diff --git a/server/source/file.go b/server/source/file.go deleted file mode 100644 index 964383c6..00000000 --- a/server/source/file.go +++ /dev/null @@ -1,35 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/example" - "github.com/gookit/color" - "gorm.io/gorm" -) - -var File = new(file) - -type file struct{} - -var files = []example.ExaFileUploadAndDownload{ - {global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "https://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"}, - {global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "https://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: exa_file_upload_and_downloads 表初始化数据 -func (f *file) Init() error { - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 2}).Find(&[]example.ExaFileUploadAndDownload{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> exa_file_upload_and_downloads 表初始数据已存在!") - return nil - } - if err := tx.Create(&files).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> exa_file_upload_and_downloads 表初始数据成功!") - return nil - }) -} diff --git a/server/source/menu.go b/server/source/menu.go deleted file mode 100644 index 69010175..00000000 --- a/server/source/menu.go +++ /dev/null @@ -1,58 +0,0 @@ -package source - -import ( - "time" - - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - - "gorm.io/gorm" -) - -var BaseMenu = new(menu) - -type menu struct{} - -var menus = []system.SysBaseMenu{ - {GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "dashboard", Name: "dashboard", Hidden: false, Component: "view/dashboard/index.vue", Sort: 1, Meta: system.Meta{Title: "仪表盘", Icon: "setting"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "about", Name: "about", Component: "view/about/index.vue", Sort: 7, Meta: system.Meta{Title: "关于我们", Icon: "info"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "admin", Name: "superAdmin", Component: "view/superAdmin/index.vue", Sort: 3, Meta: system.Meta{Title: "超级管理员", Icon: "user-solid"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "authority", Name: "authority", Component: "view/superAdmin/authority/authority.vue", Sort: 1, Meta: system.Meta{Title: "角色管理", Icon: "s-custom"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "menu", Name: "menu", Component: "view/superAdmin/menu/menu.vue", Sort: 2, Meta: system.Meta{Title: "菜单管理", Icon: "s-order", KeepAlive: true}}, - {GVA_MODEL: global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "api", Name: "api", Component: "view/superAdmin/api/api.vue", Sort: 3, Meta: system.Meta{Title: "API管理", Icon: "s-platform", KeepAlive: true}}, - {GVA_MODEL: global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "user", Name: "user", Component: "view/superAdmin/user/user.vue", Sort: 4, Meta: system.Meta{Title: "用户管理", Icon: "coordinate"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "0", Path: "person", Name: "person", Component: "view/person/person.vue", Sort: 4, Meta: system.Meta{Title: "个人信息", Icon: "message-solid"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "example", Name: "example", Component: "view/example/index.vue", Sort: 6, Meta: system.Meta{Title: "示例文件", Icon: "s-management"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "excel", Name: "excel", Component: "view/example/excel/excel.vue", Sort: 4, Meta: system.Meta{Title: "excel导入导出", Icon: "s-marketing"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "upload", Name: "upload", Component: "view/example/upload/upload.vue", Sort: 5, Meta: system.Meta{Title: "媒体库(上传下载)", Icon: "upload"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "breakpoint", Name: "breakpoint", Component: "view/example/breakpoint/breakpoint.vue", Sort: 6, Meta: system.Meta{Title: "断点续传", Icon: "upload"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "customer", Name: "customer", Component: "view/example/customer/customer.vue", Sort: 7, Meta: system.Meta{Title: "客户列表(资源示例)", Icon: "s-custom"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "systemTools", Name: "systemTools", Component: "view/systemTools/index.vue", Sort: 5, Meta: system.Meta{Title: "系统工具", Icon: "s-cooperation"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "autoCode", Name: "autoCode", Component: "view/systemTools/autoCode/index.vue", Sort: 1, Meta: system.Meta{Title: "代码生成器", Icon: "cpu", KeepAlive: true}}, - {GVA_MODEL: global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "formCreate", Name: "formCreate", Component: "view/systemTools/formCreate/index.vue", Sort: 2, Meta: system.Meta{Title: "表单生成器", Icon: "magic-stick", KeepAlive: true}}, - {GVA_MODEL: global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "system", Name: "system", Component: "view/systemTools/system/system.vue", Sort: 3, Meta: system.Meta{Title: "系统配置", Icon: "s-operation"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "dictionary", Name: "dictionary", Component: "view/superAdmin/dictionary/sysDictionary.vue", Sort: 5, Meta: system.Meta{Title: "字典管理", Icon: "notebook-2"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: system.Meta{Title: "字典详情", Icon: "s-order"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: system.Meta{Title: "操作历史", Icon: "time"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: system.Meta{Title: "官方网站", Icon: "s-home"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "state", Name: "state", Hidden: false, Component: "view/system/state.vue", Sort: 6, Meta: system.Meta{Title: "服务器状态", Icon: "cloudy"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "14", Path: "autoCodeAdmin", Name: "autoCodeAdmin", Hidden: false, Component: "view/systemTools/autoCodeAdmin/index.vue", Sort: 1, Meta: system.Meta{Title: "自动化代码管理", Icon: "s-finance"}}, - {GVA_MODEL: global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "14", Path: "autoCodeEdit/:id", Name: "autoCodeEdit", Hidden: true, Component: "view/systemTools/autoCode/index.vue", Sort: 0, Meta: system.Meta{Title: "自动化代码(复用)", Icon: "s-finance"}}, -} - -//@author: [SliverHorn](https://github.com/SliverHorn) -//@description: sys_base_menus 表数据初始化 -func (m *menu) Init() error { - return global.GVA_DB.Transaction(func(tx *gorm.DB) error { - if tx.Where("id IN ?", []int{1, 29}).Find(&[]system.SysBaseMenu{}).RowsAffected == 2 { - color.Danger.Println("\n[Mysql] --> sys_base_menus 表的初始数据已存在!") - return nil - } - if err := tx.Create(&menus).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_base_menus 表初始数据成功!") - return nil - }) -} diff --git a/server/source/user_authority.go b/server/source/user_authority.go deleted file mode 100644 index 2bcda6df..00000000 --- a/server/source/user_authority.go +++ /dev/null @@ -1,34 +0,0 @@ -package source - -import ( - "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/flipped-aurora/gin-vue-admin/server/model/system" - "github.com/gookit/color" - "gorm.io/gorm" -) - -var UserAuthority = new(userAuthority) - -type userAuthority struct{} - -var userAuthorityModel = []system.SysUseAuthority{ - {1, "888"}, - {1, "8881"}, - {1, "9528"}, - {2, "888"}, -} - -//@description: user_authority 数据初始化 -func (a *userAuthority) Init() error { - return global.GVA_DB.Model(&system.SysUseAuthority{}).Transaction(func(tx *gorm.DB) error { - if tx.Where("sys_user_id IN (1, 2)").Find(&[]system.SysUseAuthority{}).RowsAffected == 4 { - color.Danger.Println("\n[Mysql] --> sys_user_authority 表的初始数据已存在!") - return nil - } - if err := tx.Create(&userAuthorityModel).Error; err != nil { // 遇到错误时回滚事务 - return err - } - color.Info.Println("\n[Mysql] --> sys_user_authority 表初始数据成功!") - return nil - }) -} diff --git a/web/src/view/init/index.vue b/web/src/view/init/index.vue index 7a9123f5..dce11518 100644 --- a/web/src/view/init/index.vue +++ b/web/src/view/init/index.vue @@ -22,8 +22,9 @@
- - + + + @@ -63,7 +64,7 @@ export default { hello: 0, out: false, form: { - sqlType: 'mysql', + dbType: 'mysql', host: '127.0.0.1', port: '3306', userName: 'root', @@ -72,14 +73,40 @@ export default { } } }, - created() { - // setInterval(() => { - // if (this.hello < 3) { - // this.hello = this.hello + 1 - // } - // }, 2000) - }, methods: { + changeDB(val) { + switch (val) { + case 'mysql': + this.form = { + dbType: 'mysql', + host: '127.0.0.1', + port: '3306', + userName: 'root', + password: '', + dbName: 'gva' + } + break + case 'pgsql': + this.form = { + dbType: 'pgsql', + host: '127.0.0.1', + port: '5432', + userName: 'postgres', + password: '', + dbName: 'gva' + } + break + default: + this.form = { + dbType: 'mysql', + host: '127.0.0.1', + port: '3306', + userName: 'root', + password: '', + dbName: 'gva' + } + } + }, showNext() { this.hello = this.hello + 1 }, diff --git a/web/src/view/init/init.vue b/web/src/view/init/init.vue deleted file mode 100644 index 4b224ceb..00000000 --- a/web/src/view/init/init.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - diff --git a/web/src/view/systemTools/system/system.vue b/web/src/view/systemTools/system/system.vue index 47df0959..e11e482b 100644 --- a/web/src/view/systemTools/system/system.vue +++ b/web/src/view/systemTools/system/system.vue @@ -13,6 +13,7 @@ + @@ -162,6 +163,29 @@ + @@ -321,6 +345,7 @@ export default { jwt: {}, casbin: {}, mysql: {}, + pgsql: {}, excel: {}, autoCode: {}, redis: {},