From cca0845f24e556428cdcabb7d63cd3c489d1b9a2 Mon Sep 17 00:00:00 2001 From: YuleiLan Date: Mon, 13 Jul 2020 20:33:20 +0800 Subject: [PATCH] new --- .github/ISSUE_TEMPLATE/bug_report.md | 38 + .github/workflows/go.yml | 34 + .gitignore | 8 + LICENSE.md | 21 + Makefile | 14 + apis/log/loginLog.go | 133 ++ apis/monitor/server.go | 58 + apis/system/captcha.go | 20 + apis/system/dept.go | 133 ++ apis/system/index.go | 39 + apis/system/info.go | 53 + apis/system/menu.go | 177 ++ apis/system/post.go | 118 + apis/system/role.go | 150 ++ apis/system/rolemenu.go | 72 + apis/system/sysuser.go | 234 ++ apis/tools/dbcolumns.go | 49 + apis/tools/dbtables.go | 54 + apis/tools/gen.go | 51 + apis/tools/systables.go | 223 ++ cmd/api/server.go | 119 + cmd/cobra.go | 42 + cmd/migrate/server.go | 60 + config/READMEN.md | 37 + config/db.sql | 665 ++++++ config/rbac_model.conf | 11 + config/settings.yml | 26 + config/sqlite.sql | 662 ++++++ database/initialize.go | 11 + database/interface.go | 8 + database/mysql.go | 74 + database/sqlite3.go | 15 + docs/docs.go | 3135 ++++++++++++++++++++++++++ docs/swagger.json | 3070 +++++++++++++++++++++++++ docs/swagger.yaml | 1992 ++++++++++++++++ global/logger.go | 14 + global/orm/db.go | 9 + go.mod | 41 + go.sum | 445 ++++ handler/auth.go | 154 ++ handler/httpshandler.go | 22 + handler/nofound.go | 18 + handler/ping.go | 11 + handler/sd/check.go | 165 ++ main.go | 73 + middleware/auth.go | 26 + middleware/customerror.go | 49 + middleware/header.go | 47 + middleware/init.go | 22 + middleware/logger.go | 106 + middleware/permission.go | 38 + middleware/requestid.go | 26 + models/casbinrule.go | 16 + models/datascope.go | 44 + models/dept.go | 256 +++ models/gorm/gorm.go | 29 + models/initdb.go | 47 + models/login.go | 30 + models/loginlog.go | 104 + models/menu.go | 328 +++ models/model.go | 11 + models/post.go | 144 ++ models/role.go | 176 ++ models/roledept.go | 46 + models/rolemenu.go | 147 ++ models/sysuser.go | 317 +++ models/tools/dbcolumns.go | 61 + models/tools/dbtables.go | 53 + models/tools/syscolumns.go | 84 + models/tools/systables.go | 152 ++ pkg/casbin/mycasbin.go | 32 + pkg/cronjob/testjob.go | 19 + pkg/jwtauth/jwtauth.go | 745 ++++++ pkg/logger/logger.go | 13 + router/init_router.go | 32 + router/router.go | 37 + router/sys_router.go | 198 ++ static/go-admin.txt | 15 + template/api.go.template | 76 + template/js.go.template | 46 + template/model.go.template | 125 + template/router.go.template | 33 + template/vue.go.template | 339 +++ test/api.go.template | 126 ++ test/gen_test.go | 47 + test/model.go.template | 104 + tools/app/model.go | 46 + tools/app/msg/message.go | 10 + tools/app/return.go | 44 + tools/captcha/captcha.go | 41 + tools/config/application.go | 49 + tools/config/config.go | 70 + tools/config/database.go | 25 + tools/config/jwt.go | 19 + tools/config/log.go | 17 + tools/config/ssl.go | 17 + tools/env.go | 13 + tools/float64.go | 7 + tools/int.go | 7 + tools/int64.go | 7 + tools/ip.go | 33 + tools/logger.go | 62 + tools/string.go | 68 + tools/url.go | 22 + tools/user.go | 64 + tools/utils.go | 55 + 106 files changed, 17580 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/workflows/go.yml create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 Makefile create mode 100644 apis/log/loginLog.go create mode 100644 apis/monitor/server.go create mode 100644 apis/system/captcha.go create mode 100644 apis/system/dept.go create mode 100644 apis/system/index.go create mode 100644 apis/system/info.go create mode 100644 apis/system/menu.go create mode 100644 apis/system/post.go create mode 100644 apis/system/role.go create mode 100644 apis/system/rolemenu.go create mode 100644 apis/system/sysuser.go create mode 100644 apis/tools/dbcolumns.go create mode 100644 apis/tools/dbtables.go create mode 100644 apis/tools/gen.go create mode 100644 apis/tools/systables.go create mode 100644 cmd/api/server.go create mode 100644 cmd/cobra.go create mode 100644 cmd/migrate/server.go create mode 100644 config/READMEN.md create mode 100644 config/db.sql create mode 100644 config/rbac_model.conf create mode 100644 config/settings.yml create mode 100755 config/sqlite.sql create mode 100644 database/initialize.go create mode 100644 database/interface.go create mode 100644 database/mysql.go create mode 100644 database/sqlite3.go create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml create mode 100644 global/logger.go create mode 100644 global/orm/db.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 handler/auth.go create mode 100644 handler/httpshandler.go create mode 100644 handler/nofound.go create mode 100644 handler/ping.go create mode 100644 handler/sd/check.go create mode 100644 main.go create mode 100644 middleware/auth.go create mode 100644 middleware/customerror.go create mode 100644 middleware/header.go create mode 100644 middleware/init.go create mode 100644 middleware/logger.go create mode 100644 middleware/permission.go create mode 100644 middleware/requestid.go create mode 100644 models/casbinrule.go create mode 100644 models/datascope.go create mode 100644 models/dept.go create mode 100644 models/gorm/gorm.go create mode 100644 models/initdb.go create mode 100644 models/login.go create mode 100644 models/loginlog.go create mode 100644 models/menu.go create mode 100644 models/model.go create mode 100644 models/post.go create mode 100644 models/role.go create mode 100644 models/roledept.go create mode 100644 models/rolemenu.go create mode 100644 models/sysuser.go create mode 100644 models/tools/dbcolumns.go create mode 100644 models/tools/dbtables.go create mode 100644 models/tools/syscolumns.go create mode 100644 models/tools/systables.go create mode 100644 pkg/casbin/mycasbin.go create mode 100644 pkg/cronjob/testjob.go create mode 100644 pkg/jwtauth/jwtauth.go create mode 100644 pkg/logger/logger.go create mode 100644 router/init_router.go create mode 100644 router/router.go create mode 100644 router/sys_router.go create mode 100644 static/go-admin.txt create mode 100644 template/api.go.template create mode 100644 template/js.go.template create mode 100644 template/model.go.template create mode 100644 template/router.go.template create mode 100644 template/vue.go.template create mode 100644 test/api.go.template create mode 100644 test/gen_test.go create mode 100644 test/model.go.template create mode 100644 tools/app/model.go create mode 100644 tools/app/msg/message.go create mode 100644 tools/app/return.go create mode 100644 tools/captcha/captcha.go create mode 100644 tools/config/application.go create mode 100644 tools/config/config.go create mode 100644 tools/config/database.go create mode 100644 tools/config/jwt.go create mode 100644 tools/config/log.go create mode 100644 tools/config/ssl.go create mode 100644 tools/env.go create mode 100644 tools/float64.go create mode 100644 tools/int.go create mode 100644 tools/int64.go create mode 100644 tools/ip.go create mode 100644 tools/logger.go create mode 100644 tools/string.go create mode 100644 tools/url.go create mode 100644 tools/user.go create mode 100644 tools/utils.go diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..91d18ff --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: Build + run: go build -v . diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..584db03 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.idea +static/uploadfile +ferry +temp/ +!temp +vendor +config/settings.dev.yml +tmp/ \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..2e5981c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 wenjianzhang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..27a566e --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +PROJECT:=ferry + +.PHONY: build +build: + CGO_ENABLED=0 go build -o ferry main.go +build-sqlite: + go build -tags sqlite3 -o ferry main.go +#.PHONY: test +#test: +# go test -v ./... -cover + +#.PHONY: docker +#docker: +# docker build . -t ferry:latest diff --git a/apis/log/loginLog.go b/apis/log/loginLog.go new file mode 100644 index 0000000..7c26af6 --- /dev/null +++ b/apis/log/loginLog.go @@ -0,0 +1,133 @@ +package log + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" +) + +// @Summary 登录日志列表 +// @Description 获取JSON +// @Tags 登录日志 +// @Param status query string false "status" +// @Param dictCode query string false "dictCode" +// @Param dictType query string false "dictType" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/loginloglist [get] +// @Security +func GetLoginLogList(c *gin.Context) { + var data models.LoginLog + var err error + var pageSize = 10 + var pageIndex = 1 + + size := c.Request.FormValue("pageSize") + if size != "" { + pageSize = tools.StrToInt(err, size) + } + + index := c.Request.FormValue("pageIndex") + if index != "" { + pageIndex = tools.StrToInt(err, index) + } + + data.Username = c.Request.FormValue("username") + data.Status = c.Request.FormValue("status") + data.Ipaddr = c.Request.FormValue("ipaddr") + result, count, err := data.GetPage(pageSize, pageIndex) + tools.HasError(err, "", -1) + + var mp = make(map[string]interface{}, 3) + mp["list"] = result + mp["count"] = count + mp["pageIndex"] = pageIndex + mp["pageSize"] = pageSize + + var res app.Response + res.Data = mp + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 通过编码获取登录日志 +// @Description 获取JSON +// @Tags 登录日志 +// @Param infoId path int true "infoId" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/loginlog/{infoId} [get] +// @Security +func GetLoginLog(c *gin.Context) { + var LoginLog models.LoginLog + LoginLog.InfoId, _ = tools.StringToInt(c.Param("infoId")) + result, err := LoginLog.Get() + tools.HasError(err, "抱歉未找到相关信息", -1) + + var res app.Response + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 添加登录日志 +// @Description 获取JSON +// @Tags 登录日志 +// @Accept application/json +// @Product application/json +// @Param data body models.LoginLog true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/loginlog [post] +// @Security Bearer +func InsertLoginLog(c *gin.Context) { + var data models.LoginLog + err := c.BindWith(&data, binding.JSON) + tools.HasError(err, "", 500) + result, err := data.Create() + tools.HasError(err, "", -1) + var res app.Response + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 修改登录日志 +// @Description 获取JSON +// @Tags 登录日志 +// @Accept application/json +// @Product application/json +// @Param data body models.LoginLog true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/loginlog [put] +// @Security Bearer +func UpdateLoginLog(c *gin.Context) { + var data models.LoginLog + err := c.BindWith(&data, binding.JSON) + tools.HasError(err, "", -1) + result, err := data.Update(data.InfoId) + tools.HasError(err, "", -1) + var res app.Response + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 批量删除登录日志 +// @Description 删除数据 +// @Tags 登录日志 +// @Param infoId path string true "以逗号(,)分割的infoId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/loginlog/{infoId} [delete] +func DeleteLoginLog(c *gin.Context) { + var data models.LoginLog + data.UpdateBy = tools.GetUserIdStr(c) + IDS := tools.IdsStrToIdsIntGroup("infoId", c) + _, err := data.BatchDelete(IDS) + tools.HasError(err, "修改失败", 500) + var res app.Response + res.Msg = "删除成功" + c.JSON(http.StatusOK, res.ReturnOK()) +} diff --git a/apis/monitor/server.go b/apis/monitor/server.go new file mode 100644 index 0000000..8b752d1 --- /dev/null +++ b/apis/monitor/server.go @@ -0,0 +1,58 @@ +package monitor + +import ( + "ferry/tools/app" + "runtime" + + "github.com/gin-gonic/gin" + "github.com/shirou/gopsutil/cpu" + "github.com/shirou/gopsutil/disk" + "github.com/shirou/gopsutil/mem" +) + +const ( + B = 1 + KB = 1024 * B + MB = 1024 * KB + GB = 1024 * MB +) + +func ServerInfo(c *gin.Context) { + + osDic := make(map[string]interface{}, 0) + osDic["goOs"] = runtime.GOOS + osDic["arch"] = runtime.GOARCH + osDic["mem"] = runtime.MemProfileRate + osDic["compiler"] = runtime.Compiler + osDic["version"] = runtime.Version() + osDic["numGoroutine"] = runtime.NumGoroutine() + + dis, _ := disk.Usage("/") + diskTotalGB := int(dis.Total) / GB + diskFreeGB := int(dis.Free) / GB + diskDic := make(map[string]interface{}, 0) + diskDic["total"] = diskTotalGB + diskDic["free"] = diskFreeGB + + mem, _ := mem.VirtualMemory() + memUsedMB := int(mem.Used) / GB + memTotalMB := int(mem.Total) / GB + memFreeMB := int(mem.Free) / GB + memUsedPercent := int(mem.UsedPercent) + memDic := make(map[string]interface{}, 0) + memDic["total"] = memTotalMB + memDic["used"] = memUsedMB + memDic["free"] = memFreeMB + memDic["usage"] = memUsedPercent + + cpuDic := make(map[string]interface{}, 0) + cpuDic["cpuNum"], _ = cpu.Counts(false) + + app.Custum(c, gin.H{ + "code": 200, + "os": osDic, + "mem": memDic, + "cpu": cpuDic, + "disk": diskDic, + }) +} diff --git a/apis/system/captcha.go b/apis/system/captcha.go new file mode 100644 index 0000000..d1c4d3a --- /dev/null +++ b/apis/system/captcha.go @@ -0,0 +1,20 @@ +package system + +import ( + "ferry/tools" + "ferry/tools/app" + "ferry/tools/captcha" + + "github.com/gin-gonic/gin" +) + +func GenerateCaptchaHandler(c *gin.Context) { + id, b64s, err := captcha.DriverDigitFunc() + tools.HasError(err, "验证码获取失败", 500) + app.Custum(c, gin.H{ + "code": 200, + "data": b64s, + "id": id, + "msg": "success", + }) +} diff --git a/apis/system/dept.go b/apis/system/dept.go new file mode 100644 index 0000000..7a6ae8d --- /dev/null +++ b/apis/system/dept.go @@ -0,0 +1,133 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + "ferry/tools/app/msg" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" +) + +// @Summary 分页部门列表数据 +// @Description 分页列表 +// @Tags 部门 +// @Param name query string false "name" +// @Param id query string false "id" +// @Param position query string false "position" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/deptList [get] +// @Security +func GetDeptList(c *gin.Context) { + var Dept models.Dept + Dept.DeptName = c.Request.FormValue("deptName") + Dept.Status = c.Request.FormValue("status") + Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId")) + Dept.DataScope = tools.GetUserIdStr(c) + result, err := Dept.SetDept(true) + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +func GetDeptTree(c *gin.Context) { + var Dept models.Dept + Dept.DeptName = c.Request.FormValue("deptName") + Dept.Status = c.Request.FormValue("status") + Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId")) + result, err := Dept.SetDept(false) + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +// @Summary 部门列表数据 +// @Description 获取JSON +// @Tags 部门 +// @Param deptId path string false "deptId" +// @Param position query string false "position" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dept/{deptId} [get] +// @Security +func GetDept(c *gin.Context) { + var Dept models.Dept + Dept.DeptId, _ = tools.StringToInt(c.Param("deptId")) + Dept.DataScope = tools.GetUserIdStr(c) + result, err := Dept.Get() + tools.HasError(err, msg.NotFound, 404) + app.OK(c, result, msg.GetSuccess) +} + +// @Summary 添加部门 +// @Description 获取JSON +// @Tags 部门 +// @Accept application/json +// @Product application/json +// @Param data body models.Dept true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dept [post] +// @Security Bearer +func InsertDept(c *gin.Context) { + var data models.Dept + err := c.BindWith(&data, binding.JSON) + tools.HasError(err, "", 500) + data.CreateBy = tools.GetUserIdStr(c) + result, err := data.Create() + tools.HasError(err, "", -1) + app.OK(c, result, msg.CreatedSuccess) +} + +// @Summary 修改部门 +// @Description 获取JSON +// @Tags 部门 +// @Accept application/json +// @Product application/json +// @Param id path int true "id" +// @Param data body models.Dept true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dept [put] +// @Security Bearer +func UpdateDept(c *gin.Context) { + var data models.Dept + err := c.BindJSON(&data) + tools.HasError(err, "", -1) + data.UpdateBy = tools.GetUserIdStr(c) + result, err := data.Update(data.DeptId) + tools.HasError(err, "", -1) + app.OK(c, result, msg.UpdatedSuccess) +} + +// @Summary 删除部门 +// @Description 删除数据 +// @Tags 部门 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/dept/{id} [delete] +func DeleteDept(c *gin.Context) { + var data models.Dept + id, err := tools.StringToInt(c.Param("id")) + _, err = data.Delete(id) + tools.HasError(err, "删除失败", 500) + app.OK(c, "", msg.DeletedSuccess) +} + +func GetDeptTreeRoleselect(c *gin.Context) { + var Dept models.Dept + var SysRole models.SysRole + id, err := tools.StringToInt(c.Param("roleId")) + SysRole.RoleId = id + result, err := Dept.SetDeptLable() + tools.HasError(err, msg.NotFound, -1) + menuIds := make([]int, 0) + if id != 0 { + menuIds, err = SysRole.GetRoleDeptId() + tools.HasError(err, "抱歉未找到相关信息", -1) + } + app.Custum(c, gin.H{ + "code": 200, + "depts": result, + "checkedKeys": menuIds, + }) +} diff --git a/apis/system/index.go b/apis/system/index.go new file mode 100644 index 0000000..78c2bb9 --- /dev/null +++ b/apis/system/index.go @@ -0,0 +1,39 @@ +package system + +import ( + "github.com/gin-gonic/gin" +) + +const INDEX = ` + + + + +ferry欢迎您 + + + + + + + + +` + +func HelloWorld(c *gin.Context) { + c.Header("Content-Type", "text/html; charset=utf-8") + c.String(200, INDEX) +} diff --git a/apis/system/info.go b/apis/system/info.go new file mode 100644 index 0000000..13c1257 --- /dev/null +++ b/apis/system/info.go @@ -0,0 +1,53 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + + "github.com/gin-gonic/gin" +) + +func GetInfo(c *gin.Context) { + + var roles = make([]string, 1) + roles[0] = tools.GetRoleName(c) + + var permissions = make([]string, 1) + permissions[0] = "*:*:*" + + var buttons = make([]string, 1) + buttons[0] = "*:*:*" + + RoleMenu := models.RoleMenu{} + RoleMenu.RoleId = tools.GetRoleId(c) + + var mp = make(map[string]interface{}) + mp["roles"] = roles + if tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员" { + mp["permissions"] = permissions + mp["buttons"] = buttons + } else { + list, _ := RoleMenu.GetPermis() + mp["permissions"] = list + mp["buttons"] = list + } + + sysuser := models.SysUser{} + sysuser.UserId = tools.GetUserId(c) + user, err := sysuser.Get() + tools.HasError(err, "", 500) + + mp["introduction"] = " am a super administrator" + + mp["avatar"] = "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif" + if user.Avatar != "" { + mp["avatar"] = user.Avatar + } + mp["userName"] = user.NickName + mp["userId"] = user.UserId + mp["deptId"] = user.DeptId + mp["name"] = user.NickName + + app.OK(c, mp, "") +} diff --git a/apis/system/menu.go b/apis/system/menu.go new file mode 100644 index 0000000..63c5608 --- /dev/null +++ b/apis/system/menu.go @@ -0,0 +1,177 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" +) + +// @Summary Menu列表数据 +// @Description 获取JSON +// @Tags 菜单 +// @Param menuName query string false "menuName" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menulist [get] +// @Security Bearer +func GetMenuList(c *gin.Context) { + var Menu models.Menu + Menu.MenuName = c.Request.FormValue("menuName") + Menu.Visible = c.Request.FormValue("visible") + Menu.Title = c.Request.FormValue("title") + Menu.DataScope = tools.GetUserIdStr(c) + result, err := Menu.SetMenu() + tools.HasError(err, "抱歉未找到相关信息", -1) + + app.OK(c, result, "") +} + +// @Summary Menu列表数据 +// @Description 获取JSON +// @Tags 菜单 +// @Param menuName query string false "menuName" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menu [get] +// @Security Bearer +func GetMenu(c *gin.Context) { + var data models.Menu + id, err := tools.StringToInt(c.Param("id")) + data.MenuId = id + result, err := data.GetByMenuId() + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +func GetMenuTreeRoleselect(c *gin.Context) { + var Menu models.Menu + var SysRole models.SysRole + id, err := tools.StringToInt(c.Param("roleId")) + SysRole.RoleId = id + result, err := Menu.SetMenuLable() + tools.HasError(err, "抱歉未找到相关信息", -1) + menuIds := make([]int, 0) + if id != 0 { + menuIds, err = SysRole.GetRoleMeunId() + tools.HasError(err, "抱歉未找到相关信息", -1) + } + app.Custum(c, gin.H{ + "code": 200, + "menus": result, + "checkedKeys": menuIds, + }) +} + +// @Summary 获取菜单树 +// @Description 获取JSON +// @Tags 菜单 +// @Accept application/x-www-form-urlencoded +// @Product application/x-www-form-urlencoded +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/menuTreeselect [get] +// @Security Bearer +func GetMenuTreeelect(c *gin.Context) { + var data models.Menu + result, err := data.SetMenuLable() + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +// @Summary 创建菜单 +// @Description 获取JSON +// @Tags 菜单 +// @Accept application/x-www-form-urlencoded +// @Product application/x-www-form-urlencoded +// @Param menuName formData string true "menuName" +// @Param Path formData string false "Path" +// @Param Action formData string true "Action" +// @Param Permission formData string true "Permission" +// @Param ParentId formData string true "ParentId" +// @Param IsDel formData string true "IsDel" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/menu [post] +// @Security Bearer +func InsertMenu(c *gin.Context) { + var data models.Menu + err := c.BindWith(&data, binding.JSON) + tools.HasError(err, "抱歉未找到相关信息", -1) + data.CreateBy = tools.GetUserIdStr(c) + result, err := data.Create() + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +// @Summary 修改菜单 +// @Description 获取JSON +// @Tags 菜单 +// @Accept application/x-www-form-urlencoded +// @Product application/x-www-form-urlencoded +// @Param id path int true "id" +// @Param data body models.Menu true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" +// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" +// @Router /api/v1/menu/{id} [put] +// @Security Bearer +func UpdateMenu(c *gin.Context) { + var data models.Menu + err2 := c.BindWith(&data, binding.JSON) + data.UpdateBy = tools.GetUserIdStr(c) + tools.HasError(err2, "修改失败", -1) + _, err := data.Update(data.MenuId) + tools.HasError(err, "", 501) + app.OK(c, "", "修改成功") + +} + +// @Summary 删除菜单 +// @Description 删除数据 +// @Tags 菜单 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/menu/{id} [delete] +func DeleteMenu(c *gin.Context) { + var data models.Menu + id, err := tools.StringToInt(c.Param("id")) + data.UpdateBy = tools.GetUserIdStr(c) + _, err = data.Delete(id) + tools.HasError(err, "删除失败", 500) + app.OK(c, "", "删除成功") +} + +// @Summary 根据角色名称获取菜单列表数据(左菜单使用) +// @Description 获取JSON +// @Tags 菜单 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menurole [get] +// @Security Bearer +func GetMenuRole(c *gin.Context) { + var Menu models.Menu + result, err := Menu.SetMenuRole(tools.GetRoleName(c)) + tools.HasError(err, "获取失败", 500) + app.OK(c, result, "") +} + +// @Summary 获取角色对应的菜单id数组 +// @Description 获取JSON +// @Tags 菜单 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menuids/{id} [get] +// @Security Bearer +func GetMenuIDS(c *gin.Context) { + var data models.RoleMenu + data.RoleName = c.GetString("role") + data.UpdateBy = tools.GetUserIdStr(c) + result, err := data.GetIDS() + tools.HasError(err, "获取失败", 500) + app.OK(c, result, "") +} diff --git a/apis/system/post.go b/apis/system/post.go new file mode 100644 index 0000000..b15111a --- /dev/null +++ b/apis/system/post.go @@ -0,0 +1,118 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + + "github.com/gin-gonic/gin" +) + +// @Summary 职位列表数据 +// @Description 获取JSON +// @Tags 职位 +// @Param postName query string false "postName" +// @Param postCode query string false "postCode" +// @Param postId query string false "postId" +// @Param status query string false "status" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/post [get] +// @Security +func GetPostList(c *gin.Context) { + var data models.Post + var err error + var pageSize = 10 + var pageIndex = 1 + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = tools.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = tools.StrToInt(err, index) + } + + id := c.Request.FormValue("postId") + data.PostId, _ = tools.StringToInt(id) + + data.PostCode = c.Request.FormValue("postCode") + data.PostName = c.Request.FormValue("postName") + 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, "") +} + +// @Summary 获取字典数据 +// @Description 获取JSON +// @Tags 字典数据 +// @Param postId path int true "postId" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/post/{postId} [get] +// @Security +func GetPost(c *gin.Context) { + var Post models.Post + Post.PostId, _ = tools.StringToInt(c.Param("postId")) + result, err := Post.Get() + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} + +// @Summary 添加职位 +// @Description 获取JSON +// @Tags 职位 +// @Accept application/json +// @Product application/json +// @Param data body models.Post true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/post [post] +// @Security Bearer +func InsertPost(c *gin.Context) { + var data models.Post + err := c.Bind(&data) + data.CreateBy = tools.GetUserIdStr(c) + tools.HasError(err, "", 500) + result, err := data.Create() + tools.HasError(err, "", -1) + app.OK(c, result, "") +} + +// @Summary 修改职位 +// @Description 获取JSON +// @Tags 职位 +// @Accept application/json +// @Product application/json +// @Param data body models.Dept true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/post/ [put] +// @Security Bearer +func UpdatePost(c *gin.Context) { + var data models.Post + + err := c.Bind(&data) + data.UpdateBy = tools.GetUserIdStr(c) + tools.HasError(err, "", -1) + result, err := data.Update(data.PostId) + tools.HasError(err, "", -1) + app.OK(c, result, "修改成功") +} + +// @Summary 删除职位 +// @Description 删除数据 +// @Tags 职位 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/post/{postId} [delete] +func DeletePost(c *gin.Context) { + var data models.Post + data.UpdateBy = tools.GetUserIdStr(c) + IDS := tools.IdsStrToIdsIntGroup("postId", c) + result, err := data.BatchDelete(IDS) + tools.HasError(err, "删除失败", 500) + app.OK(c, result, "删除成功") +} diff --git a/apis/system/role.go b/apis/system/role.go new file mode 100644 index 0000000..5f24d69 --- /dev/null +++ b/apis/system/role.go @@ -0,0 +1,150 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" +) + +// @Summary 角色列表数据 +// @Description Get JSON +// @Tags 角色/Role +// @Param roleName query string false "roleName" +// @Param status query string false "status" +// @Param roleKey query string false "roleKey" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/rolelist [get] +// @Security +func GetRoleList(c *gin.Context) { + var data models.SysRole + var err error + var pageSize = 10 + var pageIndex = 1 + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = tools.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = tools.StrToInt(err, index) + } + + data.RoleKey = c.Request.FormValue("roleKey") + data.RoleName = c.Request.FormValue("roleName") + 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, "") +} + +// @Summary 获取Role数据 +// @Description 获取JSON +// @Tags 角色/Role +// @Param roleId path string false "roleId" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/role [get] +// @Security Bearer +func GetRole(c *gin.Context) { + var Role models.SysRole + Role.RoleId, _ = tools.StringToInt(c.Param("roleId")) + result, err := Role.Get() + menuIds := make([]int, 0) + menuIds, err = Role.GetRoleMeunId() + tools.HasError(err, "抱歉未找到相关信息", -1) + result.MenuIds = menuIds + app.OK(c, result, "") + +} + +// @Summary 创建角色 +// @Description 获取JSON +// @Tags 角色/Role +// @Accept application/json +// @Product application/json +// @Param data body models.SysRole true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/role [post] +func InsertRole(c *gin.Context) { + var data models.SysRole + data.CreateBy = tools.GetUserIdStr(c) + err := c.BindWith(&data, binding.JSON) + tools.HasError(err, "", 500) + id, err := data.Insert() + data.RoleId = id + tools.HasError(err, "", -1) + var t models.RoleMenu + _, err = t.Insert(id, data.MenuIds) + tools.HasError(err, "", -1) + app.OK(c, data, "添加成功") +} + +// @Summary 修改用户角色 +// @Description 获取JSON +// @Tags 角色/Role +// @Accept application/json +// @Product application/json +// @Param data body models.SysRole true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" +// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" +// @Router /api/v1/role [put] +func UpdateRole(c *gin.Context) { + var data models.SysRole + data.UpdateBy = tools.GetUserIdStr(c) + err := c.Bind(&data) + tools.HasError(err, "数据解析失败", -1) + result, err := data.Update(data.RoleId) + tools.HasError(err, "", -1) + var t models.RoleMenu + _, err = t.DeleteRoleMenu(data.RoleId) + tools.HasError(err, "添加失败1", -1) + _, err2 := t.Insert(data.RoleId, data.MenuIds) + tools.HasError(err2, "添加失败2", -1) + + app.OK(c, result, "修改成功") +} + +func UpdateRoleDataScope(c *gin.Context) { + var data models.SysRole + data.UpdateBy = tools.GetUserIdStr(c) + err := c.Bind(&data) + tools.HasError(err, "数据解析失败", -1) + result, err := data.Update(data.RoleId) + + var t models.SysRoleDept + _, err = t.DeleteRoleDept(data.RoleId) + tools.HasError(err, "添加失败1", -1) + if data.DataScope == "2" { + _, err2 := t.Insert(data.RoleId, data.DeptIds) + tools.HasError(err2, "添加失败2", -1) + } + app.OK(c, result, "修改成功") +} + +// @Summary 删除用户角色 +// @Description 删除数据 +// @Tags 角色/Role +// @Param roleId path int true "roleId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/role/{roleId} [delete] +func DeleteRole(c *gin.Context) { + var Role models.SysRole + Role.UpdateBy = tools.GetUserIdStr(c) + + IDS := tools.IdsStrToIdsIntGroup("roleId", c) + _, err := Role.BatchDelete(IDS) + tools.HasError(err, "删除失败1", -1) + var t models.RoleMenu + _, err = t.BatchDeleteRoleMenu(IDS) + tools.HasError(err, "删除失败1", -1) + app.OK(c, "", "删除成功") +} diff --git a/apis/system/rolemenu.go b/apis/system/rolemenu.go new file mode 100644 index 0000000..18f6159 --- /dev/null +++ b/apis/system/rolemenu.go @@ -0,0 +1,72 @@ +package system + +import ( + "ferry/models" + "ferry/tools/app" + "fmt" + "net/http" + + "github.com/gin-gonic/gin" +) + +// @Summary RoleMenu列表数据 +// @Description 获取JSON +// @Tags 角色菜单 +// @Param RoleId query string false "RoleId" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/rolemenu [get] +// @Security Bearer +func GetRoleMenu(c *gin.Context) { + var Rm models.RoleMenu + err := c.ShouldBind(&Rm) + result, err := Rm.Get() + var res app.Response + if err != nil { + res.Msg = "抱歉未找到相关信息" + c.JSON(http.StatusOK, res.ReturnError(200)) + return + } + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) +} + +type RoleMenuPost struct { + RoleId string + RoleMenu []models.RoleMenu +} + +func InsertRoleMenu(c *gin.Context) { + + var res app.Response + res.Msg = "添加成功" + c.JSON(http.StatusOK, res.ReturnOK()) + return + +} + +// @Summary 删除用户菜单数据 +// @Description 删除数据 +// @Tags 角色菜单 +// @Param id path string true "id" +// @Param menu_id query string false "menu_id" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/rolemenu/{id} [delete] +func DeleteRoleMenu(c *gin.Context) { + var t models.RoleMenu + id := c.Param("id") + menuId := c.Request.FormValue("menu_id") + fmt.Println(menuId) + _, err := t.Delete(id, menuId) + if err != nil { + var res app.Response + res.Msg = "删除失败" + c.JSON(http.StatusOK, res.ReturnError(200)) + return + } + var res app.Response + res.Msg = "删除成功" + c.JSON(http.StatusOK, res.ReturnOK()) + return +} diff --git a/apis/system/sysuser.go b/apis/system/sysuser.go new file mode 100644 index 0000000..248bb93 --- /dev/null +++ b/apis/system/sysuser.go @@ -0,0 +1,234 @@ +package system + +import ( + "ferry/models" + "ferry/tools" + "ferry/tools/app" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "github.com/google/uuid" + log "github.com/sirupsen/logrus" +) + +// @Summary 列表数据 +// @Description 获取JSON +// @Tags 用户 +// @Param username query string false "username" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/sysUserList [get] +// @Security Bearer +func GetSysUserList(c *gin.Context) { + var data models.SysUser + var err error + var pageSize = 10 + var pageIndex = 1 + + size := c.Request.FormValue("pageSize") + if size != "" { + pageSize = tools.StrToInt(err, size) + } + + index := c.Request.FormValue("pageIndex") + if index != "" { + pageIndex = tools.StrToInt(err, index) + } + + data.Username = c.Request.FormValue("username") + data.Status = c.Request.FormValue("status") + data.Phone = c.Request.FormValue("phone") + + postId := c.Request.FormValue("postId") + data.PostId, _ = tools.StringToInt(postId) + + deptId := c.Request.FormValue("deptId") + data.DeptId, _ = tools.StringToInt(deptId) + + data.DataScope = tools.GetUserIdStr(c) + result, count, err := data.GetPage(pageSize, pageIndex) + tools.HasError(err, "", -1) + + app.PageOK(c, result, count, pageIndex, pageSize, "") +} + +// @Summary 获取用户 +// @Description 获取JSON +// @Tags 用户 +// @Param userId path int true "用户编码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/sysUser/{userId} [get] +// @Security +func GetSysUser(c *gin.Context) { + var SysUser models.SysUser + SysUser.UserId, _ = tools.StringToInt(c.Param("userId")) + result, err := SysUser.Get() + tools.HasError(err, "抱歉未找到相关信息", -1) + var SysRole models.SysRole + var Post models.Post + roles, err := SysRole.GetList() + posts, err := Post.GetList() + + postIds := make([]int, 0) + postIds = append(postIds, result.PostId) + + roleIds := make([]int, 0) + roleIds = append(roleIds, result.RoleId) + app.Custum(c, gin.H{ + "code": 200, + "data": result, + "postIds": postIds, + "roleIds": roleIds, + "roles": roles, + "posts": posts, + }) +} + +// @Summary 获取当前登录用户 +// @Description 获取JSON +// @Tags 个人中心 +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/user/profile [get] +// @Security +func GetSysUserProfile(c *gin.Context) { + var SysUser models.SysUser + userId := tools.GetUserIdStr(c) + SysUser.UserId, _ = tools.StringToInt(userId) + result, err := SysUser.Get() + tools.HasError(err, "抱歉未找到相关信息", -1) + var SysRole models.SysRole + var Post models.Post + var Dept models.Dept + //获取角色列表 + roles, err := SysRole.GetList() + //获取职位列表 + posts, err := Post.GetList() + //获取部门列表 + Dept.DeptId = result.DeptId + dept, err := Dept.Get() + + postIds := make([]int, 0) + postIds = append(postIds, result.PostId) + + roleIds := make([]int, 0) + roleIds = append(roleIds, result.RoleId) + + app.Custum(c, gin.H{ + "code": 200, + "data": result, + "postIds": postIds, + "roleIds": roleIds, + "roles": roles, + "posts": posts, + "dept": dept, + }) +} + +// @Summary 获取用户角色和职位 +// @Description 获取JSON +// @Tags 用户 +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/sysUser [get] +// @Security +func GetSysUserInit(c *gin.Context) { + var SysRole models.SysRole + var Post models.Post + roles, err := SysRole.GetList() + posts, err := Post.GetList() + tools.HasError(err, "抱歉未找到相关信息", -1) + mp := make(map[string]interface{}, 2) + mp["roles"] = roles + mp["posts"] = posts + app.OK(c, mp, "") +} + +// @Summary 创建用户 +// @Description 获取JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body models.SysUser true "用户数据" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/sysUser [post] +func InsertSysUser(c *gin.Context) { + var sysuser models.SysUser + err := c.BindWith(&sysuser, binding.JSON) + tools.HasError(err, "非法数据格式", 500) + + sysuser.CreateBy = tools.GetUserIdStr(c) + id, err := sysuser.Insert() + tools.HasError(err, "添加失败", 500) + app.OK(c, id, "添加成功") +} + +// @Summary 修改用户数据 +// @Description 获取JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body models.SysUser true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" +// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" +// @Router /api/v1/sysuser/{userId} [put] +func UpdateSysUser(c *gin.Context) { + var data models.SysUser + err := c.Bind(&data) + tools.HasError(err, "数据解析失败", -1) + data.UpdateBy = tools.GetUserIdStr(c) + result, err := data.Update(data.UserId) + tools.HasError(err, "修改失败", 500) + app.OK(c, result, "修改成功") +} + +// @Summary 删除用户数据 +// @Description 删除数据 +// @Tags 用户 +// @Param userId path int true "userId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/sysuser/{userId} [delete] +func DeleteSysUser(c *gin.Context) { + var data models.SysUser + data.UpdateBy = tools.GetUserIdStr(c) + IDS := tools.IdsStrToIdsIntGroup("userId", c) + result, err := data.BatchDelete(IDS) + tools.HasError(err, "删除失败", 500) + app.OK(c, result, "删除成功") +} + +// @Summary 修改头像 +// @Description 获取JSON +// @Tags 用户 +// @Accept multipart/form-data +// @Param file formData file true "file" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/user/profileAvatar [post] +func InsetSysUserAvatar(c *gin.Context) { + form, _ := c.MultipartForm() + files := form.File["upload[]"] + guid := uuid.New().String() + filPath := "static/uploadfile/" + guid + ".jpg" + for _, file := range files { + log.Println(file.Filename) + // 上传文件至指定目录 + _ = c.SaveUploadedFile(file, filPath) + } + sysuser := models.SysUser{} + sysuser.UserId = tools.GetUserId(c) + sysuser.Avatar = "/" + filPath + sysuser.UpdateBy = tools.GetUserIdStr(c) + sysuser.Update(sysuser.UserId) + app.OK(c, filPath, "修改成功") +} + +func SysUserUpdatePwd(c *gin.Context) { + var pwd models.SysUserPwd + err := c.Bind(&pwd) + tools.HasError(err, "数据解析失败", 500) + sysuser := models.SysUser{} + sysuser.UserId = tools.GetUserId(c) + sysuser.SetPwd(pwd) + app.OK(c, "", "密码修改成功") +} diff --git a/apis/tools/dbcolumns.go b/apis/tools/dbcolumns.go new file mode 100644 index 0000000..c360942 --- /dev/null +++ b/apis/tools/dbcolumns.go @@ -0,0 +1,49 @@ +package tools + +import ( + "ferry/models/tools" + tools2 "ferry/tools" + "ferry/tools/app" + "net/http" + + "github.com/gin-gonic/gin" +) + +// @Summary 分页列表数据 / page list data +// @Description 数据库表列分页列表 / database table column page list +// @Tags 工具 / Tools +// @Param tableName query string false "tableName / 数据表名称" +// @Param pageSize query int false "pageSize / 页条数" +// @Param pageIndex query int false "pageIndex / 页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/db/columns/page [get] +func GetDBColumnList(c *gin.Context) { + var data tools.DBColumns + var err error + var pageSize = 10 + var pageIndex = 1 + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = tools2.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = tools2.StrToInt(err, index) + } + + data.TableName = c.Request.FormValue("tableName") + tools2.Assert(data.TableName == "", "table name cannot be empty!", 500) + result, count, err := data.GetPage(pageSize, pageIndex) + tools2.HasError(err, "", -1) + + var mp = make(map[string]interface{}, 3) + mp["list"] = result + mp["count"] = count + mp["pageIndex"] = pageIndex + mp["pageSize"] = pageSize + + var res app.Response + res.Data = mp + + c.JSON(http.StatusOK, res.ReturnOK()) +} diff --git a/apis/tools/dbtables.go b/apis/tools/dbtables.go new file mode 100644 index 0000000..a5bb5b0 --- /dev/null +++ b/apis/tools/dbtables.go @@ -0,0 +1,54 @@ +package tools + +import ( + "ferry/models/tools" + tools2 "ferry/tools" + "ferry/tools/app" + config2 "ferry/tools/config" + "net/http" + + "github.com/gin-gonic/gin" +) + +// @Summary 分页列表数据 / page list data +// @Description 数据库表分页列表 / database table page list +// @Tags 工具 / Tools +// @Param tableName query string false "tableName / 数据表名称" +// @Param pageSize query int false "pageSize / 页条数" +// @Param pageIndex query int false "pageIndex / 页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/db/tables/page [get] +func GetDBTableList(c *gin.Context) { + var res app.Response + var data tools.DBTables + var err error + var pageSize = 10 + var pageIndex = 1 + if config2.DatabaseConfig.Dbtype == "sqlite3" { + res.Msg = "对不起,sqlite3 暂不支持代码生成!" + c.JSON(http.StatusOK, res.ReturnError(500)) + return + } + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = tools2.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = tools2.StrToInt(err, index) + } + + data.TableName = c.Request.FormValue("tableName") + result, count, err := data.GetPage(pageSize, pageIndex) + tools2.HasError(err, "", -1) + + var mp = make(map[string]interface{}, 3) + mp["list"] = result + mp["count"] = count + mp["pageIndex"] = pageIndex + mp["pageSize"] = pageSize + + res.Data = mp + + c.JSON(http.StatusOK, res.ReturnOK()) +} diff --git a/apis/tools/gen.go b/apis/tools/gen.go new file mode 100644 index 0000000..ff97d6f --- /dev/null +++ b/apis/tools/gen.go @@ -0,0 +1,51 @@ +package tools + +import ( + "bytes" + "ferry/models/tools" + tools2 "ferry/tools" + "ferry/tools/app" + "net/http" + "text/template" + + "github.com/gin-gonic/gin" +) + +func Preview(c *gin.Context) { + table := tools.SysTables{} + id, err := tools2.StringToInt(c.Param("tableId")) + tools2.HasError(err, "", -1) + table.TableId = id + t1, err := template.ParseFiles("template/model.go.template") + tools2.HasError(err, "", -1) + t2, err := template.ParseFiles("template/api.go.template") + tools2.HasError(err, "", -1) + t3, err := template.ParseFiles("template/js.go.template") + tools2.HasError(err, "", -1) + t4, err := template.ParseFiles("template/vue.go.template") + tools2.HasError(err, "", -1) + t5, err := template.ParseFiles("template/router.go.template") + tools2.HasError(err, "", -1) + tab, _ := table.Get() + var b1 bytes.Buffer + err = t1.Execute(&b1, tab) + var b2 bytes.Buffer + err = t2.Execute(&b2, tab) + var b3 bytes.Buffer + err = t3.Execute(&b3, tab) + var b4 bytes.Buffer + err = t4.Execute(&b4, tab) + var b5 bytes.Buffer + err = t5.Execute(&b5, tab) + + mp := make(map[string]interface{}) + mp["template/model.go.template"] = b1.String() + mp["template/api.go.template"] = b2.String() + mp["template/js.go.template"] = b3.String() + mp["template/vue.go.template"] = b4.String() + mp["template/router.go.template"] = b5.String() + var res app.Response + res.Data = mp + + c.JSON(http.StatusOK, res.ReturnOK()) +} diff --git a/apis/tools/systables.go b/apis/tools/systables.go new file mode 100644 index 0000000..c100698 --- /dev/null +++ b/apis/tools/systables.go @@ -0,0 +1,223 @@ +package tools + +import ( + "ferry/models/tools" + tools2 "ferry/tools" + "ferry/tools/app" + "net/http" + "strings" + + "github.com/gin-gonic/gin" +) + +// @Summary 分页列表数据 +// @Description 生成表分页列表 +// @Tags 工具 - 生成表 +// @Param tableName query string false "tableName / 数据表名称" +// @Param pageSize query int false "pageSize / 页条数" +// @Param pageIndex query int false "pageIndex / 页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/sys/tables/page [get] +func GetSysTableList(c *gin.Context) { + var data tools.SysTables + var err error + var pageSize = 10 + var pageIndex = 1 + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = tools2.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = tools2.StrToInt(err, index) + } + + data.TBName = c.Request.FormValue("tableName") + data.TableComment = c.Request.FormValue("tableComment") + result, count, err := data.GetPage(pageSize, pageIndex) + tools2.HasError(err, "", -1) + + var mp = make(map[string]interface{}, 3) + mp["list"] = result + mp["count"] = count + mp["pageIndex"] = pageIndex + mp["pageSize"] = pageSize + + var res app.Response + res.Data = mp + + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 获取配置 +// @Description 获取JSON +// @Tags 工具 - 生成表 +// @Param configKey path int true "configKey" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/sys/tables/info/{tableId} [get] +// @Security +func GetSysTables(c *gin.Context) { + var data tools.SysTables + data.TableId, _ = tools2.StringToInt(c.Param("tableId")) + result, err := data.Get() + tools2.HasError(err, "抱歉未找到相关信息", -1) + + var res app.Response + res.Data = result + mp := make(map[string]interface{}) + mp["rows"] = result.Columns + mp["info"] = result + res.Data = mp + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 添加表结构 +// @Description 添加表结构 +// @Tags 工具 - 生成表 +// @Accept application/json +// @Product application/json +// @Param tables query string false "tableName / 数据表名称" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/sys/tables/info [post] +// @Security Bearer +func InsertSysTable(c *gin.Context) { + + tablesList := strings.Split(c.Request.FormValue("tables"), ",") + for i := 0; i < len(tablesList); i++ { + + data, err := genTableInit(tablesList, i, c) + + _, err = data.Create() + tools2.HasError(err, "", -1) + } + var res app.Response + res.Msg = "添加成功!" + c.JSON(http.StatusOK, res.ReturnOK()) + +} + +func genTableInit(tablesList []string, i int, c *gin.Context) (tools.SysTables, error) { + var data tools.SysTables + var dbTable tools.DBTables + var dbColumn tools.DBColumns + data.TBName = tablesList[i] + data.CreateBy = tools2.GetUserIdStr(c) + + dbTable.TableName = data.TBName + dbtable, err := dbTable.Get() + + dbColumn.TableName = data.TBName + tablenamelist := strings.Split(dbColumn.TableName, "_") + for i := 0; i < len(tablenamelist); i++ { + strStart := string([]byte(tablenamelist[i])[:1]) + strend := string([]byte(tablenamelist[i])[1:]) + data.ClassName += strings.ToUpper(strStart) + strend + data.PackageName += strings.ToLower(strStart) + strings.ToLower(strend) + data.ModuleName += strings.ToLower(strStart) + strings.ToLower(strend) + } + data.TplCategory = "crud" + data.Crud = true + + dbcolumn, err := dbColumn.GetList() + data.CreateBy = tools2.GetUserIdStr(c) + data.TableComment = dbtable.TableComment + if dbtable.TableComment == "" { + data.TableComment = data.ClassName + } + + data.FunctionName = data.TableComment + data.BusinessName = data.ModuleName + data.IsLogicalDelete = "1" + data.LogicalDelete = true + data.LogicalDeleteColumn = "is_del" + + data.FunctionAuthor = "wenjianzhang" + for i := 0; i < len(dbcolumn); i++ { + var column tools.SysColumns + column.ColumnComment = dbcolumn[i].ColumnComment + column.ColumnName = dbcolumn[i].ColumnName + column.ColumnType = dbcolumn[i].ColumnType + column.Sort = i + 1 + column.Insert = true + column.IsInsert = "1" + column.QueryType = "EQ" + column.IsPk = "0" + + namelist := strings.Split(dbcolumn[i].ColumnName, "_") + for i := 0; i < len(namelist); i++ { + strStart := string([]byte(namelist[i])[:1]) + strend := string([]byte(namelist[i])[1:]) + column.GoField += strings.ToUpper(strStart) + strend + if i == 0 { + column.JsonField = strings.ToLower(strStart) + strend + } else { + column.JsonField += strings.ToUpper(strStart) + strend + } + } + if strings.Contains(dbcolumn[i].ColumnKey, "PR") { + column.IsPk = "1" + column.Pk = true + data.PkColumn = dbcolumn[i].ColumnName + data.PkGoField = column.GoField + data.PkJsonField = column.JsonField + } + column.IsRequired = "0" + if strings.Contains(dbcolumn[i].IsNullable, "NO") { + column.IsRequired = "1" + column.Required = true + } + + if strings.Contains(dbcolumn[i].ColumnType, "int") { + column.GoType = "int" + column.HtmlType = "input" + } else { + column.GoType = "string" + column.HtmlType = "input" + } + + data.Columns = append(data.Columns, column) + } + return data, err +} + +// @Summary 修改表结构 +// @Description 修改表结构 +// @Tags 工具 - 生成表 +// @Accept application/json +// @Product application/json +// @Param data body models.Dept true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/sys/tables/info [put] +// @Security Bearer +func UpdateSysTable(c *gin.Context) { + var data tools.SysTables + err := c.Bind(&data) + tools2.HasError(err, "数据解析失败", -1) + data.UpdateBy = tools2.GetUserIdStr(c) + result, err := data.Update() + tools2.HasError(err, "", -1) + + var res app.Response + res.Data = result + res.Msg = "修改成功" + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 删除表结构 +// @Description 删除表结构 +// @Tags 工具 - 生成表 +// @Param tableId path int true "tableId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/sys/tables/info/{tableId} [delete] +func DeleteSysTables(c *gin.Context) { + var data tools.SysTables + IDS := tools2.IdsStrToIdsIntGroup("tableId", c) + _, err := data.BatchDelete(IDS) + tools2.HasError(err, "删除失败", 500) + var res app.Response + res.Msg = "删除成功" + c.JSON(http.StatusOK, res.ReturnOK()) +} diff --git a/cmd/api/server.go b/cmd/api/server.go new file mode 100644 index 0000000..17c28fa --- /dev/null +++ b/cmd/api/server.go @@ -0,0 +1,119 @@ +package api + +import ( + "context" + "ferry/database" + "ferry/global/orm" + "ferry/router" + "ferry/tools" + config2 "ferry/tools/config" + "fmt" + "io/ioutil" + "net/http" + "os" + "os/signal" + "time" + + "github.com/gin-gonic/gin" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var ( + config string + port string + mode string + StartCmd = &cobra.Command{ + Use: "server", + Short: "Start API server", + Example: "ferry server config/settings.yml", + PreRun: func(cmd *cobra.Command, args []string) { + usage() + setup() + }, + RunE: func(cmd *cobra.Command, args []string) error { + return run() + }, + } +) + +func init() { + StartCmd.PersistentFlags().StringVarP(&config, "config", "c", "config/settings.yml", "Start server with provided configuration file") + StartCmd.PersistentFlags().StringVarP(&port, "port", "p", "8000", "Tcp port server listening on") + StartCmd.PersistentFlags().StringVarP(&mode, "mode", "m", "dev", "server mode ; eg:dev,test,prod") +} + +func usage() { + usageStr := `starting api server` + log.Printf("%s\n", usageStr) +} + +func setup() { + + //1. 读取配置 + config2.ConfigSetup(config) + //2. 设置日志 + tools.InitLogger() + //3. 初始化数据库链接 + database.Setup() + +} + +func run() error { + if mode != "" { + config2.SetConfig(config, "settings.application.mode", mode) + } + if viper.GetString("settings.application.mode") == string(tools.ModeProd) { + gin.SetMode(gin.ReleaseMode) + } + + r := router.InitRouter() + + defer func() { + err := orm.Eloquent.Close() + if err != nil { + log.Error(err) + } + }() + + if port != "" { + config2.SetConfig(config, "settings.application.port", port) + } + + srv := &http.Server{ + Addr: config2.ApplicationConfig.Host + ":" + config2.ApplicationConfig.Port, + Handler: r, + } + + go func() { + // 服务连接 + if config2.ApplicationConfig.IsHttps { + if err := srv.ListenAndServeTLS(config2.SslConfig.Pem, config2.SslConfig.KeyStr); err != nil && err != http.ErrServerClosed { + log.Fatalf("listen: %s\n", err) + } + } else { + if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { + log.Fatalf("listen: %s\n", err) + } + } + }() + content, _ := ioutil.ReadFile("./static/ferry.txt") + fmt.Println(string(content)) + fmt.Printf("%s Server Run http://127.0.0.1:%s/ \r\n", tools.GetCurrntTimeStr(), config2.ApplicationConfig.Port) + fmt.Printf("%s Swagger URL http://127.0.0.1:%s/swagger/index.html \r\n", tools.GetCurrntTimeStr(), config2.ApplicationConfig.Port) + fmt.Printf("%s Enter Control + C Shutdown Server \r\n", tools.GetCurrntTimeStr()) + // 等待中断信号以优雅地关闭服务器(设置 5 秒的超时时间) + quit := make(chan os.Signal) + signal.Notify(quit, os.Interrupt) + <-quit + fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrntTimeStr()) + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + if err := srv.Shutdown(ctx); err != nil { + log.Fatal("Server Shutdown:", err) + } + log.Println("Server exiting") + return nil +} diff --git a/cmd/cobra.go b/cmd/cobra.go new file mode 100644 index 0000000..366c850 --- /dev/null +++ b/cmd/cobra.go @@ -0,0 +1,42 @@ +package cmd + +import ( + "errors" + "ferry/cmd/api" + "ferry/cmd/migrate" + "os" + + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "ferry", + Short: "-v", + SilenceUsage: true, + DisableAutoGenTag: true, + Long: `ferry`, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 1 { + return errors.New("requires at least one arg") + } + return nil + }, + PersistentPreRunE: func(*cobra.Command, []string) error { return nil }, + Run: func(cmd *cobra.Command, args []string) { + usageStr := `欢迎使用 ferry,可以是用 -h 查看命令` + log.Printf("%s\n", usageStr) + }, +} + +func init() { + rootCmd.AddCommand(api.StartCmd) + rootCmd.AddCommand(migrate.StartCmd) +} + +//Execute : apply commands +func Execute() { + if err := rootCmd.Execute(); err != nil { + os.Exit(-1) + } +} diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go new file mode 100644 index 0000000..c1cc8b9 --- /dev/null +++ b/cmd/migrate/server.go @@ -0,0 +1,60 @@ +package migrate + +import ( + "ferry/database" + "ferry/global/orm" + "ferry/models" + "ferry/models/gorm" + "ferry/tools" + config2 "ferry/tools/config" + "fmt" + + log "github.com/sirupsen/logrus" + + "github.com/spf13/cobra" +) + +var ( + config string + mode string + StartCmd = &cobra.Command{ + Use: "init", + Short: "initialize the database", + Run: func(cmd *cobra.Command, args []string) { + run() + }, + } +) + +func init() { + StartCmd.PersistentFlags().StringVarP(&config, "config", "c", "config/settings.yml", "Start server with provided configuration file") + StartCmd.PersistentFlags().StringVarP(&mode, "mode", "m", "dev", "server mode ; eg:dev,test,prod") +} + +func run() { + usage := `start init` + fmt.Println(usage) + //1. 读取配置 + config2.ConfigSetup(config) + //2. 设置日志 + tools.InitLogger() + //3. 初始化数据库链接 + database.Setup() + //4. 数据库迁移 + _ = migrateModel() + log.Println("数据库结构初始化成功!") + //5. 数据初始化完成 + if err := models.InitDb(); err != nil { + log.Fatal("数据库基础数据初始化失败!") + } + + usage = `数据库基础数据初始化成功` + fmt.Println(usage) +} + +func migrateModel() error { + if config2.DatabaseConfig.Dbtype == "mysql" { + orm.Eloquent = orm.Eloquent.Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4") + } + return gorm.AutoMigrate(orm.Eloquent) +} diff --git a/config/READMEN.md b/config/READMEN.md new file mode 100644 index 0000000..763ddb6 --- /dev/null +++ b/config/READMEN.md @@ -0,0 +1,37 @@ +# ⚙ 配置详情 + +1. 配置文件说明 +```yml +settings: + application: + # 项目启动环境 + mode: dev # dev开发环境 test测试环境 prod线上环境; + host: 0.0.0.0 # 主机ip 或者域名,默认0.0.0.0 + # 服务名称 + name: ferry + # 服务端口 + port: 8000 + readtimeout: 1 + writertimeout: 2 + log: + # 日志文件存放路径 + dir: temp/logs + jwt: + # JWT加密字符串 + secret: ferry + # 过期时间单位:秒 + timeout: 3600 + database: + # 数据库名称 + name: dbname + # 数据库类型 + dbtype: mysql + # 数据库地址 + host: 127.0.0.1 + # 数据库密码 + password: password + # 数据库端口 + port: 3306 + # 数据库用户名 + username: root +``` \ No newline at end of file diff --git a/config/db.sql b/config/db.sql new file mode 100644 index 0000000..b96d52b --- /dev/null +++ b/config/db.sql @@ -0,0 +1,665 @@ +-- 开始初始化数据 ; +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +BEGIN; +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/deptTree', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/typeoptionselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/pic/', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/logout', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roledatascope', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roleDeptTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/user/avatar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/user/pwd', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUserList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/user/profile', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/roledatascope', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/roleDeptTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/deptTree', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/logout', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/user/avatar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/user/pwd', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/typeoptionselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUserList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/profile', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roledatascope', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roleDeptTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/deptTree', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/logout', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/avatar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/pwd', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/typeoptionselect', 'GET', NULL, NULL, NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys_index_skinName', 'skin-blue', 'Y', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow', '1', '1', '2020-02-29 10:37:48', '2020-04-08 13:03:21', NULL); +INSERT INTO `sys_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', '初始化密码 123456', '1', '1', '2020-02-29 10:38:23', '2020-03-11 00:35:28', NULL); +INSERT INTO `sys_config` VALUES (3, '主框架页-侧边栏主题', 'sys_index_sideTheme', 'theme-dark', 'Y', '深色主题theme-dark,浅色主题theme-light', '1', '1', '2020-02-29 10:39:01', '2020-04-07 23:21:50', NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_dept` VALUES (1, 0, '/0/1', '爱拓科技', 0, 'aituo', '13782218188', 'atuo@aituo.com', 0, '1', '1', '2020-02-27 15:30:19', '2020-03-10 21:09:21', NULL); +INSERT INTO `sys_dept` VALUES (7, 1, '/0/1/7', '研发部', 1, '', '', '', 0, '1', '1', '2020-03-08 23:10:59', '2020-04-08 13:00:03', NULL); +INSERT INTO `sys_dept` VALUES (8, 1, '/0/1/8', '运维部', 0, '', '', '', 0, '1', NULL, '2020-03-08 23:11:08', '2020-03-10 16:50:27', NULL); +INSERT INTO `sys_dept` VALUES (9, 1, '/0/1/9', '客服部', 0, '', '', '', 0, '1', NULL, '2020-03-08 23:11:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dept` VALUES (10, 1, '/0/1/10', '人力资源', 3, '张三', '', '', 1, '1', '1', '2020-04-07 23:48:38', '2020-04-07 23:48:46', NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_dict_data` VALUES (1, 0, '正常', '0', 'sys_normal_disable', '', '', '', 0, '', '1', '', '系统正常', '2020-02-28 20:55:34', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (2, 0, '停用', '1', 'sys_normal_disable', '', '', '', 0, '', '1', '', '系统停用', '2020-02-28 21:10:41', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (3, 0, '男', '0', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别男', '2020-02-28 21:37:28', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (4, 0, '女', '1', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别女', '2020-02-28 21:37:40', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (5, 0, '未知', '2', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别未知', '2020-02-28 21:38:05', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (6, 0, '显示', '0', 'sys_show_hide', '', '', '', 0, '', '1', '', '显示菜单', '2020-02-28 21:38:36', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (7, 0, '隐藏', '1', 'sys_show_hide', '', '', '', 0, '', '1', '', '隐藏菜单', '2020-02-28 21:38:50', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (8, 0, '是', 'Y', 'sys_yes_no', '', '', '', 0, '', '1', '', '系统默认是', '2020-02-28 21:39:40', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (9, 0, '否', 'N', 'sys_yes_no', '', '', '', 0, '', '1', '', '系统默认否', '2020-02-28 21:40:06', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (10, 0, '正常', '0', 'sys_job_status', '', '', '', 0, '', '1', '', '正常状态', '2020-02-28 21:41:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (11, 0, '停用', '1', 'sys_job_status', '', '', '', 0, '', '1', '', '停用状态', '2020-02-28 21:41:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (12, 0, '默认', 'DEFAULT', 'sys_job_group', '', '', '', 0, '', '1', '', '默认分组', '2020-02-28 21:41:48', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (13, 0, '系统', 'SYSTEM', 'sys_job_group', '', '', '', 0, '', '1', '', '系统分组', '2020-02-28 21:42:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (14, 0, '通知', '1', 'sys_notice_type', '', '', '', 0, '', '1', '', '通知', '2020-02-28 21:42:43', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (15, 0, '公告', '2', 'sys_notice_type', '', '', '', 0, '', '1', '', '公告', '2020-02-28 21:42:53', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (16, 0, '正常', '0', 'sys_common_status', '', '', '', 0, '', '1', '', '正常状态', '2020-02-28 21:43:21', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (17, 0, '关闭', '1', 'sys_common_status', '', '', '', 0, '', '1', '', '关闭状态', '2020-02-28 21:43:31', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (18, 0, '新增', '1', 'sys_oper_type', '', '', '', 0, '', '1', '', '新增操作', '2020-02-28 21:44:14', '2020-02-28 22:00:22', NULL); +INSERT INTO `sys_dict_data` VALUES (19, 0, '修改', '2', 'sys_oper_type', '', '', '', 0, '', '1', '', '修改操作', '2020-02-28 21:44:34', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (20, 0, '删除', '3', 'sys_oper_type', '', '', '', 0, '', '1', '', '删除操作', '2020-02-28 21:44:52', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (21, 0, '授权', '4', 'sys_oper_type', '', '', '', 0, '', '1', '', '授权操作', '2020-02-28 21:45:18', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (22, 0, '导出', '5', 'sys_oper_type', '', '', '', 0, '', '1', '', '导出操作', '2020-02-28 21:45:44', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (23, 0, '导入', '6', 'sys_oper_type', '', '', '', 0, '', '1', '', '导入操作', '2020-02-28 21:46:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (24, 0, '强退', '7', 'sys_oper_type', '', '', '', 0, '', '1', '', '强退操作', '2020-02-28 21:46:25', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (25, 0, '生成代码', '8', 'sys_oper_type', '', '', '', 0, '', '1', '', '生成操作', '2020-02-28 21:46:53', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (26, 0, '清空数据', '9', 'sys_oper_type', '', '', '', 0, '', '1', '', '清空操作', '2020-02-28 21:47:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (27, 0, '成功', '0', 'sys_notice_status', '', '', '', 0, '', '1', '', '成功状态', '2020-02-28 22:03:24', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (28, 0, '失败', '1', 'sys_notice_status', '', '', '', 0, '', '1', '', '失败状态', '2020-02-28 22:03:39', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (29, 0, '登录', '10', 'sys_oper_type', '', '', '', 0, '', '1', '1', '登录操作', '2020-03-15 18:35:23', '2020-03-15 18:39:30', NULL); +INSERT INTO `sys_dict_data` VALUES (30, 0, '退出', '11', 'sys_oper_type', '', '', '', 0, '', '1', '', '', '2020-03-15 18:35:39', '2020-03-15 18:35:39', NULL); +INSERT INTO `sys_dict_data` VALUES (31, 0, '获取验证码', '12', 'sys_oper_type', '', '', '', 0, '', '1', '', '获取验证码', '2020-03-15 18:38:42', '2020-03-15 18:35:39', NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_dict_type` VALUES (1, '系统开关', 'sys_normal_disable', 0, '1', '1', '系统开关列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (2, '用户性别', 'sys_user_sex', 0, '1', '', '用户性别列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (3, '菜单状态', 'sys_show_hide', 0, '1', '', '菜单状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (4, '系统是否', 'sys_yes_no', 0, '1', '', '系统是否列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (5, '任务状态', 'sys_job_status', 0, '1', '', '任务状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (6, '任务分组', 'sys_job_group', 0, '1', '', '任务分组列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', 0, '1', '', '通知类型列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (8, '系统状态', 'sys_common_status', 0, '1', '', '登录状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', 0, '1', '', '操作类型列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (10, '通知状态', 'sys_notice_status', 0, '1', '', '通知状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (11, '1', '1', 1, '1', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_menu` VALUES (2, 'Upms', '系统管理', 'example', '/upms', '/0/2', 'M', '无', '', 0, '1', '', 'Layout', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (3, 'Sysuser', '用户管理', 'user', 'sysuser', '/0/2/3', 'C', '无', 'system:sysuser:list', 2, NULL, NULL, '/sysuser/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:10:42', NULL); +INSERT INTO `sys_menu` VALUES (43, NULL, '新增用户', NULL, '/api/v1/sysuser', '/0/2/3/43', 'F', 'POST', 'system:sysuser:add', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (44, NULL, '查询用户', NULL, '/api/v1/sysuser', '/0/2/3/44', 'F', 'GET', 'system:sysuser:query', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (45, NULL, '修改用户', NULL, '/api/v1/sysuser/', '/0/2/3/45', 'F', 'PUT', 'system:sysuser:edit', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (46, NULL, '删除用户', NULL, '/api/v1/sysuser/', '/0/2/3/46', 'F', 'DELETE', 'system:sysuser:remove', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 15:32:45', NULL); +INSERT INTO `sys_menu` VALUES (51, 'Menu', '菜单管理', 'tree-table', 'menu', '/0/2/51', 'C', '无', 'system:sysmenu:list', 2, '1', '', '/menu/index', 3, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:30', NULL); +INSERT INTO `sys_menu` VALUES (52, 'Role', '角色管理', 'peoples', 'role', '/0/2/52', 'C', '无', 'system:sysrole:list', 2, '1', '', '/role/index', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:19', NULL); +INSERT INTO `sys_menu` VALUES (56, 'Dept', '部门管理', 'tree', 'dept', '/0/2/56', 'C', '无', 'system:sysdept:list', 2, '0', '', '/dept/index', 4, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:47', NULL); +INSERT INTO `sys_menu` VALUES (57, 'post', '岗位管理', 'pass', 'post', '/0/2/57', 'C', '无', 'system:syspost:list', 2, '0', '', '/post/index', 5, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:53', NULL); +INSERT INTO `sys_menu` VALUES (58, 'Dict', '字典管理', 'education', 'dict', '/0/2/58', 'C', '无', 'system:sysdicttype:list', 2, '0', '', '/dict/index', 6, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:04', NULL); +INSERT INTO `sys_menu` VALUES (59, 'DictData', '字典数据', 'education', 'dict/data/:dictId', '/0/2/59', 'C', '无', 'system:sysdictdata:list', 2, '0', '', '/dict/data', 100, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:25', NULL); +INSERT INTO `sys_menu` VALUES (60, 'Tools', '系统工具', 'component', '/tools', '/0/60', 'M', '无', '', 0, '0', '', 'Layout', 3, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (61, 'Swagger', '系统接口', 'guide', 'swagger', '/0/60/61', 'C', '无', '', 60, '0', '', '/tools/swagger/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (62, 'Config', '参数设置', 'list', '/config', '/0/2/62', 'C', '无', 'system:sysconfig:list', 2, '0', '', '/config/index', 7, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:16', NULL); +INSERT INTO `sys_menu` VALUES (63, '', '接口权限', 'bug', '', '/0/63', 'M', '', '', 0, '0', '', '', 99, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 16:39:32', NULL); +INSERT INTO `sys_menu` VALUES (64, '', '用户管理', 'user', '', '/0/63/64', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (66, '', '菜单管理', 'tree-table', '', '/0/63/66', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (67, '', '菜单列表', 'tree-table', '/api/v1/menulist', '/0/63/66/67', 'A', 'GET', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (68, '', '新建菜单', 'tree', '/api/v1/menu', '/0/63/66/68', 'A', 'POST', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (69, '', '字典', 'dict', '', '/0/63/69', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (70, '', '类型', 'dict', '', '/0/63/69/70', 'C', '', '', 69, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (71, '', '字典类型获取', 'tree', '/api/v1/dict/databytype/', '/0/63/256/71', 'A', 'GET', '', 256, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (72, '', '修改菜单', 'bug', '/api/v1/menu', '/0/63/66/72', 'A', 'PUT', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (73, '', '删除菜单', 'bug', '/api/v1/menu/:id', '/0/63/66/73', 'A', 'DELETE', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (74, NULL, '管理员列表', 'bug', '/api/v1/sysUserList', '/0/63/64/74', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (75, NULL, '根据id获取管理员', 'bug', '/api/v1/sysUser/:id', '/0/63/64/75', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (76, NULL, '获取管理员', 'bug', '/api/v1/sysUser/', '/0/63/64/76', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (77, NULL, '创建管理员', 'bug', '/api/v1/sysUser', '/0/63/64/77', 'A', 'POST', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (78, NULL, '修改管理员', 'bug', '/api/v1/sysUser', '/0/63/64/78', 'A', 'PUT', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (79, NULL, '删除管理员', 'bug', '/api/v1/sysUser/:id', '/0/63/64/79', 'A', 'DELETE', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (80, NULL, '当前用户个人信息', 'bug', '/api/v1/user/profile', '/0/63/256/267/80', 'A', 'GET', NULL, 267, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-05-03 20:50:40', NULL); +INSERT INTO `sys_menu` VALUES (81, NULL, '角色列表', 'bug', '/api/v1/rolelist', '/0/63/201/81', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (82, NULL, '获取角色信息', 'bug', '/api/v1/role/:id', '/0/63/201/82', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (83, NULL, '创建角色', 'bug', '/api/v1/role', '/0/63/201/83', 'A', 'POST', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (84, NULL, '修改角色', 'bug', '/api/v1/role', '/0/63/201/84', 'A', 'PUT', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (85, NULL, '删除角色', 'bug', '/api/v1/role/:id', '/0/63/201/85', 'A', 'DELETE', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (86, NULL, '参数列表', 'bug', '/api/v1/configList', '/0/63/202/86', 'A', 'GET', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (87, NULL, '根据id获取参数', 'bug', '/api/v1/config/:id', '/0/63/202/87', 'A', 'GET', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (88, NULL, '根据key获取参数', 'bug', '/api/v1/configKey/:id', '/0/63/256/88', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-05-03 20:54:37', NULL); +INSERT INTO `sys_menu` VALUES (89, NULL, '创建参数', 'bug', '/api/v1/config', '/0/63/202/89', 'A', 'POST', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (90, NULL, '修改参数', 'bug', '/api/v1/config', '/0/63/202/90', 'A', 'PUT', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (91, NULL, '删除参数', 'bug', '/api/v1/config/:id', '/0/63/202/91', 'A', 'DELETE', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (92, NULL, '获取角色菜单', 'bug', '/api/v1/menurole', '/0/63/201/92', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (93, NULL, '根据角色id获取角色', 'bug', '/api/v1/roleMenuTreeselect/:id', '/0/63/201/93', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (94, NULL, '获取菜单树', 'bug', '/api/v1/menuTreeselect', '/0/63/256/94', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-05-03 20:52:11', NULL); +INSERT INTO `sys_menu` VALUES (95, NULL, '获取角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/95', 'A', 'GET', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (96, NULL, '创建角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/96', 'A', 'POST', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (97, NULL, '删除用户菜单数据', 'bug', '/api/v1/rolemenu/:id', '/0/63/205/97', 'A', 'DELETE', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (103, NULL, '部门菜单列表', 'bug', '/api/v1/deptList', '/0/63/203/103', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (104, NULL, '根据id获取部门信息', 'bug', '/api/v1/dept/:id', '/0/63/203/104', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (105, NULL, '创建部门', 'bug', '/api/v1/dept', '/0/63/203/105', 'A', 'POST', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (106, NULL, '修改部门', 'bug', '/api/v1/dept', '/0/63/203/106', 'A', 'PUT', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (107, NULL, '删除部门', 'bug', '/api/v1/dept/:id', '/0/63/203/107', 'A', 'DELETE', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (108, NULL, '字典数据列表', 'bug', '/api/v1/dict/datalist', '/0/63/69/206/108', 'A', 'GET', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (109, NULL, '通过编码获取字典数据', 'bug', '/api/v1/dict/data/:id', '/0/63/69/206/109', 'A', 'GET', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (110, NULL, '通过字典类型获取字典数据', 'bug', '/api/v1/dict/databytype/:id', '/0/63/256/110', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (111, NULL, '创建字典数据', 'bug', '/api/v1/dict/data', '/0/63/69/206/111', 'A', 'POST', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (112, NULL, '修改字典数据', 'bug', '/api/v1/dict/data/', '/0/63/69/206/112', 'A', 'PUT', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (113, NULL, '删除字典数据', 'bug', '/api/v1/dict/data/:id', '/0/63/69/206/113', 'A', 'DELETE', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (114, NULL, '字典类型列表', 'bug', '/api/v1/dict/typelist', '/0/63/69/70/114', 'A', 'GET', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (115, NULL, '通过id获取字典类型', 'bug', '/api/v1/dict/type/:id', '/0/63/69/70/115', 'A', 'GET', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (116, NULL, '创建字典类型', 'bug', '/api/v1/dict/type', '/0/63/69/70/116', 'A', 'POST', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (117, NULL, '修改字典类型', 'bug', '/api/v1/dict/type', '/0/63/69/70/117', 'A', 'PUT', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (118, NULL, '删除字典类型', 'bug', '/api/v1/dict/type/:id', '/0/63/69/70/118', 'A', 'DELETE', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (119, NULL, '获取岗位列表', 'bug', '/api/v1/postlist', '/0/63/204/119', 'A', 'GET', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (120, NULL, '通过id获取岗位信息', 'bug', '/api/v1/post/:id', '/0/63/204/120', 'A', 'GET', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (121, NULL, '创建岗位', 'bug', '/api/v1/post', '/0/63/204/121', 'A', 'POST', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (122, NULL, '修改岗位', 'bug', '/api/v1/post', '/0/63/204/122', 'A', 'PUT', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (123, NULL, '删除岗位', 'bug', '/api/v1/post/:id', '/0/63/204/123', 'A', 'DELETE', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (137, NULL, '菜单列表', 'bug', '/api/v1/menulist', '/0/63/66/137', 'A', 'GET', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (138, NULL, '获取根据id菜单信息', 'bug', '/api/v1/menu/:id', '/0/63/66/138', 'A', 'GET', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (139, NULL, '创建菜单', 'bug', '/api/v1/menu', '/0/63/66/139', 'A', 'POST', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (140, NULL, '修改菜单', 'bug', '/api/v1/menu/:id', '/0/63/66/140', 'A', 'PUT', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (141, NULL, '删除菜单', 'bug', '/api/v1/menu/:id', '', 'A', 'DELETE', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (142, NULL, '获取角色对应的菜单id数组', 'bug', '/api/v1/menuids', '/0/63/256/142', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (201, '', '角色管理', 'peoples', '', '/0/63/201', 'C', 'GET', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (202, '', '参数设置', 'list', '', '/0/63/202', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (203, '', '部门管理', 'tree', '', '/0/63/203', 'C', 'POST', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (204, '', '岗位管理', 'pass', '', '/0/63/204', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (205, '', '角色菜单管理', 'nested', '', '/0/63/205', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (206, '', '数据', '', '', '/0/63/69/206', 'C', 'PUT', '', 69, '0', '', '', 2, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (211, 'Log', '日志管理', 'log', '/log', '/0/2/211', 'M', '', '', 2, '0', '', '/log/index', 8, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:15:32', NULL); +INSERT INTO `sys_menu` VALUES (212, 'LoginLog', '登录日志', 'logininfor', '/loginlog', '/0/2/211/212', 'C', '', 'system:sysloginlog:list', 211, '0', '', '/loginlog/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (213, NULL, '获取登录日志', 'bug', '/api/v1/loginloglist', '/0/63/214/213', 'A', 'GET', NULL, 214, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (214, '', '日志管理', 'log', '', '/0/63/214', 'M', 'GET', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (215, '', '删除日志', 'bug', '/api/v1/loginlog/:id', '/0/63/214/215', 'A', 'DELETE', '', 214, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (216, 'OperLog', '操作日志', 'skill', '/operlog', '/0/2/211/216', 'C', '', 'system:sysoperlog:list', 211, '0', '', '/operlog/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (217, '', '获取操作日志', 'bug', '/api/v1/operloglist', '/0/63/214/217', 'A', 'GET', '', 214, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (220, '', '新增菜单', '', '', '/0/2/51/220', 'F', '', 'system:sysmenu:add', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (221, '', '修改菜单', 'edit', '', '/0/2/51/221', 'F', '', 'system:sysmenu:edit', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (222, '', '查询菜单', 'search', '', '/0/2/51/222', 'F', '', 'system:sysmenu:query', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (223, '', '删除菜单', '', '', '/0/2/51/223', 'F', '', 'system:sysmenu:remove', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (224, '', '新增角色', '', '', '/0/2/52/224', 'F', '', 'system:sysrole:add', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (225, '', '查询角色', '', '', '/0/2/52/225', 'F', '', 'system:sysrole:query', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (226, '', '修改角色', '', '', '/0/2/52/226', 'F', '', 'system:sysrole:edit', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (227, '', '删除角色', '', '', '/0/2/52/227', 'F', '', 'system:sysrole:remove', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (228, '', '查询部门', '', '', '/0/2/56/228', 'F', '', 'system:sysdept:query', 56, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (229, '', '新增部门', '', '', '/0/2/56/229', 'F', '', 'system:sysdept:add', 56, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (230, '', '修改部门', '', '', '/0/2/56/230', 'F', '', 'system:sysdept:edit', 56, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (231, '', '删除部门', '', '', '/0/2/56/231', 'F', '', 'system:sysdept:remove', 56, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (232, '', '查询岗位', '', '', '/0/2/57/232', 'F', '', 'system:syspost:query', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (233, '', '新增岗位', '', '', '/0/2/57/233', 'F', '', 'system:syspost:add', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (234, '', '修改岗位', '', '', '/0/2/57/234', 'F', '', 'system:syspost:edit', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (235, '', '删除岗位', '', '', '/0/2/57/235', 'F', '', 'system:syspost:remove', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (236, '', '字典查询', '', '', '/0/2/58/236', 'F', '', 'system:sysdicttype:query', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (237, '', '新增类型', '', '', '/0/2/58/237', 'F', '', 'system:sysdicttype:add', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (238, '', '修改类型', '', '', '/0/2/58/238', 'F', '', 'system:sysdicttype:edit', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (239, '', '删除类型', '', '', '/0/2/58/239', 'F', '', 'system:sysdicttype:remove', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (240, '', '查询数据', '', '', '/0/2/59/240', 'F', '', 'system:sysdictdata:query', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (241, '', '新增数据', '', '', '/0/2/59/241', 'F', '', 'system:sysdictdata:add', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (242, '', '修改数据', '', '', '/0/2/59/242', 'F', '', 'system:sysdictdata:edit', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (243, '', '删除数据', '', '', '/0/2/59/243', 'F', '', 'system:sysdictdata:remove', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (244, '', '查询参数', '', '', '/0/2/62/244', 'F', '', 'system:sysconfig:query', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (245, '', '新增参数', '', '', '/0/2/62/245', 'F', '', 'system:sysconfig:add', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (246, '', '修改参数', '', '', '/0/2/62/246', 'F', '', 'system:sysconfig:edit', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (247, '', '删除参数', '', '', '/0/2/62/247', 'F', '', 'system:sysconfig:remove', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (248, '', '查询登录日志', '', '', '/0/2/211/212/248', 'F', '', 'system:sysloginlog:query', 212, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (249, '', '删除登录日志', '', '', '/0/2/211/212/249', 'F', '', 'system:sysloginlog:remove', 212, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (250, '', '查询操作日志', '', '', '/0/2/211/216/250', 'F', '', 'system:sysoperlog:query', 216, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (251, '', '删除操作日志', '', '', '/0/2/211/216/251', 'F', '', 'system:sysoperlog:remove', 216, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (252, '', '获取登录用户信息', '', '/api/v1/getinfo', '/0/63/256/252', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (253, '', '角色数据权限', '', '/api/v1/roledatascope', '/0/63/201/253', 'A', 'PUT', '', 201, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (254, '', '部门树接口【数据权限】', '', '/api/v1/roleDeptTreeselect/:id', '/0/63/256/254', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (255, '', '部门树【用户列表】', '', '/api/v1/deptTree', '/0/63/256/255', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (256, '', '必开接口', '', '', '/0/63/256', 'M', 'GET', '', 63, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (257, '', '通过key获取参数', 'bug', '/api/v1/configKey/:id', '/0/63/256/257', 'A', 'GET', '', 256, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (258, '', '退出登录', '', '/api/v1/logout', '/0/63/256/258', 'A', 'POST', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (259, '', '头像上传', '', '/api/v1/user/avatar', '/0/63/256/267/259', 'A', 'POST', '', 267, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-05-03 20:50:05', NULL); +INSERT INTO `sys_menu` VALUES (260, '', '修改密码', '', '/api/v1/user/pwd', '/0/63/256/260', 'A', 'PUT', '', 256, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (261, 'Gen', '代码生成', 'code', 'gen', '/0/60/261', 'C', '', '', 60, '0', '', '/tools/gen/index', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:18:12', NULL); +INSERT INTO `sys_menu` VALUES (262, 'EditTable', '代码生成修改', 'build', 'editTable', '/0/60/262', 'C', '', '', 60, '0', '', '/tools/gen/editTable', 100, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-05-03 20:38:36', NULL); +INSERT INTO `sys_menu` VALUES (263, '', '字典类型下拉框【生成功能】', '', '/api/v1/dict/typeoptionselect', '/0/63/256/263', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (264, 'Build', '表单构建', 'build', 'build', '/0/60/264', 'C', '', '', 60, '0', '', '/tools/build/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:18:05', NULL); +INSERT INTO `sys_menu` VALUES (267, '', '个人中心', '', '', '/0/63/256/267', 'M', '', '', 256, '0', '', '', 0, '1', '1', '', 1, '2020-05-03 20:49:39', '2020-05-03 20:49:39', NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_post` VALUES (1, '首席执行官', 'CEO', 0, 0, '首席执行官', '1', '2020-03-08 23:11:15', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (2, '首席技术执行官', 'CTO', 2, 0, '首席技术执行官', '1', '1', '2020-04-11 15:52:48', '2020-05-03 20:58:01', NULL); +INSERT INTO `sys_post` VALUES (3, '首席运营官', 'COO', 3, 0, '测试工程师', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_role` VALUES (1, '系统管理员', 0, 'admin', 1, NULL, '1', NULL, NULL, '0', NULL, '2020-04-11 15:52:48', '2020-05-03 21:35:17', NULL); +INSERT INTO `sys_role` VALUES (2, '普通角色', 0, 'common', 2, NULL, '1', NULL, NULL, '0', '2', '2020-04-11 15:52:48', '2020-05-03 21:32:59', NULL); +INSERT INTO `sys_role` VALUES (3, '测试角色', 0, 'Tester', 3, '', '1', NULL, NULL, '0', NULL, '2020-04-11 15:52:48', '2020-04-12 14:10:52', NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_role_menu` VALUES (2, 2, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 3, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 44, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 51, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 52, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 63, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 64, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 66, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 67, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 68, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 69, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 70, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 71, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 72, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 73, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 74, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 75, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 76, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 77, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 78, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 79, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 80, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 81, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 82, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 83, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 84, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 85, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 86, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 87, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 88, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 89, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 90, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 91, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 92, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 93, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 94, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 95, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 96, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 97, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 103, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 104, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 105, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 106, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 107, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 108, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 109, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 110, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 111, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 112, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 113, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 114, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 115, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 116, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 117, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 118, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 119, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 120, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 121, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 122, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 123, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 137, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 138, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 139, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 140, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 141, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 142, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 201, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 202, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 203, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 204, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 205, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 206, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 213, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 214, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 215, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 217, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 222, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 225, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 252, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 253, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 254, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 255, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 256, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 257, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 258, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 259, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 260, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 263, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (2, 267, 'common', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 2, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 3, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 43, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 44, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 45, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 46, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 51, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 52, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 56, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 57, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 58, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 59, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 60, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 61, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 62, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 63, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 64, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 66, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 67, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 68, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 69, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 70, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 71, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 72, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 73, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 74, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 75, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 76, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 77, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 78, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 79, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 80, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 81, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 82, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 83, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 84, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 85, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 86, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 87, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 88, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 89, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 90, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 91, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 92, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 93, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 94, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 95, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 96, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 97, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 103, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 104, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 105, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 106, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 107, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 108, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 109, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 110, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 111, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 112, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 113, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 114, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 115, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 116, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 117, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 118, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 119, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 120, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 121, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 122, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 123, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 137, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 138, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 139, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 140, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 141, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 142, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 201, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 202, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 203, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 204, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 205, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 206, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 211, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 212, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 213, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 214, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 215, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 216, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 217, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 220, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 221, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 222, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 223, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 224, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 225, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 226, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 227, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 228, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 229, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 230, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 231, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 232, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 233, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 234, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 235, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 236, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 237, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 238, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 239, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 240, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 241, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 242, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 243, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 244, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 245, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 246, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 247, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 248, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 249, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 250, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 251, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 252, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 253, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 254, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 255, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 256, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 257, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 258, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 259, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 260, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 261, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 262, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 263, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 264, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 267, 'admin', NULL, NULL); +COMMIT; + +BEGIN; +INSERT INTO `sys_user` VALUES (1, 'zhangwj', '13818888888', 1, NULL, '', '0', '1@qq.com', 1, 1, '1', '1', NULL, 0, '2019-11-10 14:05:55', '2020-05-03 20:45:59', NULL, 'admin', '$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2'); +INSERT INTO `sys_user` VALUES (2, 'zhangwj', '13211111111', 3, NULL, NULL, '0', 'q@q.com', 8, 2, '1', '1', NULL, 0, '2019-11-12 18:28:27', '2020-03-14 20:08:43', NULL, 'zhangwj', '$2a$10$CqMwHahA3cNrNv16CoSxmeD4XMPU.BiKHPEAeaG5oXMavOKrjInXi'); +INSERT INTO `sys_user` VALUES (3, '李四', '13838385438', 2, '', '', '0', 'qq@qq.com', 7, 2, '1', '1', '', 0, '2020-04-07 22:17:38', '2020-05-03 20:31:00', NULL, 'lisi', '$2a$10$DejldFea5.hGZGC7/oVN9OLDrHAWgu9l29RDz9FomLnWnro4umYl2'); +INSERT INTO `sys_user` VALUES (4, '王五', '13535353535', 3, '', '', '2', 'qq@qq.com', 8, 2, '1', '1', '', 0, '2020-04-12 14:06:49', '2020-04-12 14:07:09', NULL, 'wangwu', '$2a$10$3.RT6rpXANXvvlibX6PzU.FGA2CvfDxd1UmJ2H5zTzF4sYocbvsTO'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; +-- 数据完成 ; \ No newline at end of file diff --git a/config/rbac_model.conf b/config/rbac_model.conf new file mode 100644 index 0000000..32781ee --- /dev/null +++ b/config/rbac_model.conf @@ -0,0 +1,11 @@ +[request_definition] +r = sub, obj, act + +[policy_definition] +p = sub, obj, act + +[policy_effect] +e = some(where (p.eft == allow)) + +[matchers] +m = r.sub == p.sub && (keyMatch2(r.obj, p.obj) || keyMatch(r.obj, p.obj)) && (r.act == p.act || p.act == "*") \ No newline at end of file diff --git a/config/settings.yml b/config/settings.yml new file mode 100644 index 0000000..989acbb --- /dev/null +++ b/config/settings.yml @@ -0,0 +1,26 @@ +settings: + application: + mode: dev # dev开发环境 test测试环境 prod线上环境 + host: 0.0.0.0 + name: testApp + port: 8000 + readtimeout: 1 + writertimeout: 2 + domain: localhost:8000 + ishttps: false + ssl: + key: keystring + pem: temp/pem.pem + log: + operdb: false + dir: temp/logs + jwt: + secret: ferry + timeout: 3600 + database: + name: goadmindb + dbtype: mysql + host: 127.0.0.1 + password: 123456 + port: 3306 + username: root diff --git a/config/sqlite.sql b/config/sqlite.sql new file mode 100755 index 0000000..bb17982 --- /dev/null +++ b/config/sqlite.sql @@ -0,0 +1,662 @@ +PRAGMA synchronous = OFF; +PRAGMA journal_mode = MEMORY; +BEGIN TRANSACTION; +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/calendar', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/calendar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/calendar/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/calendar/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/doctor', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/doctor', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/doctor/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/doctor/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/doctor/pic/', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/member', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/member', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/member/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/member/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menu/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/orders', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/orders', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/orders/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/orders/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/orders/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUser/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/sysUserList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'common', '/api/v1/user/profile', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/calendar/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/deptTree', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/dict/typeoptionselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/doctor/pic/', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/logout', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/member/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/orders/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roledatascope', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roleDeptTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/user/avatar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'Tester', '/api/v1/user/pwd', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUserList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/databytype/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUserList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/sysUser/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/profile', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/role/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/config/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menurole', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roleMenuTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menuTreeselect', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/rolemenu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/doctor', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/doctor', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/doctor/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/doctor/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/doctor/pic/', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/deptList', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dept/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/datalist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/databytype/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/data/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/typelist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/type/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/postlist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/post/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/calendar', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/calendar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/calendar/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/calendar/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/member', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/member', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/member/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/member/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/orders', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/orders/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/orders', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/orders/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/orders/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menulist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menu/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/menuids', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/loginloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/loginlog/:id', 'DELETE', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/operloglist', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/getinfo', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roledatascope', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/roleDeptTreeselect/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/deptTree', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/configKey/:id', 'GET', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/logout', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/avatar', 'POST', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/user/pwd', 'PUT', NULL, NULL, NULL); +INSERT INTO `casbin_rule` VALUES ('p', 'admin', '/api/v1/dict/typeoptionselect', 'GET', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (341, 20, 'table_id', '表编码', 'int(11)', 'int64', 'TableId', 'tableId', '1', '', '1', '1', '', '', '', 'EQ', 'input', '', 1, '', '1', '1', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (342, 20, 'table_name', '表名称', 'varchar(255)', 'string', 'TableName', 'tableName', '0', '', '0', '1', '', '1', '1', 'EQ', 'input', '', 2, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (343, 20, 'table_comment', '表备注', 'varchar(255)', 'string', 'TableComment', 'tableComment', '0', '', '0', '1', '', '1', '1', 'EQ', 'input', '', 3, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (344, 20, 'class_name', '类名', 'varchar(255)', 'string', 'ClassName', 'className', '0', '', '0', '1', '', '1', '1', 'EQ', 'input', '', 4, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (345, 20, 'tpl_category', '模板类型', 'varchar(255)', 'string', 'TplCategory', 'tplCategory', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 5, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (346, 20, 'package_name', '包名', 'varchar(255)', 'string', 'PackageName', 'packageName', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 6, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (347, 20, 'module_name', '模块名', 'varchar(255)', 'string', 'ModuleName', 'moduleName', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 7, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (348, 20, 'business_name', '业务名', 'varchar(255)', 'string', 'BusinessName', 'businessName', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 8, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (349, 20, 'function_name', '功能名称', 'varchar(255)', 'string', 'FunctionName', 'functionName', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 9, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (350, 20, 'function_author', '功能作者', 'varchar(255)', 'string', 'FunctionAuthor', 'functionAuthor', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 10, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (351, 20, 'pk_column', '主键列名', 'varchar(255)', 'string', 'PkColumn', 'pkColumn', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 11, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (352, 20, 'pk_go_field', '主键go类型名', 'varchar(255)', 'string', 'PkGoField', 'pkGoField', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 12, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (353, 20, 'pk_json_field', '主键json名', 'varchar(255)', 'string', 'PkJsonField', 'pkJsonField', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 13, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (354, 20, 'options', '', 'varchar(255)', 'string', 'Options', 'options', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 14, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (355, 20, 'tree_code', '树编码', 'varchar(255)', 'string', 'TreeCode', 'treeCode', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 15, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (356, 20, 'tree_parent_code', '树上级编码', 'varchar(255)', 'string', 'TreeParentCode', 'treeParentCode', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 16, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (357, 20, 'tree_name', '树显示名', 'varchar(255)', 'string', 'TreeName', 'treeName', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 17, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (358, 20, 'tree', '是否是树', 'char(1)', 'string', 'Tree', 'tree', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 18, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (359, 20, 'crud', '是否crud', 'char(1)', 'string', 'Crud', 'crud', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 19, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (360, 20, 'remark', '备注', 'varchar(255)', 'string', 'Remark', 'remark', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 20, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (361, 20, 'create_by', '', 'varchar(128)', 'string', 'CreateBy', 'createBy', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 21, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (362, 20, 'create_time', '', 'datetime', 'string', 'CreateTime', 'createTime', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 22, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (363, 20, 'update_by', '', 'varchar(128)', 'string', 'UpdateBy', 'updateBy', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 23, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (364, 20, 'update_time', '', 'datetime', 'string', 'UpdateTime', 'updateTime', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 24, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (365, 20, 'is_logical_delete', '是否逻辑删除', 'char(4)', 'string', 'IsLogicalDelete', 'isLogicalDelete', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 25, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (366, 20, 'logical_delete_column', '逻辑删除字段', 'varchar(128)', 'string', 'LogicalDeleteColumn', 'logicalDeleteColumn', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 26, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_columns` VALUES (367, 20, 'logical_delete', '', 'char(1)', 'string', 'LogicalDelete', 'logicalDelete', '0', '', '0', '1', '', '', '', 'EQ', 'input', '', 27, '', '0', '0', '0', '0', '0', '1', '0', '0', '', '', '', NULL, NULL, NULL); +INSERT INTO `sys_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys_index_skinName', 'skin-blue', 'Y', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow', '1', '1', '2020-02-29 10:37:48', '2020-04-08 13:03:21', NULL); +INSERT INTO `sys_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', '初始化密码 123456', '1', '1', '2020-02-29 10:38:23', '2020-03-11 00:35:28', NULL); +INSERT INTO `sys_config` VALUES (3, '主框架页-侧边栏主题', 'sys_index_sideTheme', 'theme-dark', 'Y', '深色主题theme-dark,浅色主题theme-light', '1', '1', '2020-02-29 10:39:01', '2020-04-07 23:21:50', NULL); +INSERT INTO `sys_dept` VALUES (1, 0, '/0/1', '爱拓科技', 0, 'aituo', '13782218188', 'atuo@aituo.com', 0, '1', '1', '2020-02-27 15:30:19', '2020-03-10 21:09:21', NULL); +INSERT INTO `sys_dept` VALUES (7, 1, '/0/1/7', '研发部', 1, '', '', '', 0, '1', '1', '2020-03-08 23:10:59', '2020-04-08 13:00:03', NULL); +INSERT INTO `sys_dept` VALUES (8, 1, '/0/1/8', '运维部', 0, '', '', '', 0, '1', NULL, '2020-03-08 23:11:08', '2020-03-10 16:50:27', NULL); +INSERT INTO `sys_dept` VALUES (9, 1, '/0/1/9', '客服部', 0, '', '', '', 0, '1', NULL, '2020-03-08 23:11:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dept` VALUES (10, 1, '/0/1/10', '人力资源', 3, '张三', '', '', 1, '1', '1', '2020-04-07 23:48:38', '2020-04-07 23:48:46', NULL); +INSERT INTO `sys_dict_data` VALUES (1, 0, '正常', '0', 'sys_normal_disable', '', '', '', 0, '', '1', '', '系统正常', '2020-02-28 20:55:34', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (2, 0, '停用', '1', 'sys_normal_disable', '', '', '', 0, '', '1', '', '系统停用', '2020-02-28 21:10:41', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (3, 0, '男', '0', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别男', '2020-02-28 21:37:28', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (4, 0, '女', '1', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别女', '2020-02-28 21:37:40', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (5, 0, '未知', '2', 'sys_user_sex', '', '', '', 0, '', '1', '', '性别未知', '2020-02-28 21:38:05', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (6, 0, '显示', '0', 'sys_show_hide', '', '', '', 0, '', '1', '', '显示菜单', '2020-02-28 21:38:36', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (7, 0, '隐藏', '1', 'sys_show_hide', '', '', '', 0, '', '1', '', '隐藏菜单', '2020-02-28 21:38:50', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (8, 0, '是', 'Y', 'sys_yes_no', '', '', '', 0, '', '1', '', '系统默认是', '2020-02-28 21:39:40', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (9, 0, '否', 'N', 'sys_yes_no', '', '', '', 0, '', '1', '', '系统默认否', '2020-02-28 21:40:06', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (10, 0, '正常', '0', 'sys_job_status', '', '', '', 0, '', '1', '', '正常状态', '2020-02-28 21:41:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (11, 0, '停用', '1', 'sys_job_status', '', '', '', 0, '', '1', '', '停用状态', '2020-02-28 21:41:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (12, 0, '默认', 'DEFAULT', 'sys_job_group', '', '', '', 0, '', '1', '', '默认分组', '2020-02-28 21:41:48', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (13, 0, '系统', 'SYSTEM', 'sys_job_group', '', '', '', 0, '', '1', '', '系统分组', '2020-02-28 21:42:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (14, 0, '通知', '1', 'sys_notice_type', '', '', '', 0, '', '1', '', '通知', '2020-02-28 21:42:43', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (15, 0, '公告', '2', 'sys_notice_type', '', '', '', 0, '', '1', '', '公告', '2020-02-28 21:42:53', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (16, 0, '正常', '0', 'sys_common_status', '', '', '', 0, '', '1', '', '正常状态', '2020-02-28 21:43:21', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (17, 0, '关闭', '1', 'sys_common_status', '', '', '', 0, '', '1', '', '关闭状态', '2020-02-28 21:43:31', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (18, 0, '新增', '1', 'sys_oper_type', '', '', '', 0, '', '1', '', '新增操作', '2020-02-28 21:44:14', '2020-02-28 22:00:22', NULL); +INSERT INTO `sys_dict_data` VALUES (19, 0, '修改', '2', 'sys_oper_type', '', '', '', 0, '', '1', '', '修改操作', '2020-02-28 21:44:34', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (20, 0, '删除', '3', 'sys_oper_type', '', '', '', 0, '', '1', '', '删除操作', '2020-02-28 21:44:52', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (21, 0, '授权', '4', 'sys_oper_type', '', '', '', 0, '', '1', '', '授权操作', '2020-02-28 21:45:18', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (22, 0, '导出', '5', 'sys_oper_type', '', '', '', 0, '', '1', '', '导出操作', '2020-02-28 21:45:44', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (23, 0, '导入', '6', 'sys_oper_type', '', '', '', 0, '', '1', '', '导入操作', '2020-02-28 21:46:02', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (24, 0, '强退', '7', 'sys_oper_type', '', '', '', 0, '', '1', '', '强退操作', '2020-02-28 21:46:25', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (25, 0, '生成代码', '8', 'sys_oper_type', '', '', '', 0, '', '1', '', '生成操作', '2020-02-28 21:46:53', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (26, 0, '清空数据', '9', 'sys_oper_type', '', '', '', 0, '', '1', '', '清空操作', '2020-02-28 21:47:15', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (27, 0, '成功', '0', 'sys_notice_status', '', '', '', 0, '', '1', '', '成功状态', '2020-02-28 22:03:24', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (28, 0, '失败', '1', 'sys_notice_status', '', '', '', 0, '', '1', '', '失败状态', '2020-02-28 22:03:39', '2020-03-08 23:11:15', NULL); +INSERT INTO `sys_dict_data` VALUES (29, 0, '登录', '10', 'sys_oper_type', '', '', '', 0, '', '1', '1', '登录操作', '2020-03-15 18:35:23', '2020-03-15 18:39:30', NULL); +INSERT INTO `sys_dict_data` VALUES (30, 0, '退出', '11', 'sys_oper_type', '', '', '', 0, '', '1', '', '', '2020-03-15 18:35:39', '2020-03-15 18:35:39', NULL); +INSERT INTO `sys_dict_data` VALUES (31, 0, '获取验证码', '12', 'sys_oper_type', '', '', '', 0, '', '1', '', '获取验证码', '2020-03-15 18:38:42', '2020-03-15 18:35:39', NULL); +INSERT INTO `sys_dict_type` VALUES (1, '系统开关', 'sys_normal_disable', 0, '1', '1', '系统开关列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (2, '用户性别', 'sys_user_sex', 0, '1', '', '用户性别列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (3, '菜单状态', 'sys_show_hide', 0, '1', '', '菜单状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (4, '系统是否', 'sys_yes_no', 0, '1', '', '系统是否列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (5, '任务状态', 'sys_job_status', 0, '1', '', '任务状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (6, '任务分组', 'sys_job_group', 0, '1', '', '任务分组列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', 0, '1', '', '通知类型列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (8, '系统状态', 'sys_common_status', 0, '1', '', '登录状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', 0, '1', '', '操作类型列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (10, '通知状态', 'sys_notice_status', 0, '1', '', '通知状态列表', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (11, '1', '1', 1, '1', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (2, 'Upms', '系统管理', 'example', '/upms', '/0/2', 'M', '无', '', 0, '1', '', 'Layout', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (3, 'Sysuser', '用户管理', 'user', 'sysuser', '/0/2/3', 'C', '无', 'system:sysuser:list', 2, NULL, NULL, '/sysuser/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:10:42', NULL); +INSERT INTO `sys_menu` VALUES (43, NULL, '新增用户', NULL, '/api/v1/sysuser', '/0/2/3/43', 'F', 'POST', 'system:sysuser:add', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (44, NULL, '查询用户', NULL, '/api/v1/sysuser', '/0/2/3/44', 'F', 'GET', 'system:sysuser:query', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (45, NULL, '修改用户', NULL, '/api/v1/sysuser/', '/0/2/3/45', 'F', 'PUT', 'system:sysuser:edit', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (46, NULL, '删除用户', NULL, '/api/v1/sysuser/', '/0/2/3/46', 'F', 'DELETE', 'system:sysuser:remove', 3, NULL, NULL, NULL, 0, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 15:32:45', NULL); +INSERT INTO `sys_menu` VALUES (50, 'Mangent', '基础信息', 'network', '/mangent', '/0/50', 'M', '无', '', 0, '1', '', 'Layout', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (51, 'Menu', '菜单管理', 'tree-table', 'menu', '/0/2/51', 'C', '无', 'system:sysmenu:list', 2, '1', '', '/menu/index', 3, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:30', NULL); +INSERT INTO `sys_menu` VALUES (52, 'Role', '角色管理', 'peoples', 'role', '/0/2/52', 'C', '无', 'system:sysrole:list', 2, '1', '', '/role/index', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:19', NULL); +INSERT INTO `sys_menu` VALUES (53, 'Doctor', '医生管理', 'pass', 'doctor', '/0/50/53', 'C', '无', '', 50, '1', '', '/doctor/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (54, 'Calendar', '排班管理', 'calendar', 'calendar', '/0/50/54', 'C', '无', '', 50, '1', '', '/calendar/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (55, 'Menber', '会员管理', 'vip', 'member', '/0/50/55', 'C', '无', '', 50, '1', '', '/member/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (56, 'Dept', '部门管理', 'tree', 'dept', '/0/2/56', 'C', '无', 'system:sysdept:list', 2, '0', '', '/dept/index', 4, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:47', NULL); +INSERT INTO `sys_menu` VALUES (57, 'post', '岗位管理', 'pass', 'post', '/0/2/57', 'C', '无', 'system:syspost:list', 2, '0', '', '/post/index', 5, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:53', NULL); +INSERT INTO `sys_menu` VALUES (58, 'Dict', '字典管理', 'education', 'dict', '/0/2/58', 'C', '无', 'system:sysdicttype:list', 2, '0', '', '/dict/index', 6, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:04', NULL); +INSERT INTO `sys_menu` VALUES (59, 'DictData', '字典数据', 'education', 'dict/data/:dictId', '/0/2/59', 'C', '无', 'system:sysdictdata:list', 2, '0', '', '/dict/data', 100, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:25', NULL); +INSERT INTO `sys_menu` VALUES (60, 'Tools', '系统工具', 'component', '/tools', '/0/60', 'M', '无', '', 0, '0', '', 'Layout', 3, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (61, 'Swagger', '系统接口', 'guide', 'swagger', '/0/60/61', 'C', '无', '', 60, '0', '', '/tools/swagger/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (62, 'Config', '参数设置', 'list', '/config', '/0/2/62', 'C', '无', 'system:sysconfig:list', 2, '0', '', '/config/index', 7, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:16', NULL); +INSERT INTO `sys_menu` VALUES (63, '', '接口权限', 'bug', '', '/0/63', 'M', '', '', 0, '0', '', '', 99, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 16:39:32', NULL); +INSERT INTO `sys_menu` VALUES (64, '', '用户管理', 'user', '', '/0/63/64', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (65, NULL, '用户列表', NULL, '/api/v1/sysUserList', '', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (66, '', '菜单管理', 'tree-table', '', '/0/63/66', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (67, '', '菜单列表', 'tree-table', '/api/v1/menulist', '/0/63/66/67', 'A', 'GET', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (68, '', '新建菜单', 'tree', '/api/v1/menu', '/0/63/66/68', 'A', 'POST', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (69, '', '字典', 'dict', '', '/0/63/69', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (70, '', '类型', 'dict', '', '/0/63/69/70', 'C', '', '', 69, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (71, '', '字典类型获取', 'tree', '/api/v1/dict/databytype/', '/0/63/256/71', 'A', 'GET', '', 256, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (72, '', '修改菜单', 'bug', '/api/v1/menu', '/0/63/66/72', 'A', 'PUT', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (73, '', '删除菜单', 'bug', '/api/v1/menu/:id', '/0/63/66/73', 'A', 'DELETE', '', 66, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (74, NULL, '管理员列表', 'bug', '/api/v1/sysUserList', '/0/63/64/74', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (75, NULL, '根据id获取管理员', 'bug', '/api/v1/sysUser/:id', '/0/63/64/75', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (76, NULL, '获取管理员', 'bug', '/api/v1/sysUser/', '/0/63/64/76', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (77, NULL, '创建管理员', 'bug', '/api/v1/sysUser', '/0/63/64/77', 'A', 'POST', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (78, NULL, '修改管理员', 'bug', '/api/v1/sysUser', '/0/63/64/78', 'A', 'PUT', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (79, NULL, '删除管理员', 'bug', '/api/v1/sysUser/:id', '/0/63/64/79', 'A', 'DELETE', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (80, NULL, '当前用户个人信息', 'bug', '/api/v1/user/profile', '/0/63/64/80', 'A', 'GET', NULL, 64, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (81, NULL, '角色列表', 'bug', '/api/v1/rolelist', '/0/63/201/81', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (82, NULL, '获取角色信息', 'bug', '/api/v1/role/:id', '/0/63/201/82', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (83, NULL, '创建角色', 'bug', '/api/v1/role', '/0/63/201/83', 'A', 'POST', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (84, NULL, '修改角色', 'bug', '/api/v1/role', '/0/63/201/84', 'A', 'PUT', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (85, NULL, '删除角色', 'bug', '/api/v1/role/:id', '/0/63/201/85', 'A', 'DELETE', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (86, NULL, '参数列表', 'bug', '/api/v1/configList', '/0/63/202/86', 'A', 'GET', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (87, NULL, '根据id获取参数', 'bug', '/api/v1/config/:id', '/0/63/202/87', 'A', 'GET', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (88, NULL, '根据key获取参数', 'bug', '/api/v1/configKey/:id', '/0/63/202/88', 'A', 'GET', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (89, NULL, '创建参数', 'bug', '/api/v1/config', '/0/63/202/89', 'A', 'POST', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (90, NULL, '修改参数', 'bug', '/api/v1/config', '/0/63/202/90', 'A', 'PUT', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (91, NULL, '删除参数', 'bug', '/api/v1/config/:id', '/0/63/202/91', 'A', 'DELETE', NULL, 202, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (92, NULL, '获取角色菜单', 'bug', '/api/v1/menurole', '/0/63/201/92', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (93, NULL, '根据角色id获取角色', 'bug', '/api/v1/roleMenuTreeselect/:id', '/0/63/201/93', 'A', 'GET', NULL, 201, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (94, NULL, '获取菜单树', 'bug', '/api/v1/menuTreeselect', '/0/63/205/94', 'A', 'GET', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (95, NULL, '获取角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/95', 'A', 'GET', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (96, NULL, '创建角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/96', 'A', 'POST', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (97, NULL, '删除用户菜单数据', 'bug', '/api/v1/rolemenu/:id', '/0/63/205/97', 'A', 'DELETE', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (98, NULL, '医生获取', 'bug', '/api/v1/doctor', '/0/63/208/98', 'A', 'GET', NULL, 208, NULL, NULL, NULL, 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (99, NULL, '创建医生', 'bug', '/api/v1/doctor', '/0/63/208/99', 'A', 'POST', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (100, NULL, '修改医生', 'bug', '/api/v1/doctor/:id', '/0/63/208/100', 'A', 'PUT', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (101, NULL, '删除医生', 'bug', '/api/v1/doctor/:id', '/0/63/208/101', 'A', 'DELETE', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (102, NULL, '添加医生头像', 'bug', '/api/v1/doctor/pic/', '/0/63/208/102', 'A', 'POST', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (103, NULL, '部门菜单列表', 'bug', '/api/v1/deptList', '/0/63/203/103', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (104, NULL, '根据id获取部门信息', 'bug', '/api/v1/dept/:id', '/0/63/203/104', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (105, NULL, '创建部门', 'bug', '/api/v1/dept', '/0/63/203/105', 'A', 'POST', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (106, NULL, '修改部门', 'bug', '/api/v1/dept', '/0/63/203/106', 'A', 'PUT', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (107, NULL, '删除部门', 'bug', '/api/v1/dept/:id', '/0/63/203/107', 'A', 'DELETE', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (108, NULL, '字典数据列表', 'bug', '/api/v1/dict/datalist', '/0/63/69/206/108', 'A', 'GET', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (109, NULL, '通过编码获取字典数据', 'bug', '/api/v1/dict/data/:id', '/0/63/69/206/109', 'A', 'GET', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (110, NULL, '通过字典类型获取字典数据', 'bug', '/api/v1/dict/databytype/:id', '/0/63/256/110', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (111, NULL, '创建字典数据', 'bug', '/api/v1/dict/data', '/0/63/69/206/111', 'A', 'POST', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (112, NULL, '修改字典数据', 'bug', '/api/v1/dict/data/', '/0/63/69/206/112', 'A', 'PUT', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (113, NULL, '删除字典数据', 'bug', '/api/v1/dict/data/:id', '/0/63/69/206/113', 'A', 'DELETE', NULL, 206, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (114, NULL, '字典类型列表', 'bug', '/api/v1/dict/typelist', '/0/63/69/70/114', 'A', 'GET', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (115, NULL, '通过id获取字典类型', 'bug', '/api/v1/dict/type/:id', '/0/63/69/70/115', 'A', 'GET', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (116, NULL, '创建字典类型', 'bug', '/api/v1/dict/type', '/0/63/69/70/116', 'A', 'POST', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (117, NULL, '修改字典类型', 'bug', '/api/v1/dict/type', '/0/63/69/70/117', 'A', 'PUT', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (118, NULL, '删除字典类型', 'bug', '/api/v1/dict/type/:id', '/0/63/69/70/118', 'A', 'DELETE', NULL, 70, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (119, NULL, '获取岗位列表', 'bug', '/api/v1/postlist', '/0/63/204/119', 'A', 'GET', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (120, NULL, '通过id获取岗位信息', 'bug', '/api/v1/post/:id', '/0/63/204/120', 'A', 'GET', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (121, NULL, '创建岗位', 'bug', '/api/v1/post', '/0/63/204/121', 'A', 'POST', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (122, NULL, '修改岗位', 'bug', '/api/v1/post', '/0/63/204/122', 'A', 'PUT', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (123, NULL, '删除岗位', 'bug', '/api/v1/post/:id', '/0/63/204/123', 'A', 'DELETE', NULL, 204, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (124, NULL, '获取排班信息', 'bug', '/api/v1/calendar', '/0/63/210/124', 'A', 'GET', NULL, 210, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (125, NULL, '创建排班', 'bug', '/api/v1/calendar', '/0/63/210/125', 'A', 'POST', NULL, 210, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (126, NULL, '修改排班', 'bug', '/api/v1/calendar/:id', '/0/63/210/126', 'A', 'PUT', NULL, 210, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (127, NULL, '删除排班', 'bug', '/api/v1/calendar/:id', '/0/63/210/127', 'A', 'DELETE', NULL, 210, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (128, NULL, '获取会员', 'bug', '/api/v1/member', '/0/63/207/128', 'A', 'GET', NULL, 207, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (129, NULL, '创建会员', 'bug', '/api/v1/member', '/0/63/207/129', 'A', 'POST', NULL, 207, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (130, NULL, '修改会员', 'bug', '/api/v1/member/:id', '/0/63/207/130', 'A', 'PUT', NULL, 207, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (131, NULL, '删除会员', 'bug', '/api/v1/member/:id', '/0/63/207/131', 'A', 'DELETE', NULL, 207, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (132, NULL, '获取订单', 'bug', '/api/v1/orders', '/0/63/209/132', 'A', 'GET', NULL, 209, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (133, NULL, '通过id获取订单', 'bug', '/api/v1/orders/:id', '/0/63/209/133', 'A', 'GET', NULL, 209, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (134, NULL, '新建订单', 'bug', '/api/v1/orders', '/0/63/209/134', 'A', 'POST', NULL, 209, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (135, NULL, '修改订单', 'bug', '/api/v1/orders/:id', '/0/63/209/135', 'A', 'PUT', NULL, 209, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (136, NULL, '删除订单', 'bug', '/api/v1/orders/:id', '/0/63/209/136', 'A', 'DELETE', NULL, 209, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (137, NULL, '菜单列表', 'bug', '/api/v1/menulist', '/0/63/66/137', 'A', 'GET', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (138, NULL, '获取根据id菜单信息', 'bug', '/api/v1/menu/:id', '/0/63/66/138', 'A', 'GET', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (139, NULL, '创建菜单', 'bug', '/api/v1/menu', '/0/63/66/139', 'A', 'POST', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (140, NULL, '修改菜单', 'bug', '/api/v1/menu/:id', '/0/63/66/140', 'A', 'PUT', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (141, NULL, '删除菜单', 'bug', '/api/v1/menu/:id', '', 'A', 'DELETE', NULL, 66, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (142, NULL, '获取角色对应的菜单id数组', 'bug', '/api/v1/menuids', '/0/63/256/142', 'A', 'GET', NULL, 256, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (201, '', '角色管理', 'peoples', '', '/0/63/201', 'C', 'GET', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (202, '', '参数设置', 'list', '', '/0/63/202', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (203, '', '部门管理', 'tree', '', '/0/63/203', 'C', 'POST', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (204, '', '岗位管理', 'pass', '', '/0/63/204', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (205, '', '角色菜单管理', 'nested', '', '/0/63/205', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (206, '', '数据', '', '', '/0/63/69/206', 'C', 'PUT', '', 69, '0', '', '', 2, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (207, '', '会员管理', 'vip', '', '/0/63/207', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (208, '', '医生管理', 'theme', '', '/0/63/208', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (209, '', '订单管理', 'tab', '', '/0/63/209', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (210, '', '排班管理', 'calendar', '', '/0/63/210', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (211, 'Log', '日志管理', 'log', '/log', '/0/2/211', 'M', '', '', 2, '0', '', '/log/index', 8, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:15:32', NULL); +INSERT INTO `sys_menu` VALUES (212, 'LoginLog', '登录日志', 'logininfor', '/loginlog', '/0/2/211/212', 'C', '', 'system:sysloginlog:list', 211, '0', '', '/loginlog/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (213, NULL, '获取登录日志', 'bug', '/api/v1/loginloglist', '/0/63/214/213', 'A', 'GET', NULL, 214, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (214, '', '日志管理', 'log', '', '/0/63/214', 'M', 'GET', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (215, '', '删除日志', 'bug', '/api/v1/loginlog/:id', '/0/63/214/215', 'A', 'DELETE', '', 214, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (216, 'OperLog', '操作日志', 'skill', '/operlog', '/0/2/211/216', 'C', '', 'system:sysoperlog:list', 211, '0', '', '/operlog/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (217, '', '获取操作日志', 'bug', '/api/v1/operloglist', '/0/63/214/217', 'A', 'GET', '', 214, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (218, 'Calendars', '日历', 'calendar', 'calendar', '/0/60/218', 'C', '', '', 60, '0', '', '/calendar/index', 4, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:58', NULL); +INSERT INTO `sys_menu` VALUES (219, 'Excel', 'Excel导入', 'excel', '/excel', '/0/50/219', 'C', '', '', 50, '0', '', '/excel/upload-excel', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (220, '', '新增菜单', '', '', '/0/2/51/220', 'F', '', 'system:sysmenu:add', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (221, '', '修改菜单', 'edit', '', '/0/2/51/221', 'F', '', 'system:sysmenu:edit', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (222, '', '查询菜单', 'search', '', '/0/2/51/222', 'F', '', 'system:sysmenu:query', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (223, '', '删除菜单', '', '', '/0/2/51/223', 'F', '', 'system:sysmenu:remove', 51, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (224, '', '新增角色', '', '', '/0/2/52/224', 'F', '', 'system:sysrole:add', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (225, '', '查询角色', '', '', '/0/2/52/225', 'F', '', 'system:sysrole:query', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (226, '', '修改角色', '', '', '/0/2/52/226', 'F', '', 'system:sysrole:edit', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (227, '', '删除角色', '', '', '/0/2/52/227', 'F', '', 'system:sysrole:remove', 52, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (228, '', '查询部门', '', '', '/0/2/56/228', 'F', '', 'system:sysdept:query', 56, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (229, '', '新增部门', '', '', '/0/2/56/229', 'F', '', 'system:sysdept:add', 56, '0', '', '', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (230, '', '修改部门', '', '', '/0/2/56/230', 'F', '', 'system:sysdept:edit', 56, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (231, '', '删除部门', '', '', '/0/2/56/231', 'F', '', 'system:sysdept:remove', 56, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (232, '', '查询岗位', '', '', '/0/2/57/232', 'F', '', 'system:syspost:query', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (233, '', '新增岗位', '', '', '/0/2/57/233', 'F', '', 'system:syspost:add', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (234, '', '修改岗位', '', '', '/0/2/57/234', 'F', '', 'system:syspost:edit', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (235, '', '删除岗位', '', '', '/0/2/57/235', 'F', '', 'system:syspost:remove', 57, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (236, '', '字典查询', '', '', '/0/2/58/236', 'F', '', 'system:sysdicttype:query', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (237, '', '新增类型', '', '', '/0/2/58/237', 'F', '', 'system:sysdicttype:add', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (238, '', '修改类型', '', '', '/0/2/58/238', 'F', '', 'system:sysdicttype:edit', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (239, '', '删除类型', '', '', '/0/2/58/239', 'F', '', 'system:sysdicttype:remove', 58, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (240, '', '查询数据', '', '', '/0/2/59/240', 'F', '', 'system:sysdictdata:query', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (241, '', '新增数据', '', '', '/0/2/59/241', 'F', '', 'system:sysdictdata:add', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (242, '', '修改数据', '', '', '/0/2/59/242', 'F', '', 'system:sysdictdata:edit', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (243, '', '删除数据', '', '', '/0/2/59/243', 'F', '', 'system:sysdictdata:remove', 59, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (244, '', '查询参数', '', '', '/0/2/62/244', 'F', '', 'system:sysconfig:query', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (245, '', '新增参数', '', '', '/0/2/62/245', 'F', '', 'system:sysconfig:add', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (246, '', '修改参数', '', '', '/0/2/62/246', 'F', '', 'system:sysconfig:edit', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (247, '', '删除参数', '', '', '/0/2/62/247', 'F', '', 'system:sysconfig:remove', 62, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (248, '', '查询登录日志', '', '', '/0/2/211/212/248', 'F', '', 'system:sysloginlog:query', 212, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (249, '', '删除登录日志', '', '', '/0/2/211/212/249', 'F', '', 'system:sysloginlog:remove', 212, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (250, '', '查询操作日志', '', '', '/0/2/211/216/250', 'F', '', 'system:sysoperlog:query', 216, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (251, '', '删除操作日志', '', '', '/0/2/211/216/251', 'F', '', 'system:sysoperlog:remove', 216, '0', '', '', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (252, '', '获取登录用户信息', '', '/api/v1/getinfo', '/0/63/256/252', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (253, '', '角色数据权限', '', '/api/v1/roledatascope', '/0/63/201/253', 'A', 'PUT', '', 201, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (254, '', '部门树接口【数据权限】', '', '/api/v1/roleDeptTreeselect/:id', '/0/63/256/254', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (255, '', '部门树【用户列表】', '', '/api/v1/deptTree', '/0/63/256/255', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (256, '', '必开接口', '', '', '/0/63/256', 'M', 'GET', '', 63, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (257, '', '通过key获取参数', 'bug', '/api/v1/configKey/:id', '/0/63/256/257', 'A', 'GET', '', 256, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (258, '', '退出登录', '', '/api/v1/logout', '/0/63/256/258', 'A', 'POST', '', 256, '0', '', '', 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (259, '', '头像上传', '', '/api/v1/user/avatar', '/0/63/256/259', 'A', 'POST', '', 256, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (260, '', '修改密码', '', '/api/v1/user/pwd', '/0/63/256/260', 'A', 'PUT', '', 256, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (261, 'Gen', '代码生成', 'code', 'gen', '/0/60/261', 'C', '', '', 60, '0', '', '/tools/gen/index', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:18:12', NULL); +INSERT INTO `sys_menu` VALUES (262, 'EditTable', '数据表修改', 'build', 'editTable', '/0/60/262', 'C', '', '', 60, '0', '', '/tools/gen/editTable', 100, '1', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:18:22', NULL); +INSERT INTO `sys_menu` VALUES (263, '', '字典类型下拉框【生成功能】', '', '/api/v1/dict/typeoptionselect', '/0/63/256/263', 'A', 'GET', '', 256, '0', '', '', 0, '1', '1', '', 0, '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_menu` VALUES (264, 'Build', '表单构建', 'build', 'build', '/0/60/264', 'C', '', '', 60, '0', '', '/tools/build/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:18:05', NULL); +INSERT INTO `sys_menu` VALUES (265, '', '打赏', 'heart', 'http://doc.zhangwj.com/ferry-site/donate/', '/0/265', 'M', '', '', 0, '0', '', '', 5, '0', '1', '1', 0, '2020-04-12 16:39:04', '2020-04-12 16:58:59', NULL); +INSERT INTO `sys_menu` VALUES (266, '', '文档', 'documentation', 'http://doc.zhangwj.com', '/0/266', 'M', '', '', 0, '0', '', '', 4, '0', '1', '1', 0, '2020-04-12 16:58:41', '2020-04-12 16:58:52', NULL); +INSERT INTO `sys_post` VALUES (1, '首席执行官', 'CEO', 0, 0, '首席执行官', '1', '2020-03-08 23:11:15', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (2, '开发工程师', 'Development ', 2, 0, '开发工程师', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (3, '测试工程师', 'Test', 3, 0, '测试工程师', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (4, '产品经理', 'Product', 3, 0, '产品经理', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (5, '运维工程师', 'Opetion&Maintenance', 4, 0, '', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_post` VALUES (6, '首席运营官', 'COO', 1, 0, '', '1', '1', '2020-04-11 15:52:48', NULL, NULL); +INSERT INTO `sys_role` VALUES (1, '系统管理员', 0, 'admin', 1, NULL, '1', NULL, NULL, '0', '2020-04-11 15:52:48', '2020-04-12 22:46:03', NULL); +INSERT INTO `sys_role` VALUES (2, '普通角色', 0, 'common', 2, NULL, '1', NULL, NULL, '0', '2020-04-11 15:52:48', '2020-04-12 14:10:47', NULL); +INSERT INTO `sys_role` VALUES (3, '测试角色', 0, 'Tester', 3, '', '1', '', '', '0', '2020-04-11 15:52:48', '2020-04-12 14:10:52', NULL); +INSERT INTO `sys_role_menu` VALUES (1, 2, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 3, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 43, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 44, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 45, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 46, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 50, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 51, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 52, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 56, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 57, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 58, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 59, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 60, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 61, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 62, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 63, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 64, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 65, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 66, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 67, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 68, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 69, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 70, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 71, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 72, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 73, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 74, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 75, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 76, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 77, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 78, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 79, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 80, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 81, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 82, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 83, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 84, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 85, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 86, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 87, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 88, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 89, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 90, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 91, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 92, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 93, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 94, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 95, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 96, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 97, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 98, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 99, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 100, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 101, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 102, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 103, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 104, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 105, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 106, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 107, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 108, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 109, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 110, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 111, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 112, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 113, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 114, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 115, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 116, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 117, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 118, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 119, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 120, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 121, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 122, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 123, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 124, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 125, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 126, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 127, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 128, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 129, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 130, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 131, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 132, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 133, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 134, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 135, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 136, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 137, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 138, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 139, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 140, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 141, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 142, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 201, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 202, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 203, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 204, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 205, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 206, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 207, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 208, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 209, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 210, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 211, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 212, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 213, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 214, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 215, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 216, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 217, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 218, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 219, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 220, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 221, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 222, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 223, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 224, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 225, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 226, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 227, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 228, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 229, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 230, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 231, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 232, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 233, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 234, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 235, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 236, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 237, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 238, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 239, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 240, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 241, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 242, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 243, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 244, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 245, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 246, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 247, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 248, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 249, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 250, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 251, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 252, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 253, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 254, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 255, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 256, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 257, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 258, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 259, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 260, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 261, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 262, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 263, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 264, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 265, 'admin', NULL, NULL); +INSERT INTO `sys_role_menu` VALUES (1, 266, 'admin', NULL, NULL); +INSERT INTO `sys_tables` VALUES (23, 'sys_config', '参数表', 'SysConfig', 'crud', 'sysconfig', 'sysconfig', 'sysconfig', '参数表', 'wenjianzhang', 'config_id', 'ConfigId', 'configId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (24, 'sys_dept', 'SysDept', 'SysDept', 'crud', 'sysdept', 'sysdept', 'sysdept', 'SysDept', 'wenjianzhang', 'dept_id', 'DeptId', 'deptId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (25, 'sys_dict_data', 'SysDictData', 'SysDictData', 'crud', 'sysdictdata', 'sysdictdata', 'sysdictdata', 'SysDictData', 'wenjianzhang', 'dict_code', 'DictCode', 'dictCode', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (26, 'sys_dict_type', 'SysDictType', 'SysDictType', 'crud', 'sysdicttype', 'sysdicttype', 'sysdicttype', 'SysDictType', 'wenjianzhang', 'dict_id', 'DictId', 'dictId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (27, 'sys_loginlog', 'SysLoginlog', 'SysLoginlog', 'crud', 'sysloginlog', 'sysloginlog', 'sysloginlog', 'SysLoginlog', 'wenjianzhang', 'info_id', 'InfoId', 'infoId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (28, 'sys_menu', 'SysMenu', 'SysMenu', 'crud', 'sysmenu', 'sysmenu', 'sysmenu', 'SysMenu', 'wenjianzhang', 'menu_id', 'MenuId', 'menuId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (29, 'sys_post', 'SysPost', 'SysPost', 'crud', 'syspost', 'syspost', 'syspost', 'SysPost', 'wenjianzhang', 'post_id', 'PostId', 'postId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_tables` VALUES (30, 'sys_operlog', 'SysOperlog', 'SysOperlog', 'crud', 'sysoperlog', 'sysoperlog', 'sysoperlog', 'SysOperlog', 'wenjianzhang', 'oper_id', 'OperId', 'operId', '', '', '', '', '0', '1', '', '1', '1', 'is_del', '', '', NULL, NULL, NULL); +INSERT INTO `sys_user` VALUES (1, 'zhangwj', '13818888888', 1, NULL, '', '0', '1@qq.com', 1, 2, '1', '1', NULL, 0, '2019-11-10 14:05:55', '2020-03-15 19:16:02', NULL, 'admin', '$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2'); +INSERT INTO `sys_user` VALUES (2, 'zhangwj', '13211111111', 3, NULL, NULL, '0', 'q@q.com', 8, 2, '1', '1', NULL, 0, '2019-11-12 18:28:27', '2020-03-14 20:08:43', NULL, 'zhangwj', '$2a$10$CqMwHahA3cNrNv16CoSxmeD4XMPU.BiKHPEAeaG5oXMavOKrjInXi'); +INSERT INTO `sys_user` VALUES (3, '赵四', '13838385438', 2, '', '', '0', 'qq@qq.com', 7, 2, '1', '1', '', 0, '2020-04-07 22:17:38', '2020-04-07 22:17:50', NULL, 'zhaosi', '$2a$10$DejldFea5.hGZGC7/oVN9OLDrHAWgu9l29RDz9FomLnWnro4umYl2'); +INSERT INTO `sys_user` VALUES (4, '王五', '13535353535', 3, '', '', '2', 'qq@qq.com', 8, 2, '1', '1', '', 0, '2020-04-12 14:06:49', '2020-04-12 14:07:09', NULL, 'wangwu', '$2a$10$3.RT6rpXANXvvlibX6PzU.FGA2CvfDxd1UmJ2H5zTzF4sYocbvsTO'); +END TRANSACTION; diff --git a/database/initialize.go b/database/initialize.go new file mode 100644 index 0000000..a98228a --- /dev/null +++ b/database/initialize.go @@ -0,0 +1,11 @@ +package database + +import "ferry/tools/config" + +func Setup() { + dbType := config.DatabaseConfig.Dbtype + if dbType == "mysql" { + var db = new(Mysql) + db.Setup() + } +} diff --git a/database/interface.go b/database/interface.go new file mode 100644 index 0000000..d4ddcad --- /dev/null +++ b/database/interface.go @@ -0,0 +1,8 @@ +package database + +import "github.com/jinzhu/gorm" + +type Database interface { + Open(dbType string, conn string) (db *gorm.DB, err error) + GetConnect() string +} diff --git a/database/mysql.go b/database/mysql.go new file mode 100644 index 0000000..cc728e1 --- /dev/null +++ b/database/mysql.go @@ -0,0 +1,74 @@ +package database + +import ( + "bytes" + "ferry/global/orm" + "ferry/tools/config" + "strconv" + + _ "github.com/go-sql-driver/mysql" //加载mysql + "github.com/jinzhu/gorm" + log "github.com/sirupsen/logrus" +) + +var ( + DbType string + Host string + Port int + Name string + Username string + Password string +) + +func (e *Mysql) Setup() { + + var err error + var db Database + + db = new(Mysql) + orm.MysqlConn = db.GetConnect() + orm.Eloquent, err = db.Open(DbType, orm.MysqlConn) + + if err != nil { + log.Fatalf("%s connect error %v", DbType, err) + } else { + log.Printf("%s connect success!", DbType) + } + + if orm.Eloquent.Error != nil { + log.Fatalf("database error %v", orm.Eloquent.Error) + } + + orm.Eloquent.LogMode(true) +} + +type Mysql struct { +} + +func (e *Mysql) Open(dbType string, conn string) (db *gorm.DB, err error) { + return gorm.Open(dbType, conn) +} + +func (e *Mysql) GetConnect() string { + + DbType = config.DatabaseConfig.Dbtype + Host = config.DatabaseConfig.Host + Port = config.DatabaseConfig.Port + Name = config.DatabaseConfig.Name + Username = config.DatabaseConfig.Username + Password = config.DatabaseConfig.Password + + var conn bytes.Buffer + conn.WriteString(Username) + conn.WriteString(":") + conn.WriteString(Password) + conn.WriteString("@tcp(") + conn.WriteString(Host) + conn.WriteString(":") + conn.WriteString(strconv.Itoa(Port)) + conn.WriteString(")") + conn.WriteString("/") + conn.WriteString(Name) + conn.WriteString("?charset=utf8&parseTime=True&loc=Local&timeout=1000ms") + return conn.String() +} diff --git a/database/sqlite3.go b/database/sqlite3.go new file mode 100644 index 0000000..af3e968 --- /dev/null +++ b/database/sqlite3.go @@ -0,0 +1,15 @@ +// +build sqlite3 + +package database + +import ( + _ "github.com/jinzhu/gorm/dialects/sqlite" +) + +type SqlLite struct { +} + +func (*SqlLite) Open(dbType string, conn string) (db *gorm.DB, err error) { + eloquent, err := gorm.Open(dbType, conn) + return eloquent, err +} diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..75c3c68 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,3135 @@ +// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// This file was generated by swaggo/swag at +// 2020-05-25 21:14:52.220986 +0800 CST m=+0.139814492 + +package docs + +import ( + "bytes" + "encoding/json" + "strings" + + "github.com/alecthomas/template" + "github.com/swaggo/swag" +) + +var doc = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{.Description}}", + "title": "{{.Title}}", + "contact": {}, + "license": { + "name": "MIT", + "url": "https://github.com/wenjianzhang/ferry/blob/master/LICENSE.md" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/api/v1/config": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "配置" + ], + "summary": "修改配置", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysConfig" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/config/{configId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "配置编码", + "name": "configId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "配置" + ], + "summary": "删除配置", + "parameters": [ + { + "type": "integer", + "description": "configId", + "name": "configId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/configKey/{configKey}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/configList": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "配置列表数据", + "parameters": [ + { + "type": "string", + "description": "configKey", + "name": "configKey", + "in": "query" + }, + { + "type": "string", + "description": "configName", + "name": "configName", + "in": "query" + }, + { + "type": "string", + "description": "configType", + "name": "configType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/columns/page": { + "get": { + "description": "数据库表列分页列表 / database table column page list", + "tags": [ + "工具 / Tools" + ], + "summary": "分页列表数据 / page list data", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/tables/page": { + "get": { + "description": "数据库表分页列表 / database table page list", + "tags": [ + "工具 / Tools" + ], + "summary": "分页列表数据 / page list data", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dept": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "部门" + ], + "summary": "修改部门", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "部门" + ], + "summary": "添加部门", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dept/{deptId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "部门" + ], + "summary": "部门列表数据", + "parameters": [ + { + "type": "string", + "description": "deptId", + "name": "deptId", + "in": "path" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dept/{id}": { + "delete": { + "description": "删除数据", + "tags": [ + "部门" + ], + "summary": "删除部门", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/deptList": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "分页列表", + "tags": [ + "部门" + ], + "summary": "分页部门列表数据", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/data": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "修改字典数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "配置" + ], + "summary": "添加配置", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysConfig" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/data/list": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "字典数据列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/data/{dictCode}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "通过编码获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "字典编码", + "name": "dictCode", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "字典数据" + ], + "summary": "删除字典数据", + "parameters": [ + { + "type": "integer", + "description": "dictCode", + "name": "dictCode", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/databyType/{dictType}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "通过字典类型获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "dictType", + "name": "dictType", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/type": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "修改字典类型", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "添加字典类型", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/type/list": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "字典类型列表数据", + "parameters": [ + { + "type": "string", + "description": "dictName", + "name": "dictName", + "in": "query" + }, + { + "type": "string", + "description": "dictId", + "name": "dictId", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/type/{dictId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "通过字典id获取字典类型", + "parameters": [ + { + "type": "integer", + "description": "字典类型编码", + "name": "dictId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "字典类型" + ], + "summary": "删除字典类型", + "parameters": [ + { + "type": "integer", + "description": "dictId", + "name": "dictId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginlog": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "登录日志" + ], + "summary": "修改登录日志", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.LoginLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "登录日志" + ], + "summary": "添加登录日志", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.LoginLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginlog/{infoId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "通过编码获取登录日志", + "parameters": [ + { + "type": "integer", + "description": "infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "登录日志" + ], + "summary": "批量删除登录日志", + "parameters": [ + { + "type": "string", + "description": "以逗号(,)分割的infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginloglist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "登录日志列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/menu": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu列表数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "创建菜单", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Path", + "name": "Path", + "in": "formData" + }, + { + "type": "string", + "description": "Action", + "name": "Action", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Permission", + "name": "Permission", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "ParentId", + "name": "ParentId", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "IsDel", + "name": "IsDel", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menu/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "修改菜单", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Menu" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "菜单" + ], + "summary": "删除菜单", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menuTreeselect": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "获取菜单树", + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menuids/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "获取角色对应的菜单id数组", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menulist": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu列表数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menurole": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "根据角色名称获取菜单列表数据(左菜单使用)", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operlog": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "操作日志" + ], + "summary": "添加操作日志", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysOperLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operlog/{infoId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "通过编码获取登录日志", + "parameters": [ + { + "type": "integer", + "description": "infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/operlog/{operId}": { + "delete": { + "description": "删除数据", + "tags": [ + "操作日志" + ], + "summary": "批量删除操作日志", + "parameters": [ + { + "type": "string", + "description": "以逗号(,)分割的operId", + "name": "operId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operloglist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "登录日志列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/post": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "职位" + ], + "summary": "职位列表数据", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "职位" + ], + "summary": "添加职位", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Post" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/post/": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "职位" + ], + "summary": "修改职位", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/post/{postId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "postId", + "name": "postId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "职位" + ], + "summary": "删除职位", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/role": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "角色/Role" + ], + "summary": "获取Role数据", + "parameters": [ + { + "type": "string", + "description": "roleId", + "name": "roleId", + "in": "path" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, + "put": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "修改用户角色", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/role/{roleId}": { + "delete": { + "description": "删除数据", + "tags": [ + "角色/Role" + ], + "summary": "删除用户角色", + "parameters": [ + { + "type": "integer", + "description": "roleId", + "name": "roleId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/rolelist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "Get JSON", + "tags": [ + "角色/Role" + ], + "summary": "角色列表数据", + "parameters": [ + { + "type": "string", + "description": "roleName", + "name": "roleName", + "in": "query" + }, + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "roleKey", + "name": "roleKey", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/rolemenu": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "角色菜单" + ], + "summary": "RoleMenu列表数据", + "parameters": [ + { + "type": "string", + "description": "RoleId", + "name": "RoleId", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/rolemenu/{id}": { + "delete": { + "description": "删除数据", + "tags": [ + "角色菜单" + ], + "summary": "删除用户菜单数据", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "menu_id", + "name": "menu_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "修改表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "修改表结构", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "添加表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "添加表结构", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tables", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info/{tableId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "工具 - 生成表" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除表结构", + "tags": [ + "工具 - 生成表" + ], + "summary": "删除表结构", + "parameters": [ + { + "type": "integer", + "description": "tableId", + "name": "tableId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/page": { + "get": { + "description": "生成表分页列表", + "tags": [ + "工具 - 生成表" + ], + "summary": "分页列表数据", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/sysUser": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "获取用户角色和职位", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "post": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "创建用户", + "parameters": [ + { + "description": "用户数据", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysUser" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sysUser/{userId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "获取用户", + "parameters": [ + { + "type": "integer", + "description": "用户编码", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/sysUserList": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "列表数据", + "parameters": [ + { + "type": "string", + "description": "username", + "name": "username", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sysuser/{userId}": { + "put": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "修改用户数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysUser" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "用户" + ], + "summary": "删除用户数据", + "parameters": [ + { + "type": "integer", + "description": "userId", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/user/profile": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "个人中心" + ], + "summary": "获取当前登录用户", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/user/profileAvatar": { + "post": { + "description": "获取JSON", + "consumes": [ + "multipart/form-data" + ], + "tags": [ + "用户" + ], + "summary": "修改头像", + "parameters": [ + { + "type": "file", + "description": "file", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/login": { + "post": { + "description": "获取token", + "consumes": [ + "application/json" + ], + "summary": "登陆", + "parameters": [ + { + "description": "Add account", + "name": "username", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Login" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"expire\": \"2019-08-07T12:45:48+08:00\", \"token\": \".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A\" }", + "schema": { + "type": "string" + } + } + } + } + }, + "/logout": { + "post": { + "security": [ + { + "": [] + } + ], + "description": "获取token", + "consumes": [ + "application/json" + ], + "summary": "退出登录", + "responses": { + "200": { + "description": "{\"code\": 200, \"msg\": \"成功退出系统\" }", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/cpu": { + "get": { + "description": "CPU 使用量 DiskCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "CPU 使用量", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/disk": { + "get": { + "description": "服务器硬盘使用量 DiskCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "服务器硬盘使用量", + "responses": { + "200": { + "description": "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%", + "schema": { + "type": "string" + } + }, + "429": { + "description": "WARNING", + "schema": { + "type": "string" + } + }, + "500": { + "description": "CRITICAL", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/health": { + "get": { + "description": "健康状况", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "健康状况 HealthCheck shows OK as the ping-pong result.", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/os": { + "get": { + "description": "Os", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "OS", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/ram": { + "get": { + "description": "内存使用量 RAMCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "内存使用量", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + } + }, + "definitions": { + "app.Response": { + "type": "object", + "properties": { + "code": { + "description": "代码", + "type": "integer", + "example": 200 + }, + "data": { + "description": "数据集", + "type": "object" + }, + "msg": { + "description": "消息", + "type": "string" + } + } + }, + "models.Dept": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Dept" + } + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "deptName": { + "description": "部门名称", + "type": "string" + }, + "deptPath": { + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "leader": { + "description": "负责人", + "type": "string" + }, + "params": { + "type": "string" + }, + "parentId": { + "description": "上级部门", + "type": "integer" + }, + "phone": { + "description": "手机", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.DictType": { + "type": "object", + "properties": { + "createBy": { + "description": "创建者", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "dictId": { + "type": "integer" + }, + "dictName": { + "description": "字典名称", + "type": "string" + }, + "dictType": { + "description": "字典类型", + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.Login": { + "type": "object", + "required": [ + "code", + "password", + "username", + "uuid" + ], + "properties": { + "code": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "models.LoginLog": { + "type": "object", + "properties": { + "browser": { + "description": "浏览器", + "type": "string" + }, + "createBy": { + "description": "创建人", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "description": "数据", + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "infoId": { + "description": "主键", + "type": "integer" + }, + "ipaddr": { + "description": "ip地址", + "type": "string" + }, + "loginLocation": { + "description": "归属地", + "type": "string" + }, + "loginTime": { + "description": "登录时间", + "type": "string" + }, + "msg": { + "type": "string" + }, + "os": { + "description": "系统", + "type": "string" + }, + "params": { + "type": "string" + }, + "platform": { + "description": "固件", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "username": { + "description": "用户名", + "type": "string" + } + } + }, + "models.Menu": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "breadcrumb": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Menu" + } + }, + "component": { + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "isFrame": { + "type": "string" + }, + "is_select": { + "type": "boolean" + }, + "menuId": { + "type": "integer" + }, + "menuName": { + "type": "string" + }, + "menuType": { + "type": "string" + }, + "noCache": { + "type": "boolean" + }, + "params": { + "type": "string" + }, + "parentId": { + "type": "integer" + }, + "path": { + "type": "string" + }, + "paths": { + "type": "string" + }, + "permission": { + "type": "string" + }, + "roleId": { + "type": "integer" + }, + "sort": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "visible": { + "type": "string" + } + } + }, + "models.Post": { + "type": "object", + "properties": { + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "postCode": { + "description": "岗位代码", + "type": "string" + }, + "postId": { + "description": "岗位编号", + "type": "integer" + }, + "postName": { + "description": "岗位名称", + "type": "string" + }, + "remark": { + "description": "描述", + "type": "string" + }, + "sort": { + "description": "岗位排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysConfig": { + "type": "object", + "properties": { + "configId": { + "description": "编码", + "type": "integer" + }, + "configKey": { + "description": "参数键名", + "type": "string" + }, + "configName": { + "description": "参数名称", + "type": "string" + }, + "configType": { + "description": "是否系统内置", + "type": "string" + }, + "configValue": { + "description": "参数键值", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysOperLog": { + "type": "object", + "properties": { + "businessType": { + "description": "操作类型", + "type": "string" + }, + "businessTypes": { + "type": "string" + }, + "createBy": { + "description": "创建人", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "description": "数据", + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptName": { + "description": "部门名称", + "type": "string" + }, + "jsonResult": { + "description": "返回数据", + "type": "string" + }, + "latencyime": { + "description": "耗时", + "type": "string" + }, + "method": { + "description": "函数", + "type": "string" + }, + "operId": { + "description": "日志编码", + "type": "integer" + }, + "operIp": { + "description": "客户端ip", + "type": "string" + }, + "operLocation": { + "description": "访问位置", + "type": "string" + }, + "operName": { + "description": "操作者", + "type": "string" + }, + "operParam": { + "description": "请求参数", + "type": "string" + }, + "operTime": { + "description": "操作时间", + "type": "string" + }, + "operUrl": { + "description": "访问地址", + "type": "string" + }, + "operatorType": { + "description": "操作类型", + "type": "string" + }, + "params": { + "description": "参数", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "requestMethod": { + "description": "请求方式", + "type": "string" + }, + "status": { + "description": "操作状态", + "type": "string" + }, + "title": { + "description": "操作模块", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userAgent": { + "description": "ua", + "type": "string" + } + } + }, + "models.SysRole": { + "type": "object", + "properties": { + "admin": { + "type": "boolean" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptIds": { + "type": "array", + "items": { + "type": "integer" + } + }, + "flag": { + "type": "string" + }, + "menuIds": { + "type": "array", + "items": { + "type": "integer" + } + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "roleId": { + "description": "角色编码", + "type": "integer" + }, + "roleKey": { + "description": "角色代码", + "type": "string" + }, + "roleName": { + "description": "角色名称", + "type": "string" + }, + "roleSort": { + "description": "角色排序", + "type": "integer" + }, + "status": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysUser": { + "type": "object", + "properties": { + "avatar": { + "description": "头像", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "nickName": { + "description": "昵称", + "type": "string" + }, + "params": { + "type": "string" + }, + "password": { + "description": "密码", + "type": "string" + }, + "phone": { + "description": "手机号", + "type": "string" + }, + "postId": { + "description": "职位编码", + "type": "integer" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "roleId": { + "description": "角色编码", + "type": "integer" + }, + "salt": { + "description": "盐", + "type": "string" + }, + "sex": { + "description": "性别", + "type": "string" + }, + "status": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "description": "编码", + "type": "integer" + }, + "username": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "Bearer": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +}` + +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = swaggerInfo{ + Version: "0.0.1", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "ferry API", + Description: "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加qq群: 74520518 进入技术交流群 请备注,谢谢!", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() +} + +func init() { + swag.Register(swag.Name, &s{}) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..814336b --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,3070 @@ +{ + "swagger": "2.0", + "info": { + "description": "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加qq群: 74520518 进入技术交流群 请备注,谢谢!", + "title": "ferry API", + "contact": {}, + "license": { + "name": "MIT", + "url": "https://github.com/wenjianzhang/ferry/blob/master/LICENSE.md" + }, + "version": "0.0.1" + }, + "paths": { + "/api/v1/config": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "配置" + ], + "summary": "修改配置", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysConfig" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/config/{configId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "配置编码", + "name": "configId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "配置" + ], + "summary": "删除配置", + "parameters": [ + { + "type": "integer", + "description": "configId", + "name": "configId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/configKey/{configKey}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/configList": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "配置" + ], + "summary": "配置列表数据", + "parameters": [ + { + "type": "string", + "description": "configKey", + "name": "configKey", + "in": "query" + }, + { + "type": "string", + "description": "configName", + "name": "configName", + "in": "query" + }, + { + "type": "string", + "description": "configType", + "name": "configType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/columns/page": { + "get": { + "description": "数据库表列分页列表 / database table column page list", + "tags": [ + "工具 / Tools" + ], + "summary": "分页列表数据 / page list data", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/tables/page": { + "get": { + "description": "数据库表分页列表 / database table page list", + "tags": [ + "工具 / Tools" + ], + "summary": "分页列表数据 / page list data", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dept": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "部门" + ], + "summary": "修改部门", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "部门" + ], + "summary": "添加部门", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dept/{deptId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "部门" + ], + "summary": "部门列表数据", + "parameters": [ + { + "type": "string", + "description": "deptId", + "name": "deptId", + "in": "path" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dept/{id}": { + "delete": { + "description": "删除数据", + "tags": [ + "部门" + ], + "summary": "删除部门", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/deptList": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "分页列表", + "tags": [ + "部门" + ], + "summary": "分页部门列表数据", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/data": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "修改字典数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "配置" + ], + "summary": "添加配置", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysConfig" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/data/list": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "字典数据列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/data/{dictCode}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "通过编码获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "字典编码", + "name": "dictCode", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "字典数据" + ], + "summary": "删除字典数据", + "parameters": [ + { + "type": "integer", + "description": "dictCode", + "name": "dictCode", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/databyType/{dictType}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "通过字典类型获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "dictType", + "name": "dictType", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/type": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "修改字典类型", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "添加字典类型", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.DictType" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/type/list": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "字典类型列表数据", + "parameters": [ + { + "type": "string", + "description": "dictName", + "name": "dictName", + "in": "query" + }, + { + "type": "string", + "description": "dictId", + "name": "dictId", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/dict/type/{dictId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "通过字典id获取字典类型", + "parameters": [ + { + "type": "integer", + "description": "字典类型编码", + "name": "dictId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "字典类型" + ], + "summary": "删除字典类型", + "parameters": [ + { + "type": "integer", + "description": "dictId", + "name": "dictId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginlog": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "登录日志" + ], + "summary": "修改登录日志", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.LoginLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "登录日志" + ], + "summary": "添加登录日志", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.LoginLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginlog/{infoId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "通过编码获取登录日志", + "parameters": [ + { + "type": "integer", + "description": "infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "登录日志" + ], + "summary": "批量删除登录日志", + "parameters": [ + { + "type": "string", + "description": "以逗号(,)分割的infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/loginloglist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "登录日志列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/menu": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu列表数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "创建菜单", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Path", + "name": "Path", + "in": "formData" + }, + { + "type": "string", + "description": "Action", + "name": "Action", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Permission", + "name": "Permission", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "ParentId", + "name": "ParentId", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "IsDel", + "name": "IsDel", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menu/{id}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "修改菜单", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Menu" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "菜单" + ], + "summary": "删除菜单", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menuTreeselect": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "tags": [ + "菜单" + ], + "summary": "获取菜单树", + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menuids/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "获取角色对应的菜单id数组", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menulist": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu列表数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/menurole": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "根据角色名称获取菜单列表数据(左菜单使用)", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operlog": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "操作日志" + ], + "summary": "添加操作日志", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysOperLog" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operlog/{infoId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "通过编码获取登录日志", + "parameters": [ + { + "type": "integer", + "description": "infoId", + "name": "infoId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/operlog/{operId}": { + "delete": { + "description": "删除数据", + "tags": [ + "操作日志" + ], + "summary": "批量删除操作日志", + "parameters": [ + { + "type": "string", + "description": "以逗号(,)分割的operId", + "name": "operId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/operloglist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "登录日志" + ], + "summary": "登录日志列表", + "parameters": [ + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "dictCode", + "name": "dictCode", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/post": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "职位" + ], + "summary": "职位列表数据", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "职位" + ], + "summary": "添加职位", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Post" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/post/": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "职位" + ], + "summary": "修改职位", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/post/{postId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典数据" + ], + "summary": "获取字典数据", + "parameters": [ + { + "type": "integer", + "description": "postId", + "name": "postId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "职位" + ], + "summary": "删除职位", + "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/role": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "角色/Role" + ], + "summary": "获取Role数据", + "parameters": [ + { + "type": "string", + "description": "roleId", + "name": "roleId", + "in": "path" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, + "put": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "修改用户角色", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/role/{roleId}": { + "delete": { + "description": "删除数据", + "tags": [ + "角色/Role" + ], + "summary": "删除用户角色", + "parameters": [ + { + "type": "integer", + "description": "roleId", + "name": "roleId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/rolelist": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "Get JSON", + "tags": [ + "角色/Role" + ], + "summary": "角色列表数据", + "parameters": [ + { + "type": "string", + "description": "roleName", + "name": "roleName", + "in": "query" + }, + { + "type": "string", + "description": "status", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "roleKey", + "name": "roleKey", + "in": "query" + }, + { + "type": "integer", + "description": "页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/rolemenu": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "角色菜单" + ], + "summary": "RoleMenu列表数据", + "parameters": [ + { + "type": "string", + "description": "RoleId", + "name": "RoleId", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/rolemenu/{id}": { + "delete": { + "description": "删除数据", + "tags": [ + "角色菜单" + ], + "summary": "删除用户菜单数据", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "menu_id", + "name": "menu_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "修改表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "修改表结构", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "添加表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "添加表结构", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tables", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info/{tableId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "工具 - 生成表" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除表结构", + "tags": [ + "工具 - 生成表" + ], + "summary": "删除表结构", + "parameters": [ + { + "type": "integer", + "description": "tableId", + "name": "tableId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/page": { + "get": { + "description": "生成表分页列表", + "tags": [ + "工具 - 生成表" + ], + "summary": "分页列表数据", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tableName", + "in": "query" + }, + { + "type": "integer", + "description": "pageSize / 页条数", + "name": "pageSize", + "in": "query" + }, + { + "type": "integer", + "description": "pageIndex / 页码", + "name": "pageIndex", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/sysUser": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "获取用户角色和职位", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "post": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "创建用户", + "parameters": [ + { + "description": "用户数据", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysUser" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sysUser/{userId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "获取用户", + "parameters": [ + { + "type": "integer", + "description": "用户编码", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/sysUserList": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "用户" + ], + "summary": "列表数据", + "parameters": [ + { + "type": "string", + "description": "username", + "name": "username", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sysuser/{userId}": { + "put": { + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "修改用户数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.SysUser" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"修改失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "description": "删除数据", + "tags": [ + "用户" + ], + "summary": "删除用户数据", + "parameters": [ + { + "type": "integer", + "description": "userId", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/user/profile": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "个人中心" + ], + "summary": "获取当前登录用户", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/user/profileAvatar": { + "post": { + "description": "获取JSON", + "consumes": [ + "multipart/form-data" + ], + "tags": [ + "用户" + ], + "summary": "修改头像", + "parameters": [ + { + "type": "file", + "description": "file", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/login": { + "post": { + "description": "获取token", + "consumes": [ + "application/json" + ], + "summary": "登陆", + "parameters": [ + { + "description": "Add account", + "name": "username", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Login" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"expire\": \"2019-08-07T12:45:48+08:00\", \"token\": \".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A\" }", + "schema": { + "type": "string" + } + } + } + } + }, + "/logout": { + "post": { + "security": [ + { + "": [] + } + ], + "description": "获取token", + "consumes": [ + "application/json" + ], + "summary": "退出登录", + "responses": { + "200": { + "description": "{\"code\": 200, \"msg\": \"成功退出系统\" }", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/cpu": { + "get": { + "description": "CPU 使用量 DiskCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "CPU 使用量", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/disk": { + "get": { + "description": "服务器硬盘使用量 DiskCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "服务器硬盘使用量", + "responses": { + "200": { + "description": "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%", + "schema": { + "type": "string" + } + }, + "429": { + "description": "WARNING", + "schema": { + "type": "string" + } + }, + "500": { + "description": "CRITICAL", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/health": { + "get": { + "description": "健康状况", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "健康状况 HealthCheck shows OK as the ping-pong result.", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/os": { + "get": { + "description": "Os", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "OS", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, + "/sd/ram": { + "get": { + "description": "内存使用量 RAMCheck checks the disk usage.", + "consumes": [ + "text/html" + ], + "produces": [ + "text/html" + ], + "summary": "内存使用量", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + } + }, + "definitions": { + "app.Response": { + "type": "object", + "properties": { + "code": { + "description": "代码", + "type": "integer", + "example": 200 + }, + "data": { + "description": "数据集", + "type": "object" + }, + "msg": { + "description": "消息", + "type": "string" + } + } + }, + "models.Dept": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Dept" + } + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "deptName": { + "description": "部门名称", + "type": "string" + }, + "deptPath": { + "type": "string" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "leader": { + "description": "负责人", + "type": "string" + }, + "params": { + "type": "string" + }, + "parentId": { + "description": "上级部门", + "type": "integer" + }, + "phone": { + "description": "手机", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.DictType": { + "type": "object", + "properties": { + "createBy": { + "description": "创建者", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "dictId": { + "type": "integer" + }, + "dictName": { + "description": "字典名称", + "type": "string" + }, + "dictType": { + "description": "字典类型", + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.Login": { + "type": "object", + "required": [ + "code", + "password", + "username", + "uuid" + ], + "properties": { + "code": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "models.LoginLog": { + "type": "object", + "properties": { + "browser": { + "description": "浏览器", + "type": "string" + }, + "createBy": { + "description": "创建人", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "description": "数据", + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "infoId": { + "description": "主键", + "type": "integer" + }, + "ipaddr": { + "description": "ip地址", + "type": "string" + }, + "loginLocation": { + "description": "归属地", + "type": "string" + }, + "loginTime": { + "description": "登录时间", + "type": "string" + }, + "msg": { + "type": "string" + }, + "os": { + "description": "系统", + "type": "string" + }, + "params": { + "type": "string" + }, + "platform": { + "description": "固件", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "username": { + "description": "用户名", + "type": "string" + } + } + }, + "models.Menu": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "breadcrumb": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Menu" + } + }, + "component": { + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "isFrame": { + "type": "string" + }, + "is_select": { + "type": "boolean" + }, + "menuId": { + "type": "integer" + }, + "menuName": { + "type": "string" + }, + "menuType": { + "type": "string" + }, + "noCache": { + "type": "boolean" + }, + "params": { + "type": "string" + }, + "parentId": { + "type": "integer" + }, + "path": { + "type": "string" + }, + "paths": { + "type": "string" + }, + "permission": { + "type": "string" + }, + "roleId": { + "type": "integer" + }, + "sort": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "visible": { + "type": "string" + } + } + }, + "models.Post": { + "type": "object", + "properties": { + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "postCode": { + "description": "岗位代码", + "type": "string" + }, + "postId": { + "description": "岗位编号", + "type": "integer" + }, + "postName": { + "description": "岗位名称", + "type": "string" + }, + "remark": { + "description": "描述", + "type": "string" + }, + "sort": { + "description": "岗位排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysConfig": { + "type": "object", + "properties": { + "configId": { + "description": "编码", + "type": "integer" + }, + "configKey": { + "description": "参数键名", + "type": "string" + }, + "configName": { + "description": "参数名称", + "type": "string" + }, + "configType": { + "description": "是否系统内置", + "type": "string" + }, + "configValue": { + "description": "参数键值", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysOperLog": { + "type": "object", + "properties": { + "businessType": { + "description": "操作类型", + "type": "string" + }, + "businessTypes": { + "type": "string" + }, + "createBy": { + "description": "创建人", + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "description": "数据", + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptName": { + "description": "部门名称", + "type": "string" + }, + "jsonResult": { + "description": "返回数据", + "type": "string" + }, + "latencyime": { + "description": "耗时", + "type": "string" + }, + "method": { + "description": "函数", + "type": "string" + }, + "operId": { + "description": "日志编码", + "type": "integer" + }, + "operIp": { + "description": "客户端ip", + "type": "string" + }, + "operLocation": { + "description": "访问位置", + "type": "string" + }, + "operName": { + "description": "操作者", + "type": "string" + }, + "operParam": { + "description": "请求参数", + "type": "string" + }, + "operTime": { + "description": "操作时间", + "type": "string" + }, + "operUrl": { + "description": "访问地址", + "type": "string" + }, + "operatorType": { + "description": "操作类型", + "type": "string" + }, + "params": { + "description": "参数", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "requestMethod": { + "description": "请求方式", + "type": "string" + }, + "status": { + "description": "操作状态", + "type": "string" + }, + "title": { + "description": "操作模块", + "type": "string" + }, + "updateBy": { + "description": "更新者", + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userAgent": { + "description": "ua", + "type": "string" + } + } + }, + "models.SysRole": { + "type": "object", + "properties": { + "admin": { + "type": "boolean" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptIds": { + "type": "array", + "items": { + "type": "integer" + } + }, + "flag": { + "type": "string" + }, + "menuIds": { + "type": "array", + "items": { + "type": "integer" + } + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "roleId": { + "description": "角色编码", + "type": "integer" + }, + "roleKey": { + "description": "角色代码", + "type": "string" + }, + "roleName": { + "description": "角色名称", + "type": "string" + }, + "roleSort": { + "description": "角色排序", + "type": "integer" + }, + "status": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "models.SysUser": { + "type": "object", + "properties": { + "avatar": { + "description": "头像", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "email": { + "description": "邮箱", + "type": "string" + }, + "nickName": { + "description": "昵称", + "type": "string" + }, + "params": { + "type": "string" + }, + "password": { + "description": "密码", + "type": "string" + }, + "phone": { + "description": "手机号", + "type": "string" + }, + "postId": { + "description": "职位编码", + "type": "integer" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "roleId": { + "description": "角色编码", + "type": "integer" + }, + "salt": { + "description": "盐", + "type": "string" + }, + "sex": { + "description": "性别", + "type": "string" + }, + "status": { + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "description": "编码", + "type": "integer" + }, + "username": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "Bearer": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..057b9f6 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,1992 @@ +definitions: + app.Response: + properties: + code: + description: 代码 + example: 200 + type: integer + data: + description: 数据集 + type: object + msg: + description: 消息 + type: string + type: object + models.Dept: + properties: + children: + items: + $ref: '#/definitions/models.Dept' + type: array + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + deptId: + description: 部门编码 + type: integer + deptName: + description: 部门名称 + type: string + deptPath: + type: string + email: + description: 邮箱 + type: string + leader: + description: 负责人 + type: string + params: + type: string + parentId: + description: 上级部门 + type: integer + phone: + description: 手机 + type: string + sort: + description: 排序 + type: integer + status: + description: 状态 + type: string + updateBy: + type: string + updatedAt: + type: string + type: object + models.DictType: + properties: + createBy: + description: 创建者 + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + dictId: + type: integer + dictName: + description: 字典名称 + type: string + dictType: + description: 字典类型 + type: string + params: + type: string + remark: + description: 备注 + type: string + status: + description: 状态 + type: string + updateBy: + description: 更新者 + type: string + updatedAt: + type: string + type: object + models.Login: + properties: + code: + type: string + password: + type: string + username: + type: string + uuid: + type: string + required: + - code + - password + - username + - uuid + type: object + models.LoginLog: + properties: + browser: + description: 浏览器 + type: string + createBy: + description: 创建人 + type: string + createdAt: + type: string + dataScope: + description: 数据 + type: string + deletedAt: + type: string + infoId: + description: 主键 + type: integer + ipaddr: + description: ip地址 + type: string + loginLocation: + description: 归属地 + type: string + loginTime: + description: 登录时间 + type: string + msg: + type: string + os: + description: 系统 + type: string + params: + type: string + platform: + description: 固件 + type: string + remark: + description: 备注 + type: string + status: + description: 状态 + type: string + updateBy: + description: 更新者 + type: string + updatedAt: + type: string + username: + description: 用户名 + type: string + type: object + models.Menu: + properties: + action: + type: string + breadcrumb: + type: string + children: + items: + $ref: '#/definitions/models.Menu' + type: array + component: + type: string + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + icon: + type: string + is_select: + type: boolean + isFrame: + type: string + menuId: + type: integer + menuName: + type: string + menuType: + type: string + noCache: + type: boolean + params: + type: string + parentId: + type: integer + path: + type: string + paths: + type: string + permission: + type: string + roleId: + type: integer + sort: + type: integer + title: + type: string + updateBy: + type: string + updatedAt: + type: string + visible: + type: string + type: object + models.Post: + properties: + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + params: + type: string + postCode: + description: 岗位代码 + type: string + postId: + description: 岗位编号 + type: integer + postName: + description: 岗位名称 + type: string + remark: + description: 描述 + type: string + sort: + description: 岗位排序 + type: integer + status: + description: 状态 + type: string + updateBy: + type: string + updatedAt: + type: string + type: object + models.SysConfig: + properties: + configId: + description: 编码 + type: integer + configKey: + description: 参数键名 + type: string + configName: + description: 参数名称 + type: string + configType: + description: 是否系统内置 + type: string + configValue: + description: 参数键值 + type: string + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + params: + type: string + remark: + description: 备注 + type: string + updateBy: + type: string + updatedAt: + type: string + type: object + models.SysOperLog: + properties: + businessType: + description: 操作类型 + type: string + businessTypes: + type: string + createBy: + description: 创建人 + type: string + createdAt: + type: string + dataScope: + description: 数据 + type: string + deletedAt: + type: string + deptName: + description: 部门名称 + type: string + jsonResult: + description: 返回数据 + type: string + latencyime: + description: 耗时 + type: string + method: + description: 函数 + type: string + operId: + description: 日志编码 + type: integer + operIp: + description: 客户端ip + type: string + operLocation: + description: 访问位置 + type: string + operName: + description: 操作者 + type: string + operParam: + description: 请求参数 + type: string + operTime: + description: 操作时间 + type: string + operUrl: + description: 访问地址 + type: string + operatorType: + description: 操作类型 + type: string + params: + description: 参数 + type: string + remark: + description: 备注 + type: string + requestMethod: + description: 请求方式 + type: string + status: + description: 操作状态 + type: string + title: + description: 操作模块 + type: string + updateBy: + description: 更新者 + type: string + updatedAt: + type: string + userAgent: + description: ua + type: string + type: object + models.SysRole: + properties: + admin: + type: boolean + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + deptIds: + items: + type: integer + type: array + flag: + type: string + menuIds: + items: + type: integer + type: array + params: + type: string + remark: + description: 备注 + type: string + roleId: + description: 角色编码 + type: integer + roleKey: + description: 角色代码 + type: string + roleName: + description: 角色名称 + type: string + roleSort: + description: 角色排序 + type: integer + status: + type: string + updateBy: + type: string + updatedAt: + type: string + type: object + models.SysUser: + properties: + avatar: + description: 头像 + type: string + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + deptId: + description: 部门编码 + type: integer + email: + description: 邮箱 + type: string + nickName: + description: 昵称 + type: string + params: + type: string + password: + description: 密码 + type: string + phone: + description: 手机号 + type: string + postId: + description: 职位编码 + type: integer + remark: + description: 备注 + type: string + roleId: + description: 角色编码 + type: integer + salt: + description: 盐 + type: string + sex: + description: 性别 + type: string + status: + type: string + updateBy: + type: string + updatedAt: + type: string + userId: + description: 编码 + type: integer + username: + type: string + type: object +info: + contact: {} + description: |- + 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档 + 添加qq群: 74520518 进入技术交流群 请备注,谢谢! + license: + name: MIT + url: https://github.com/wenjianzhang/ferry/blob/master/LICENSE.md + title: ferry API + version: 0.0.1 +paths: + /api/v1/config: + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysConfig' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改配置 + tags: + - 配置 + /api/v1/config/{configId}: + delete: + description: 删除数据 + parameters: + - description: configId + in: path + name: configId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除配置 + tags: + - 配置 + get: + description: 获取JSON + parameters: + - description: 配置编码 + in: path + name: configId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取配置 + tags: + - 配置 + /api/v1/configKey/{configKey}: + get: + description: 获取JSON + parameters: + - description: configKey + in: path + name: configKey + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取配置 + tags: + - 配置 + /api/v1/configList: + get: + description: 获取JSON + parameters: + - description: configKey + in: query + name: configKey + type: string + - description: configName + in: query + name: configName + type: string + - description: configType + in: query + name: configType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 配置列表数据 + tags: + - 配置 + /api/v1/db/columns/page: + get: + description: 数据库表列分页列表 / database table column page list + parameters: + - description: tableName / 数据表名称 + in: query + name: tableName + type: string + - description: pageSize / 页条数 + in: query + name: pageSize + type: integer + - description: pageIndex / 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + summary: 分页列表数据 / page list data + tags: + - 工具 / Tools + /api/v1/db/tables/page: + get: + description: 数据库表分页列表 / database table page list + parameters: + - description: tableName / 数据表名称 + in: query + name: tableName + type: string + - description: pageSize / 页条数 + in: query + name: pageSize + type: integer + - description: pageIndex / 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + summary: 分页列表数据 / page list data + tags: + - 工具 / Tools + /api/v1/dept: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Dept' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加部门 + tags: + - 部门 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: id + in: path + name: id + required: true + type: integer + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Dept' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改部门 + tags: + - 部门 + /api/v1/dept/{deptId}: + get: + description: 获取JSON + parameters: + - description: deptId + in: path + name: deptId + type: string + - description: position + in: query + name: position + type: string + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 部门列表数据 + tags: + - 部门 + /api/v1/dept/{id}: + delete: + description: 删除数据 + parameters: + - description: id + in: path + name: id + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除部门 + tags: + - 部门 + /api/v1/deptList: + get: + description: 分页列表 + parameters: + - description: name + in: query + name: name + type: string + - description: id + in: query + name: id + type: string + - description: position + in: query + name: position + type: string + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 分页部门列表数据 + tags: + - 部门 + /api/v1/dict/data: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysConfig' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加配置 + tags: + - 配置 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.DictType' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改字典数据 + tags: + - 字典数据 + /api/v1/dict/data/{dictCode}: + delete: + description: 删除数据 + parameters: + - description: dictCode + in: path + name: dictCode + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除字典数据 + tags: + - 字典数据 + get: + description: 获取JSON + parameters: + - description: 字典编码 + in: path + name: dictCode + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 通过编码获取字典数据 + tags: + - 字典数据 + /api/v1/dict/data/list: + get: + description: 获取JSON + parameters: + - description: status + in: query + name: status + type: string + - description: dictCode + in: query + name: dictCode + type: string + - description: dictType + in: query + name: dictType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 字典数据列表 + tags: + - 字典数据 + /api/v1/dict/databyType/{dictType}: + get: + description: 获取JSON + parameters: + - description: dictType + in: path + name: dictType + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 通过字典类型获取字典数据 + tags: + - 字典数据 + /api/v1/dict/type: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.DictType' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加字典类型 + tags: + - 字典类型 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.DictType' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改字典类型 + tags: + - 字典类型 + /api/v1/dict/type/{dictId}: + delete: + description: 删除数据 + parameters: + - description: dictId + in: path + name: dictId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除字典类型 + tags: + - 字典类型 + get: + description: 获取JSON + parameters: + - description: 字典类型编码 + in: path + name: dictId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 通过字典id获取字典类型 + tags: + - 字典类型 + /api/v1/dict/type/list: + get: + description: 获取JSON + parameters: + - description: dictName + in: query + name: dictName + type: string + - description: dictId + in: query + name: dictId + type: string + - description: dictType + in: query + name: dictType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 字典类型列表数据 + tags: + - 字典类型 + /api/v1/loginlog: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.LoginLog' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加登录日志 + tags: + - 登录日志 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.LoginLog' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改登录日志 + tags: + - 登录日志 + /api/v1/loginlog/{infoId}: + delete: + description: 删除数据 + parameters: + - description: 以逗号(,)分割的infoId + in: path + name: infoId + required: true + type: string + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 批量删除登录日志 + tags: + - 登录日志 + get: + description: 获取JSON + parameters: + - description: infoId + in: path + name: infoId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 通过编码获取登录日志 + tags: + - 登录日志 + /api/v1/loginloglist: + get: + description: 获取JSON + parameters: + - description: status + in: query + name: status + type: string + - description: dictCode + in: query + name: dictCode + type: string + - description: dictType + in: query + name: dictType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 登录日志列表 + tags: + - 登录日志 + /api/v1/menu: + get: + description: 获取JSON + parameters: + - description: menuName + in: query + name: menuName + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: Menu列表数据 + tags: + - 菜单 + post: + consumes: + - application/x-www-form-urlencoded + description: 获取JSON + parameters: + - description: menuName + in: formData + name: menuName + required: true + type: string + - description: Path + in: formData + name: Path + type: string + - description: Action + in: formData + name: Action + required: true + type: string + - description: Permission + in: formData + name: Permission + required: true + type: string + - description: ParentId + in: formData + name: ParentId + required: true + type: string + - description: IsDel + in: formData + name: IsDel + required: true + type: string + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 创建菜单 + tags: + - 菜单 + /api/v1/menu/{id}: + delete: + description: 删除数据 + parameters: + - description: id + in: path + name: id + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除菜单 + tags: + - 菜单 + put: + consumes: + - application/x-www-form-urlencoded + description: 获取JSON + parameters: + - description: id + in: path + name: id + required: true + type: integer + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Menu' + type: object + responses: + "200": + description: '{"code": -1, "message": "修改失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改菜单 + tags: + - 菜单 + /api/v1/menuTreeselect: + get: + consumes: + - application/x-www-form-urlencoded + description: 获取JSON + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 获取菜单树 + tags: + - 菜单 + /api/v1/menuids/{id}: + get: + description: 获取JSON + parameters: + - description: id + in: path + name: id + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: 获取角色对应的菜单id数组 + tags: + - 菜单 + /api/v1/menulist: + get: + description: 获取JSON + parameters: + - description: menuName + in: query + name: menuName + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: Menu列表数据 + tags: + - 菜单 + /api/v1/menurole: + get: + description: 获取JSON + parameters: + - description: id + in: path + name: id + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: 根据角色名称获取菜单列表数据(左菜单使用) + tags: + - 菜单 + /api/v1/operlog: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysOperLog' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加操作日志 + tags: + - 操作日志 + /api/v1/operlog/{infoId}: + get: + description: 获取JSON + parameters: + - description: infoId + in: path + name: infoId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 通过编码获取登录日志 + tags: + - 登录日志 + /api/v1/operlog/{operId}: + delete: + description: 删除数据 + parameters: + - description: 以逗号(,)分割的operId + in: path + name: operId + required: true + type: string + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 批量删除操作日志 + tags: + - 操作日志 + /api/v1/operloglist: + get: + description: 获取JSON + parameters: + - description: status + in: query + name: status + type: string + - description: dictCode + in: query + name: dictCode + type: string + - description: dictType + in: query + name: dictType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 登录日志列表 + tags: + - 登录日志 + /api/v1/post: + get: + description: 获取JSON + parameters: + - description: name + in: query + name: name + type: string + - description: id + in: query + name: id + type: string + - description: position + in: query + name: position + type: string + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 职位列表数据 + tags: + - 职位 + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Post' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加职位 + tags: + - 职位 + /api/v1/post/: + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Dept' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改职位 + tags: + - 职位 + /api/v1/post/{postId}: + delete: + description: 删除数据 + parameters: + - description: id + in: path + name: id + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除职位 + tags: + - 职位 + get: + description: 获取JSON + parameters: + - description: postId + in: path + name: postId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取字典数据 + tags: + - 字典数据 + /api/v1/role: + get: + description: 获取JSON + parameters: + - description: roleId + in: path + name: roleId + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: 获取Role数据 + tags: + - 角色/Role + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysRole' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + summary: 创建角色 + tags: + - 角色/Role + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysRole' + type: object + responses: + "200": + description: '{"code": -1, "message": "修改失败"}' + schema: + type: string + summary: 修改用户角色 + tags: + - 角色/Role + /api/v1/role/{roleId}: + delete: + description: 删除数据 + parameters: + - description: roleId + in: path + name: roleId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除用户角色 + tags: + - 角色/Role + /api/v1/rolelist: + get: + description: Get JSON + parameters: + - description: roleName + in: query + name: roleName + type: string + - description: status + in: query + name: status + type: string + - description: roleKey + in: query + name: roleKey + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 角色列表数据 + tags: + - 角色/Role + /api/v1/rolemenu: + get: + description: 获取JSON + parameters: + - description: RoleId + in: query + name: RoleId + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: RoleMenu列表数据 + tags: + - 角色菜单 + /api/v1/rolemenu/{id}: + delete: + description: 删除数据 + parameters: + - description: id + in: path + name: id + required: true + type: string + - description: menu_id + in: query + name: menu_id + type: string + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除用户菜单数据 + tags: + - 角色菜单 + /api/v1/sys/tables/info: + post: + consumes: + - application/json + description: 添加表结构 + parameters: + - description: tableName / 数据表名称 + in: query + name: tables + type: string + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加表结构 + tags: + - 工具 - 生成表 + put: + consumes: + - application/json + description: 修改表结构 + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Dept' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改表结构 + tags: + - 工具 - 生成表 + /api/v1/sys/tables/info/{tableId}: + delete: + description: 删除表结构 + parameters: + - description: tableId + in: path + name: tableId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除表结构 + tags: + - 工具 - 生成表 + get: + description: 获取JSON + parameters: + - description: configKey + in: path + name: configKey + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取配置 + tags: + - 工具 - 生成表 + /api/v1/sys/tables/page: + get: + description: 生成表分页列表 + parameters: + - description: tableName / 数据表名称 + in: query + name: tableName + type: string + - description: pageSize / 页条数 + in: query + name: pageSize + type: integer + - description: pageIndex / 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + summary: 分页列表数据 + tags: + - 工具 - 生成表 + /api/v1/sysUser: + get: + description: 获取JSON + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取用户角色和职位 + tags: + - 用户 + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: 用户数据 + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysUser' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + summary: 创建用户 + tags: + - 用户 + /api/v1/sysUser/{userId}: + get: + description: 获取JSON + parameters: + - description: 用户编码 + in: path + name: userId + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取用户 + tags: + - 用户 + /api/v1/sysUserList: + get: + description: 获取JSON + parameters: + - description: username + in: query + name: username + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: 列表数据 + tags: + - 用户 + /api/v1/sysuser/{userId}: + delete: + description: 删除数据 + parameters: + - description: userId + in: path + name: userId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除用户数据 + tags: + - 用户 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.SysUser' + type: object + responses: + "200": + description: '{"code": -1, "message": "修改失败"}' + schema: + type: string + summary: 修改用户数据 + tags: + - 用户 + /api/v1/user/profile: + get: + description: 获取JSON + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取当前登录用户 + tags: + - 个人中心 + /api/v1/user/profileAvatar: + post: + consumes: + - multipart/form-data + description: 获取JSON + parameters: + - description: file + in: formData + name: file + required: true + type: file + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + summary: 修改头像 + tags: + - 用户 + /login: + post: + consumes: + - application/json + description: 获取token + parameters: + - description: Add account + in: body + name: username + required: true + schema: + $ref: '#/definitions/models.Login' + type: object + responses: + "200": + description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": + ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" + }' + schema: + type: string + summary: 登陆 + /logout: + post: + consumes: + - application/json + description: 获取token + responses: + "200": + description: '{"code": 200, "msg": "成功退出系统" }' + schema: + type: string + security: + - "": [] + summary: 退出登录 + /sd/cpu: + get: + consumes: + - text/html + description: CPU 使用量 DiskCheck checks the disk usage. + produces: + - text/html + responses: + "200": + description: OK + schema: + type: string + summary: CPU 使用量 + /sd/disk: + get: + consumes: + - text/html + description: 服务器硬盘使用量 DiskCheck checks the disk usage. + produces: + - text/html + responses: + "200": + description: 'OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%' + schema: + type: string + "429": + description: WARNING + schema: + type: string + "500": + description: CRITICAL + schema: + type: string + summary: 服务器硬盘使用量 + /sd/health: + get: + consumes: + - text/html + description: 健康状况 + produces: + - text/html + responses: + "200": + description: OK + schema: + type: string + summary: 健康状况 HealthCheck shows OK as the ping-pong result. + /sd/os: + get: + consumes: + - text/html + description: Os + produces: + - text/html + responses: + "200": + description: OK + schema: + type: string + summary: OS + /sd/ram: + get: + consumes: + - text/html + description: 内存使用量 RAMCheck checks the disk usage. + produces: + - text/html + responses: + "200": + description: OK + schema: + type: string + summary: 内存使用量 +securityDefinitions: + Bearer: + in: header + name: Authorization + type: apiKey +swagger: "2.0" diff --git a/global/logger.go b/global/logger.go new file mode 100644 index 0000000..f5ec10c --- /dev/null +++ b/global/logger.go @@ -0,0 +1,14 @@ +package global + +import ( + "github.com/sirupsen/logrus" +) + +var RequestLogger = &logrus.Entry{} + + + +func init() { + // TODO: requestLogger log format + // RequestLogger = logrus.WithFields(logrus.Fields{"request_id": request_id, "user_ip": user_ip}) +} \ No newline at end of file diff --git a/global/orm/db.go b/global/orm/db.go new file mode 100644 index 0000000..e4158fe --- /dev/null +++ b/global/orm/db.go @@ -0,0 +1,9 @@ +package orm + +import ( + "github.com/jinzhu/gorm" +) + +var Eloquent *gorm.DB +var MysqlConn string + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..337ff54 --- /dev/null +++ b/go.mod @@ -0,0 +1,41 @@ +module ferry + +go 1.124 + +require ( + github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 + github.com/casbin/casbin/v2 v2.2.1 + github.com/casbin/gorm-adapter/v2 v2.0.3 + github.com/dgrijalva/jwt-go v3.2.0+incompatible + github.com/gin-gonic/gin v1.4.0 + github.com/go-kit/kit v0.8.0 + github.com/go-ole/go-ole v1.2.4 // indirect + github.com/go-openapi/spec v0.19.7 // indirect + github.com/go-openapi/swag v0.19.8 // indirect + github.com/go-sql-driver/mysql v1.4.1 + github.com/golang/protobuf v1.3.2 // indirect + github.com/google/uuid v1.1.1 + github.com/jinzhu/gorm v1.9.10 + github.com/json-iterator/go v1.1.8 // indirect + github.com/mailru/easyjson v0.7.1 // indirect + github.com/mattn/go-isatty v0.0.10 // indirect + github.com/mojocn/base64Captcha v1.3.1 + github.com/mssola/user_agent v0.5.1 + github.com/pkg/errors v0.8.1 + github.com/robfig/cron/v3 v3.0.0 + github.com/satori/go.uuid v1.2.0 + github.com/shirou/gopsutil v2.20.3+incompatible + github.com/sirupsen/logrus v1.2.0 + github.com/spf13/cobra v1.0.0 + github.com/spf13/viper v1.6.2 + github.com/swaggo/gin-swagger v1.2.0 + github.com/swaggo/swag v1.6.5 + github.com/ugorji/go v1.1.7 // indirect + github.com/unrolled/secure v1.0.8 + golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 + golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect + golang.org/x/tools v0.0.0-20200402223321-bcf690261a44 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c76e6a2 --- /dev/null +++ b/go.sum @@ -0,0 +1,445 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.37.4 h1:glPeL3BQJsbF6aIIYfZizMwc5LTYz250bDMjttbBGAU= +cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/casbin/casbin/v2 v2.0.0/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.2.1 h1:ijrSMfBfbQlDc4LnMTGtGYWmhKuuR6RLSQRj8vHrMzc= +github.com/casbin/casbin/v2 v2.2.1/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/gorm-adapter/v2 v2.0.3 h1:m8o/APMGkm5Gb8RLHU51F/+9ODUyGgPmC+EEzRJsPr0= +github.com/casbin/gorm-adapter/v2 v2.0.3/go.mod h1:pnulk7RNHbFsldTBruui8jqUhq91sLHtub8LJCJSZg8= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 h1:tkum0XDgfR0jcVVXuTsYv/erY2NnEDqwRojbxR1rBYA= +github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= +github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2 h1:A9+F4Dc/MCNB5jibxf6rRvOvR/iFgQdyNx9eIhnGqq0= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk= +github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4= +github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.7 h1:0xWSeMd35y5avQAThZR2PkEuqSosoS5t6gDH4L8n11M= +github.com/go-openapi/spec v0.19.7/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.8 h1:vfK6jLhs7OI4tAXkvkooviaE1JEPcw3mutyegLHHjmk= +github.com/go-openapi/swag v0.19.8/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jinzhu/gorm v1.9.10 h1:HvrsqdhCW78xpJF67g1hMxS6eCToo9PZH4LDB8WKPac= +github.com/jinzhu/gorm v1.9.10/go.mod h1:Kh6hTsSGffh4ui079FHrR5Gg+5D0hgihqDcsDN2BBJY= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= +github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= +github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8= +github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= +github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= +github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= +github.com/mssola/user_agent v0.5.1 h1:sJUCUozh+j7c0dR2zMIUX5aJjoY/TNo/gXiNujoH5oY= +github.com/mssola/user_agent v0.5.1/go.mod h1:TTPno8LPY3wAIEKRpAtkdMT0f8SE24pLRGPahjCH4uw= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E= +github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ= +github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= +github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= +github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= +github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= +github.com/swaggo/swag v1.5.1 h1:2Agm8I4K5qb00620mHq0VJ05/KT4FtmALPIcQR9lEZM= +github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= +github.com/swaggo/swag v1.6.5 h1:2C+t+xyK6p1sujqncYO/VnMvPZcBJjNdKKyxbOdAW8o= +github.com/swaggo/swag v1.6.5/go.mod h1:Y7ZLSS0d0DdxhWGVhQdu+Bu1QhaF5k0RD7FKdiAykeY= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.5-pre h1:jyJKFOSEbdOc2HODrf2qcCkYOdq7zzXqA9bhW5oV4fM= +github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.5-pre h1:5YV9PsFAN+ndcCtTM7s60no7nY7eTG3LPtxhSwuxzCs= +github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM= +github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 h1:3zb4D3T4G8jdExgVU/95+vQXfpEPiMdCaZgmGVxjNHM= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/image v0.0.0-20190501045829-6d32002ffd75 h1:TbGuee8sSq15Iguxu4deQ7+Bqq/d2rsQejGcEtADAMQ= +golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY= +golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4= +golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b h1:/mJ+GKieZA6hFDQGdWZrjj4AXPl5ylY+5HusG80roy0= +golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200402223321-bcf690261a44 h1:bMm0eoDiGkM5VfIyKjxDvoflW5GLp7+VCo+60n8F+TE= +golang.org/x/tools v0.0.0-20200402223321-bcf690261a44/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/handler/auth.go b/handler/auth.go new file mode 100644 index 0000000..f18d3e5 --- /dev/null +++ b/handler/auth.go @@ -0,0 +1,154 @@ +package handler + +import ( + "ferry/models" + jwt "ferry/pkg/jwtauth" + "ferry/tools" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/mojocn/base64Captcha" + "github.com/mssola/user_agent" + log "github.com/sirupsen/logrus" +) + +var store = base64Captcha.DefaultMemStore + +func PayloadFunc(data interface{}) jwt.MapClaims { + if v, ok := data.(map[string]interface{}); ok { + u, _ := v["user"].(models.SysUser) + r, _ := v["role"].(models.SysRole) + return jwt.MapClaims{ + jwt.IdentityKey: u.UserId, + jwt.RoleIdKey: r.RoleId, + jwt.RoleKey: r.RoleKey, + jwt.NiceKey: u.Username, + jwt.DataScopeKey: r.DataScope, + jwt.RoleNameKey: r.RoleName, + } + } + return jwt.MapClaims{} +} + +func IdentityHandler(c *gin.Context) interface{} { + claims := jwt.ExtractClaims(c) + return map[string]interface{}{ + "IdentityKey": claims["identity"], + "UserName": claims["nice"], + "RoleKey": claims["rolekey"], + "UserId": claims["identity"], + "RoleIds": claims["roleid"], + "DataScope": claims["datascope"], + } +} + +// @Summary 登陆 +// @Description 获取token +// LoginHandler can be used by clients to get a jwt token. +// Payload needs to be json in the form of {"username": "USERNAME", "password": "PASSWORD"}. +// Reply will be of the form {"token": "TOKEN"}. +// @Accept application/json +// @Product application/json +// @Param username body models.Login true "Add 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) { + var loginVals models.Login + var loginlog models.LoginLog + + ua := user_agent.New(c.Request.UserAgent()) + loginlog.Ipaddr = c.ClientIP() + location := tools.GetLocation(c.ClientIP()) + loginlog.LoginLocation = location + loginlog.LoginTime = tools.GetCurrntTime() + loginlog.Status = "0" + loginlog.Remark = c.Request.UserAgent() + browserName, browserVersion := ua.Browser() + loginlog.Browser = browserName + " " + browserVersion + loginlog.Os = ua.OS() + loginlog.Msg = "登录成功" + loginlog.Platform = ua.Platform() + + if err := c.ShouldBind(&loginVals); err != nil { + loginlog.Status = "1" + loginlog.Msg = "数据解析失败" + loginlog.Username = loginVals.Username + loginlog.Create() + return nil, jwt.ErrMissingLoginValues + } + loginlog.Username = loginVals.Username + if !store.Verify(loginVals.UUID, loginVals.Code, true) { + loginlog.Status = "1" + loginlog.Msg = "验证码错误" + loginlog.Create() + return nil, jwt.ErrInvalidVerificationode + } + + user, role, e := loginVals.GetUser() + if e == nil { + loginlog.Create() + return map[string]interface{}{"user": user, "role": role}, nil + } else { + loginlog.Status = "1" + loginlog.Msg = "登录失败" + loginlog.Create() + log.Println(e.Error()) + } + + return nil, jwt.ErrFailedAuthentication +} + +// @Summary 退出登录 +// @Description 获取token +// LoginHandler can be used by clients to get a jwt token. +// Reply will be of the form {"token": "TOKEN"}. +// @Accept application/json +// @Product application/json +// @Success 200 {string} string "{"code": 200, "msg": "成功退出系统" }" +// @Router /logout [post] +// @Security +func LogOut(c *gin.Context) { + var loginlog models.LoginLog + ua := user_agent.New(c.Request.UserAgent()) + loginlog.Ipaddr = c.ClientIP() + location := tools.GetLocation(c.ClientIP()) + loginlog.LoginLocation = location + loginlog.LoginTime = tools.GetCurrntTime() + loginlog.Status = "0" + loginlog.Remark = c.Request.UserAgent() + browserName, browserVersion := ua.Browser() + loginlog.Browser = browserName + " " + browserVersion + loginlog.Os = ua.OS() + loginlog.Platform = ua.Platform() + loginlog.Username = tools.GetUserName(c) + loginlog.Msg = "退出成功" + loginlog.Create() + c.JSON(http.StatusOK, gin.H{ + "code": 200, + "msg": "退出成功", + }) + +} + +func Authorizator(data interface{}, c *gin.Context) bool { + + if v, ok := data.(map[string]interface{}); ok { + u, _ := v["user"].(models.SysUser) + r, _ := v["role"].(models.SysRole) + c.Set("role", r.RoleName) + c.Set("roleIds", r.RoleId) + c.Set("userId", u.UserId) + c.Set("userName", u.UserName) + c.Set("dataScope", r.DataScope) + + return true + } + return false +} + +func Unauthorized(c *gin.Context, code int, message string) { + c.JSON(http.StatusOK, gin.H{ + "code": code, + "msg": message, + }) +} diff --git a/handler/httpshandler.go b/handler/httpshandler.go new file mode 100644 index 0000000..1d0f45d --- /dev/null +++ b/handler/httpshandler.go @@ -0,0 +1,22 @@ +package handler + +import ( + "ferry/tools/config" + + "github.com/gin-gonic/gin" + "github.com/unrolled/secure" +) + +func TlsHandler() gin.HandlerFunc { + return func(c *gin.Context) { + secureMiddleware := secure.New(secure.Options{ + SSLRedirect: true, + SSLHost: config.ApplicationConfig.Domain, + }) + err := secureMiddleware.Process(c.Writer, c.Request) + if err != nil { + return + } + c.Next() + } +} diff --git a/handler/nofound.go b/handler/nofound.go new file mode 100644 index 0000000..72731e6 --- /dev/null +++ b/handler/nofound.go @@ -0,0 +1,18 @@ +package handler + +import ( + jwt "ferry/pkg/jwtauth" + "net/http" + + "github.com/gin-gonic/gin" + log "github.com/sirupsen/logrus" +) + +func NoFound(c *gin.Context) { + claims := jwt.ExtractClaims(c) + log.Printf("NoRoute claims: %#v\n", claims) + c.JSON(http.StatusOK, gin.H{ + "code": "404", + "message": "not found", + }) +} diff --git a/handler/ping.go b/handler/ping.go new file mode 100644 index 0000000..30a7373 --- /dev/null +++ b/handler/ping.go @@ -0,0 +1,11 @@ +package handler + +import ( + "github.com/gin-gonic/gin" +) + +func Ping(c *gin.Context) { + c.JSON(200, gin.H{ + "message": "ok", + }) +} \ No newline at end of file diff --git a/handler/sd/check.go b/handler/sd/check.go new file mode 100644 index 0000000..1b0ea34 --- /dev/null +++ b/handler/sd/check.go @@ -0,0 +1,165 @@ +package sd + +import ( + "ferry/tools/app" + "fmt" + "net/http" + "runtime" + "time" + + "github.com/gin-gonic/gin" + "github.com/shirou/gopsutil/cpu" + "github.com/shirou/gopsutil/disk" + "github.com/shirou/gopsutil/load" + "github.com/shirou/gopsutil/mem" +) + +const ( + B = 1 + KB = 1024 * B + MB = 1024 * KB + GB = 1024 * MB +) + +// 健康状况 +// @Summary 健康状况 HealthCheck shows OK as the ping-pong result. +// @Description 健康状况 +// @Accept text/html +// @Produce text/html +// @Success 200 {string} string "OK" +// @Router /sd/health [get] +// @BasePath +func HealthCheck(c *gin.Context) { + app.OK(c, "", "OK") +} + +// @Summary 服务器硬盘使用量 +// @Description 服务器硬盘使用量 DiskCheck checks the disk usage. +// @Accept text/html +// @Produce text/html +// @Success 200 {string} string "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%" +// @Failure 500 {string} string "CRITICAL" +// @Failure 429 {string} string "WARNING" +// @Router /sd/disk [get] +// @BasePath +func DiskCheck(c *gin.Context) { + u, _ := disk.Usage("/") + + usedMB := int(u.Used) / MB + usedGB := int(u.Used) / GB + totalMB := int(u.Total) / MB + totalGB := int(u.Total) / GB + usedPercent := int(u.UsedPercent) + + status := http.StatusOK + text := "OK" + + if usedPercent >= 95 { + status = http.StatusOK + text = "CRITICAL" + } else if usedPercent >= 90 { + status = http.StatusTooManyRequests + text = "WARNING" + } + + message := fmt.Sprintf("%s - Free space: %dMB (%dGB) / %dMB (%dGB) | Used: %d%%", text, usedMB, usedGB, totalMB, totalGB, usedPercent) + c.String(status, "\n"+message) +} + +// @Summary OS +// @Description Os +// @Accept text/html +// @Produce text/html +// @Success 200 {string} string "" +// @Router /sd/os [get] +// @BasePath +func OSCheck(c *gin.Context) { + status := http.StatusOK + app.Custum(c, gin.H{ + "code": 200, + "status": status, + "goOs": runtime.GOOS, + "compiler": runtime.Compiler, + "numCpu": runtime.NumCPU(), + "version": runtime.Version(), + "numGoroutine": runtime.NumGoroutine(), + }) +} + +// @Summary CPU 使用量 +// @Description CPU 使用量 DiskCheck checks the disk usage. +// @Accept text/html +// @Produce text/html +// @Success 200 {string} string "" +// @Router /sd/cpu [get] +// @BasePath +func CPUCheck(c *gin.Context) { + cores, _ := cpu.Counts(false) + + cpus, err := cpu.Percent(time.Duration(200)*time.Millisecond, true) + if err == nil { + for i, c := range cpus { + fmt.Printf("cpu%d : %f%%\n", i, c) + } + } + + a, _ := load.Avg() + l1 := a.Load1 + l5 := a.Load5 + l15 := a.Load15 + + status := http.StatusOK + text := "OK" + + if l5 >= float64(cores-1) { + status = http.StatusInternalServerError + text = "CRITICAL" + } else if l5 >= float64(cores-2) { + status = http.StatusTooManyRequests + text = "WARNING" + } + app.Custum(c, gin.H{ + "code": 200, + "msg": text, + "status": status, + "cores": cores, + "load1": l1, + "load5": l5, + "load15": l15, + }) +} + +// @Summary 内存使用量 +// @Description 内存使用量 RAMCheck checks the disk usage. +// @Accept text/html +// @Produce text/html +// @Success 200 {string} string "" +// @Router /sd/ram [get] +// @BasePath +func RAMCheck(c *gin.Context) { + u, _ := mem.VirtualMemory() + + usedMB := int(u.Used) / MB + totalMB := int(u.Total) / MB + usedPercent := int(u.UsedPercent) + + status := http.StatusOK + text := "OK" + + if usedPercent >= 95 { + status = http.StatusInternalServerError + text = "CRITICAL" + } else if usedPercent >= 90 { + status = http.StatusTooManyRequests + text = "WARNING" + } + + app.Custum(c, gin.H{ + "code": 200, + "msg": text, + "status": status, + "used": usedMB, + "total": totalMB, + "usedPercent": usedPercent, + }) +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..2c5bd4e --- /dev/null +++ b/main.go @@ -0,0 +1,73 @@ +package main + +import ( + "ferry/cmd" +) + +// @title ferry API +// @version 0.0.1 +// @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档 +// @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢! +// @license.name MIT +// @license.url https://github.com/wenjianzhang/ferry/blob/master/LICENSE.md + +// @securityDefinitions.apikey Bearer +// @in header +// @name Authorization + +//func main() { +// configName := "settings" +// +// +// config.InitConfig(configName) +// +// gin.SetMode(gin.DebugMode) +// log.Println(config.DatabaseConfig.Port) +// +// err := gorm.AutoMigrate(orm.Eloquent) +// if err != nil { +// log.Fatalln("数据库初始化失败 err: %v", err) +// } +// +// if config.ApplicationConfig.IsInit { +// if err := models.InitDb(); err != nil { +// log.Fatal("数据库基础数据初始化失败!") +// } else { +// config.SetApplicationIsInit() +// } +// } +// +// r := router.InitRouter() +// +// defer orm.Eloquent.Close() +// +// srv := &http.Server{ +// Addr: config.ApplicationConfig.Host + ":" + config.ApplicationConfig.Port, +// Handler: r, +// } +// +// go func() { +// // 服务连接 +// if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { +// log.Fatalf("listen: %s\n", err) +// } +// }() +// log.Println("Server Run ", config.ApplicationConfig.Host+":"+config.ApplicationConfig.Port) +// log.Println("Enter Control + C Shutdown Server") +// // 等待中断信号以优雅地关闭服务器(设置 5 秒的超时时间) +// quit := make(chan os.Signal) +// signal.Notify(quit, os.Interrupt) +// <-quit +// log.Println("Shutdown Server ...") +// +// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) +// defer cancel() +// if err := srv.Shutdown(ctx); err != nil { +// log.Fatal("Server Shutdown:", err) +// } +// log.Println("Server exiting") +//} + +func main() { + cmd.Execute() +} diff --git a/middleware/auth.go b/middleware/auth.go new file mode 100644 index 0000000..7b3e734 --- /dev/null +++ b/middleware/auth.go @@ -0,0 +1,26 @@ +package middleware + +import ( + "ferry/handler" + jwt "ferry/pkg/jwtauth" + "ferry/tools/config" + "time" +) + +func AuthInit() (*jwt.GinJWTMiddleware, error) { + return jwt.New(&jwt.GinJWTMiddleware{ + Realm: "test zone", + Key: []byte(config.ApplicationConfig.JwtSecret), + Timeout: time.Hour, + MaxRefresh: time.Hour, + PayloadFunc: handler.PayloadFunc, + IdentityHandler: handler.IdentityHandler, + Authenticator: handler.Authenticator, + Authorizator: handler.Authorizator, + Unauthorized: handler.Unauthorized, + TokenLookup: "header: Authorization, query: token, cookie: jwt", + TokenHeadName: "Bearer", + TimeFunc: time.Now, + }) + +} diff --git a/middleware/customerror.go b/middleware/customerror.go new file mode 100644 index 0000000..5fbd99d --- /dev/null +++ b/middleware/customerror.go @@ -0,0 +1,49 @@ +package middleware + +import ( + "fmt" + "github.com/gin-gonic/gin" + "net/http" + "strconv" + "strings" + "time" +) + +func CustomError(c *gin.Context) { + defer func() { + if err := recover(); err != nil { + + if c.IsAborted() { + c.Status(200) + } + switch errStr := err.(type) { + case string: + p := strings.Split(errStr, "#") + if len(p) == 3 && p[0] == "CustomError" { + statusCode, e := strconv.Atoi(p[1]) + if e != nil { + break + } + c.Status(statusCode) + fmt.Println( + time.Now().Format("\n 2006-01-02 15:04:05.9999"), + "[ERROR]", + c.Request.Method, + c.Request.URL, + statusCode, + c.Request.RequestURI, + c.ClientIP(), + p[2], + ) + c.JSON(http.StatusOK, gin.H{ + "code": statusCode, + "msg": p[2], + }) + } + default: + panic(err) + } + } + }() + c.Next() +} diff --git a/middleware/header.go b/middleware/header.go new file mode 100644 index 0000000..6ece741 --- /dev/null +++ b/middleware/header.go @@ -0,0 +1,47 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + "net/http" + "time" +) + +// NoCache is a middleware function that appends headers +// to prevent the client from caching the HTTP response. +func NoCache(c *gin.Context) { + c.Header("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate, value") + c.Header("Expires", "Thu, 01 Jan 1970 00:00:00 GMT") + c.Header("Last-Modified", time.Now().UTC().Format(http.TimeFormat)) + c.Next() +} + +// Options is a middleware function that appends headers +// for options requests and aborts then exits the middleware +// chain and ends the request. +func Options(c *gin.Context) { + if c.Request.Method != "OPTIONS" { + c.Next() + } else { + c.Header("Access-Control-Allow-Origin", "*") + c.Header("Access-Control-Allow-Methods", "GET,POST,PUT,PATCH,DELETE,OPTIONS") + c.Header("Access-Control-Allow-Headers", "authorization, origin, content-type, accept") + c.Header("Allow", "HEAD,GET,POST,PUT,PATCH,DELETE,OPTIONS") + c.Header("Content-Type", "application/json") + c.AbortWithStatus(200) + } +} + +// Secure is a middleware function that appends security +// and resource access headers. +func Secure(c *gin.Context) { + c.Header("Access-Control-Allow-Origin", "*") + //c.Header("X-Frame-Options", "DENY") + c.Header("X-Content-Type-Options", "nosniff") + c.Header("X-XSS-Protection", "1; mode=block") + if c.Request.TLS != nil { + c.Header("Strict-Transport-Security", "max-age=31536000") + } + + // Also consider adding Content-Security-Policy headers + // c.Header("Content-Security-Policy", "script-src 'self' https://cdnjs.cloudflare.com") +} diff --git a/middleware/init.go b/middleware/init.go new file mode 100644 index 0000000..14229f9 --- /dev/null +++ b/middleware/init.go @@ -0,0 +1,22 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + +) + + +func InitMiddleware(r *gin.Engine) { + // 日志处理 + r.Use(LoggerToFile()) + // 自定义错误处理 + r.Use(CustomError) + // NoCache is a middleware function that appends headers + r.Use(NoCache) + // 跨域处理 + r.Use(Options) + // Secure is a middleware function that appends security + r.Use(Secure) + // Set X-Request-Id header + r.Use(RequestId()) +} \ No newline at end of file diff --git a/middleware/logger.go b/middleware/logger.go new file mode 100644 index 0000000..d1341e8 --- /dev/null +++ b/middleware/logger.go @@ -0,0 +1,106 @@ +package middleware + +import ( + "ferry/models" + "ferry/tools" + config2 "ferry/tools/config" + "strings" + "time" + + "github.com/gin-gonic/gin" + log "github.com/sirupsen/logrus" +) + +// 日志记录到文件 +func LoggerToFile() gin.HandlerFunc { + + return func(c *gin.Context) { + // 开始时间 + startTime := time.Now() + + // 处理请求 + c.Next() + + // 结束时间 + endTime := time.Now() + + // 执行时间 + latencyTime := endTime.Sub(startTime) + + // 请求方式 + reqMethod := c.Request.Method + + // 请求路由 + reqUri := c.Request.RequestURI + + // 状态码 + statusCode := c.Writer.Status() + + // 请求IP + clientIP := c.ClientIP() + + // 日志格式 + log.Infof(" %s %3d %13v %15s %s %s \r\n", + startTime.Format("2006-01-02 15:04:05.9999"), + statusCode, + latencyTime, + clientIP, + reqMethod, + reqUri, + ) + + if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config2.LogConfig.Operdb { + SetDBOperLog(c, clientIP, statusCode, reqUri, reqMethod, latencyTime) + } + } +} + +// 写入操作日志表 +// 该方法后续即将弃用 +func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration) { + menu := models.Menu{} + menu.Path = reqUri + menu.Action = reqMethod + menuList, _ := menu.Get() + sysOperLog := models.SysOperLog{} + sysOperLog.OperIp = clientIP + sysOperLog.OperLocation = tools.GetLocation(clientIP) + sysOperLog.Status = tools.IntToString(statusCode) + sysOperLog.OperName = tools.GetUserName(c) + sysOperLog.RequestMethod = c.Request.Method + sysOperLog.OperUrl = reqUri + if reqUri == "/login" { + sysOperLog.BusinessType = "10" + sysOperLog.Title = "用户登录" + sysOperLog.OperName = "-" + } else if strings.Contains(reqUri, "/api/v1/logout") { + sysOperLog.BusinessType = "11" + } else if strings.Contains(reqUri, "/api/v1/getCaptcha") { + sysOperLog.BusinessType = "12" + sysOperLog.Title = "验证码" + } else { + if reqMethod == "POST" { + sysOperLog.BusinessType = "1" + } else if reqMethod == "PUT" { + sysOperLog.BusinessType = "2" + } else if reqMethod == "DELETE" { + sysOperLog.BusinessType = "3" + } + } + sysOperLog.Method = reqMethod + if len(menuList) > 0 { + sysOperLog.Title = menuList[0].Title + } + b, _ := c.Get("body") + sysOperLog.OperParam, _ = tools.StructToJsonStr(b) + sysOperLog.CreateBy = tools.GetUserName(c) + sysOperLog.OperTime = tools.GetCurrntTime() + sysOperLog.LatencyTime = (latencyTime).String() + sysOperLog.UserAgent = c.Request.UserAgent() + if c.Err() == nil { + sysOperLog.Status = "0" + } else { + sysOperLog.Status = "1" + } + _, _ = sysOperLog.Create() +} diff --git a/middleware/permission.go b/middleware/permission.go new file mode 100644 index 0000000..5997e22 --- /dev/null +++ b/middleware/permission.go @@ -0,0 +1,38 @@ +package middleware + +import ( + mycasbin "ferry/pkg/casbin" + "ferry/pkg/jwtauth" + _ "ferry/pkg/jwtauth" + "ferry/tools" + "net/http" + + "github.com/gin-gonic/gin" + log "github.com/sirupsen/logrus" +) + +//权限检查中间件 +func AuthCheckRole() gin.HandlerFunc { + return func(c *gin.Context) { + data, _ := c.Get("JWT_PAYLOAD") + v := data.(jwtauth.MapClaims) + e, err := mycasbin.Casbin() + tools.HasError(err, "", 500) + //检查权限 + res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) + log.Println("----------------", v["rolekey"], c.Request.URL.Path, c.Request.Method) + + tools.HasError(err, "", 500) + + if res { + c.Next() + } else { + c.JSON(http.StatusOK, gin.H{ + "code": 403, + "msg": "对不起,您没有该接口访问权限,请联系管理员", + }) + c.Abort() + return + } + } +} diff --git a/middleware/requestid.go b/middleware/requestid.go new file mode 100644 index 0000000..7ab5f7a --- /dev/null +++ b/middleware/requestid.go @@ -0,0 +1,26 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + "github.com/satori/go.uuid" +) + +func RequestId() gin.HandlerFunc { + return func(c *gin.Context) { + // Check for incoming header, use it if exists + requestId := c.Request.Header.Get("X-Request-Id") + + // Create request id with UUID4 + if requestId == "" { + u4 := uuid.NewV4() + requestId = u4.String() + } + + // Expose it for use in the application + c.Set("X-Request-Id", requestId) + + // Set X-Request-Id header + c.Writer.Header().Set("X-Request-Id", requestId) + c.Next() + } +} diff --git a/models/casbinrule.go b/models/casbinrule.go new file mode 100644 index 0000000..1ed1e30 --- /dev/null +++ b/models/casbinrule.go @@ -0,0 +1,16 @@ +package models + +//casbin_rule +type CasbinRule struct { + PType string `json:"p_type" gorm:"type:varchar(100);"` + V0 string `json:"v0" gorm:"type:varchar(100);"` + V1 string `json:"v1" gorm:"type:varchar(100);"` + V2 string `json:"v2" gorm:"type:varchar(100);"` + V3 string `json:"v3" gorm:"type:varchar(100);"` + V4 string `json:"v4" gorm:"type:varchar(100);"` + V5 string `json:"v5" gorm:"type:varchar(100);"` +} + +func (CasbinRule) TableName() string { + return "casbin_rule" +} diff --git a/models/datascope.go b/models/datascope.go new file mode 100644 index 0000000..3cfd59c --- /dev/null +++ b/models/datascope.go @@ -0,0 +1,44 @@ +package models + +import ( + "errors" + "ferry/tools" + + "github.com/jinzhu/gorm" +) + +type DataPermission struct { + DataScope string + UserId int + DeptId int + RoleId int +} + +func (e *DataPermission) GetDataScope(tbname string, table *gorm.DB) (*gorm.DB, error) { + SysUser := new(SysUser) + SysRole := new(SysRole) + SysUser.UserId = e.UserId + user, err := SysUser.Get() + if err != nil { + return nil, errors.New("获取用户数据出错 msg:" + err.Error()) + } + SysRole.RoleId = user.RoleId + role, err := SysRole.Get() + if err != nil { + return nil, errors.New("获取用户数据出错 msg:" + err.Error()) + } + if role.DataScope == "2" { + table = table.Where(tbname+".create_by in (select sys_user.user_id from sys_role_dept left join sys_user on sys_user.dept_id=sys_role_dept.dept_id where sys_role_dept.role_id = ?)", user.RoleId) + } + if role.DataScope == "3" { + table = table.Where(tbname+".create_by in (SELECT user_id from sys_user where dept_id = ? )", user.DeptId) + } + if role.DataScope == "4" { + table = table.Where(tbname+".create_by in (SELECT user_id from sys_user where sys_user.dept_id in(select dept_id from sys_dept where dept_path like ? ))", "%"+tools.IntToString(user.DeptId)+"%") + } + if role.DataScope == "5" || role.DataScope == "" { + table = table.Where(tbname+".create_by = ?", e.UserId) + } + + return table, nil +} diff --git a/models/dept.go b/models/dept.go new file mode 100644 index 0000000..d9f9b60 --- /dev/null +++ b/models/dept.go @@ -0,0 +1,256 @@ +package models + +import ( + "errors" + "ferry/global/orm" + "ferry/tools" + _ "time" +) + +type Dept struct { + DeptId int `json:"deptId" gorm:"primary_key;AUTO_INCREMENT"` //部门编码 + ParentId int `json:"parentId" gorm:"type:int(11);"` //上级部门 + DeptPath string `json:"deptPath" gorm:"type:varchar(255);"` // + DeptName string `json:"deptName" gorm:"type:varchar(128);"` //部门名称 + Sort int `json:"sort" gorm:"type:int(4);"` //排序 + Leader string `json:"leader" gorm:"type:varchar(128);"` //负责人 + Phone string `json:"phone" gorm:"type:varchar(11);"` //手机 + Email string `json:"email" gorm:"type:varchar(64);"` //邮箱 + Status string `json:"status" gorm:"type:int(1);"` //状态 + CreateBy string `json:"createBy" gorm:"type:varchar(64);"` + UpdateBy string `json:"updateBy" gorm:"type:varchar(64);"` + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + Children []Dept `json:"children" gorm:"-"` + BaseModel +} + +func (Dept) TableName() string { + return "sys_dept" +} + +type DeptLable struct { + Id int `gorm:"-" json:"id"` + Label string `gorm:"-" json:"label"` + Children []DeptLable `gorm:"-" json:"children"` +} + +func (e *Dept) Create() (Dept, error) { + var doc Dept + result := orm.Eloquent.Table(e.TableName()).Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + deptPath := "/" + tools.IntToString(e.DeptId) + if int(e.ParentId) != 0 { + var deptP Dept + orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.ParentId).First(&deptP) + deptPath = deptP.DeptPath + deptPath + } else { + deptPath = "/0" + deptPath + } + var mp = map[string]string{} + mp["deptPath"] = deptPath + if err := orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.DeptId).Update(mp).Error; err != nil { + err := result.Error + return doc, err + } + doc = *e + doc.DeptPath = deptPath + return doc, nil +} + +func (e *Dept) Get() (Dept, error) { + var doc Dept + + table := orm.Eloquent.Table(e.TableName()) + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + if e.DeptName != "" { + table = table.Where("dept_name = ?", e.DeptName) + } + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +func (e *Dept) GetList() ([]Dept, error) { + var doc []Dept + + table := orm.Eloquent.Table(e.TableName()) + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + if e.DeptName != "" { + table = table.Where("dept_name = ?", e.DeptName) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + + if err := table.Order("sort").Find(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +func (e *Dept) GetPage(bl bool) ([]Dept, error) { + var doc []Dept + + table := orm.Eloquent.Select("*").Table(e.TableName()) + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + if e.DeptName != "" { + table = table.Where("dept_name = ?", e.DeptName) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + if e.DeptPath != "" { + table = table.Where("deptPath like %?%", e.DeptPath) + } + if bl { + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + tableper, err := dataPermission.GetDataScope("sys_dept", table) + if err != nil { + return nil, err + } + table = tableper + } + + if err := table.Order("sort").Find(&doc).Error; err != nil { + return nil, err + } + return doc, nil +} + +func (e *Dept) SetDept(bl bool) ([]Dept, error) { + list, err := e.GetPage(bl) + + m := make([]Dept, 0) + for i := 0; i < len(list); i++ { + if list[i].ParentId != 0 { + continue + } + info := Digui(&list, list[i]) + + m = append(m, info) + } + return m, err +} + +func Digui(deptlist *[]Dept, menu Dept) Dept { + list := *deptlist + + min := make([]Dept, 0) + for j := 0; j < len(list); j++ { + + if menu.DeptId != list[j].ParentId { + continue + } + mi := Dept{} + mi.DeptId = list[j].DeptId + mi.ParentId = list[j].ParentId + mi.DeptPath = list[j].DeptPath + mi.DeptName = list[j].DeptName + mi.Sort = list[j].Sort + mi.Leader = list[j].Leader + mi.Phone = list[j].Phone + mi.Email = list[j].Email + mi.Status = list[j].Status + mi.Children = []Dept{} + ms := Digui(deptlist, mi) + min = append(min, ms) + + } + menu.Children = min + return menu +} + +func (e *Dept) Update(id int) (update Dept, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", id).First(&update).Error; err != nil { + return + } + + deptPath := "/" + tools.IntToString(e.DeptId) + if int(e.ParentId) != 0 { + var deptP Dept + orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.ParentId).First(&deptP) + deptPath = deptP.DeptPath + deptPath + } else { + deptPath = "/0" + deptPath + } + e.DeptPath = deptPath + + if e.DeptPath != "" && e.DeptPath != update.DeptPath { + return update, errors.New("上级部门不允许修改!") + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + + return +} + +func (e *Dept) Delete(id int) (success bool, err error) { + + user := SysUser{} + user.DeptId = id + userlist, err := user.GetList() + tools.HasError(err, "", 500) + tools.Assert(len(userlist) <= 0, "当前部门存在用户,不能删除!", 500) + + if err = orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", id).Delete(&Dept{}).Error; err != nil { + success = false + return + } + success = true + return +} + +func (dept *Dept) SetDeptLable() (m []DeptLable, err error) { + deptlist, err := dept.GetList() + + m = make([]DeptLable, 0) + for i := 0; i < len(deptlist); i++ { + if deptlist[i].ParentId != 0 { + continue + } + e := DeptLable{} + e.Id = deptlist[i].DeptId + e.Label = deptlist[i].DeptName + deptsInfo := DiguiDeptLable(&deptlist, e) + + m = append(m, deptsInfo) + } + return +} + +func DiguiDeptLable(deptlist *[]Dept, dept DeptLable) DeptLable { + list := *deptlist + + min := make([]DeptLable, 0) + for j := 0; j < len(list); j++ { + + if dept.Id != list[j].ParentId { + continue + } + mi := DeptLable{list[j].DeptId, list[j].DeptName, []DeptLable{}} + ms := DiguiDeptLable(deptlist, mi) + min = append(min, ms) + + } + dept.Children = min + return dept +} diff --git a/models/gorm/gorm.go b/models/gorm/gorm.go new file mode 100644 index 0000000..0854855 --- /dev/null +++ b/models/gorm/gorm.go @@ -0,0 +1,29 @@ +package gorm + +import ( + "ferry/models" + "ferry/models/tools" + + "github.com/jinzhu/gorm" +) + +func AutoMigrate(db *gorm.DB) error { + db.SingularTable(true) + return db.AutoMigrate( + new(models.CasbinRule), + new(tools.SysTables), + new(tools.SysColumns), + new(models.Dept), + new(models.Menu), + new(models.LoginLog), + new(models.SysOperLog), + new(models.RoleMenu), + new(models.SysRoleDept), + new(models.SysUser), + new(models.SysRole), + new(models.Post), + new(models.DictData), + new(models.SysConfig), + new(models.DictType), + ).Error +} diff --git a/models/initdb.go b/models/initdb.go new file mode 100644 index 0000000..a7ed293 --- /dev/null +++ b/models/initdb.go @@ -0,0 +1,47 @@ +package models + +import ( + "ferry/global/orm" + config2 "ferry/tools/config" + "fmt" + "io/ioutil" + "strings" +) + +func InitDb() error { + filePath := "config/db.sql" + if config2.DatabaseConfig.Dbtype == "sqlite3" { + fmt.Println("sqlite3数据库无需初始化!") + return nil + } + 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) + if err = orm.Eloquent.Exec(sql).Error; err != nil { + if !strings.Contains(err.Error(), "Query was empty") { + return err + } + } + } + return nil +} + +func Ioutil(name string) (string, error) { + if contents, err := ioutil.ReadFile(name); 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 + } +} diff --git a/models/login.go b/models/login.go new file mode 100644 index 0000000..99347c7 --- /dev/null +++ b/models/login.go @@ -0,0 +1,30 @@ +package models + +import ( + "ferry/global/orm" + "ferry/tools" +) + +type Login struct { + Username string `form:"UserName" json:"username" binding:"required"` + Password string `form:"Password" json:"password" binding:"required"` + Code string `form:"Code" json:"code" binding:"required"` + UUID string `form:"UUID" json:"uuid" binding:"required"` +} + +func (u *Login) GetUser() (user SysUser, role SysRole, e error) { + + e = orm.Eloquent.Table("sys_user").Where("username = ? ", u.Username).Find(&user).Error + if e != nil { + return + } + _, e = tools.CompareHashAndPassword(user.Password, u.Password) + if e != nil { + return + } + e = orm.Eloquent.Table("sys_role").Where("role_id = ? ", user.RoleId).First(&role).Error + if e != nil { + return + } + return +} diff --git a/models/loginlog.go b/models/loginlog.go new file mode 100644 index 0000000..ba0b51c --- /dev/null +++ b/models/loginlog.go @@ -0,0 +1,104 @@ +package models + +import ( + "ferry/global/orm" + "time" +) + +type LoginLog struct { + InfoId int `json:"infoId" gorm:"primary_key;AUTO_INCREMENT"` //主键 + Username string `json:"username" gorm:"type:varchar(128);"` //用户名 + Status string `json:"status" gorm:"type:int(1);"` //状态 + Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);"` //ip地址 + LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);"` //归属地 + Browser string `json:"browser" gorm:"type:varchar(255);"` //浏览器 + Os string `json:"os" gorm:"type:varchar(255);"` //系统 + Platform string `json:"platform" gorm:"type:varchar(255);"` // 固件 + LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;"` //登录时间 + CreateBy string `json:"createBy" gorm:"type:varchar(128);"` //创建人 + UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` //更新者 + DataScope string `json:"dataScope" gorm:"-"` //数据 + Params string `json:"params" gorm:"-"` // + Remark string `json:"remark" gorm:"type:varchar(255);"` //备注 + Msg string `json:"msg" gorm:"type:varchar(255);"` + BaseModel +} + +func (LoginLog) TableName() string { + return "sys_loginlog" +} + +func (e *LoginLog) Get() (LoginLog, error) { + var doc LoginLog + + table := orm.Eloquent.Table(e.TableName()) + if e.Ipaddr != "" { + table = table.Where("ipaddr = ?", e.Ipaddr) + } + if e.InfoId != 0 { + table = table.Where("info_id = ?", e.InfoId) + } + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +func (e *LoginLog) GetPage(pageSize int, pageIndex int) ([]LoginLog, int, error) { + var doc []LoginLog + + table := orm.Eloquent.Select("*").Table(e.TableName()) + if e.Ipaddr != "" { + table = table.Where("ipaddr = ?", e.Ipaddr) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + if e.Username != "" { + table = table.Where("userName = ?", e.Username) + } + + var count int + + if err := table.Order("info_id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("`deleted_at` IS NULL").Count(&count) + return doc, count, nil +} + +func (e *LoginLog) Create() (LoginLog, error) { + var doc LoginLog + e.CreateBy = "0" + e.UpdateBy = "0" + result := orm.Eloquent.Table(e.TableName()).Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + return doc, nil +} + +func (e *LoginLog) Update(id int) (update LoginLog, err error) { + + if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + return +} + +func (e *LoginLog) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("info_id in (?)", id).Delete(&LoginLog{}).Error; err != nil { + return + } + Result = true + return +} diff --git a/models/menu.go b/models/menu.go new file mode 100644 index 0000000..899b87c --- /dev/null +++ b/models/menu.go @@ -0,0 +1,328 @@ +package models + +import ( + "errors" + "ferry/global/orm" + "ferry/tools" +) + +type Menu struct { + MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` + MenuName string `json:"menuName" gorm:"type:varchar(128);"` + Title string `json:"title" gorm:"type:varchar(64);"` + Icon string `json:"icon" gorm:"type:varchar(128);"` + Path string `json:"path" gorm:"type:varchar(128);"` + Paths string `json:"paths" gorm:"type:varchar(128);"` + MenuType string `json:"menuType" gorm:"type:varchar(1);"` + Action string `json:"action" gorm:"type:varchar(16);"` + Permission string `json:"permission" gorm:"type:varchar(32);"` + ParentId int `json:"parentId" gorm:"type:int(11);"` + NoCache bool `json:"noCache" gorm:"type:char(1);"` + Breadcrumb string `json:"breadcrumb" gorm:"type:varchar(255);"` + Component string `json:"component" gorm:"type:varchar(255);"` + Sort int `json:"sort" gorm:"type:int(4);"` + Visible string `json:"visible" gorm:"type:char(1);"` + CreateBy string `json:"createBy" gorm:"type:varchar(128);"` + UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` + IsFrame string `json:"isFrame" gorm:"type:int(1);DEFAULT:0;"` + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + RoleId int `gorm:"-"` + Children []Menu `json:"children" gorm:"-"` + IsSelect bool `json:"is_select" gorm:"-"` + BaseModel +} + +func (Menu) TableName() string { + return "sys_menu" +} + +type MenuLable struct { + Id int `json:"id" gorm:"-"` + Label string `json:"label" gorm:"-"` + Children []MenuLable `json:"children" gorm:"-"` +} + +type Menus struct { + MenuId int `json:"menuId" gorm:"column:menu_id;primary_key"` + MenuName string `json:"menuName" gorm:"column:menu_name"` + Title string `json:"title" gorm:"column:title"` + Icon string `json:"icon" gorm:"column:icon"` + Path string `json:"path" gorm:"column:path"` + MenuType string `json:"menuType" gorm:"column:menu_type"` + Action string `json:"action" gorm:"column:action"` + Permission string `json:"permission" gorm:"column:permission"` + ParentId int `json:"parentId" gorm:"column:parent_id"` + NoCache bool `json:"noCache" gorm:"column:no_cache"` + Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"` + Component string `json:"component" gorm:"column:component"` + Sort int `json:"sort" gorm:"column:sort"` + + Visible string `json:"visible" gorm:"column:visible"` + Children []Menu `json:"children" gorm:"-"` + + CreateBy string `json:"createBy" gorm:"column:create_by"` + UpdateBy string `json:"updateBy" gorm:"column:update_by"` + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + BaseModel +} + +func (Menus) TableName() string { + return "sys_menu" +} + +type MenuRole struct { + Menus + IsSelect bool `json:"is_select" gorm:"-"` +} + +type MS []Menu + +func (e *Menu) GetByMenuId() (Menu Menu, err error) { + + table := orm.Eloquent.Table(e.TableName()) + table = table.Where("menu_id = ?", e.MenuId) + if err = table.Find(&Menu).Error; err != nil { + return + } + return +} + +func (e *Menu) SetMenu() (m []Menu, err error) { + menulist, err := e.GetPage() + + m = make([]Menu, 0) + for i := 0; i < len(menulist); i++ { + if menulist[i].ParentId != 0 { + continue + } + menusInfo := DiguiMenu(&menulist, menulist[i]) + + m = append(m, menusInfo) + } + return +} + +func DiguiMenu(menulist *[]Menu, menu Menu) Menu { + list := *menulist + + min := make([]Menu, 0) + for j := 0; j < len(list); j++ { + + if menu.MenuId != list[j].ParentId { + continue + } + mi := Menu{} + mi.MenuId = list[j].MenuId + mi.MenuName = list[j].MenuName + mi.Title = list[j].Title + mi.Icon = list[j].Icon + mi.Path = list[j].Path + mi.MenuType = list[j].MenuType + mi.Action = list[j].Action + mi.Permission = list[j].Permission + mi.ParentId = list[j].ParentId + mi.NoCache = list[j].NoCache + mi.Breadcrumb = list[j].Breadcrumb + mi.Component = list[j].Component + mi.Sort = list[j].Sort + mi.Visible = list[j].Visible + mi.Children = []Menu{} + + if mi.MenuType != "F" { + ms := DiguiMenu(menulist, mi) + min = append(min, ms) + + } else { + min = append(min, mi) + } + + } + menu.Children = min + return menu +} + +func (e *Menu) SetMenuLable() (m []MenuLable, err error) { + menulist, err := e.Get() + + m = make([]MenuLable, 0) + for i := 0; i < len(menulist); i++ { + if menulist[i].ParentId != 0 { + continue + } + e := MenuLable{} + e.Id = menulist[i].MenuId + e.Label = menulist[i].Title + menusInfo := DiguiMenuLable(&menulist, e) + + m = append(m, menusInfo) + } + return +} + +func DiguiMenuLable(menulist *[]Menu, menu MenuLable) MenuLable { + list := *menulist + + min := make([]MenuLable, 0) + for j := 0; j < len(list); j++ { + + if menu.Id != list[j].ParentId { + continue + } + mi := MenuLable{} + mi.Id = list[j].MenuId + mi.Label = list[j].Title + mi.Children = []MenuLable{} + if list[j].MenuType != "F" { + ms := DiguiMenuLable(menulist, mi) + min = append(min, ms) + } else { + min = append(min, mi) + } + + } + menu.Children = min + return menu +} + +func (e *Menu) SetMenuRole(rolename string) (m []Menu, err error) { + + menulist, err := e.GetByRoleName(rolename) + + m = make([]Menu, 0) + for i := 0; i < len(menulist); i++ { + if menulist[i].ParentId != 0 { + continue + } + menusInfo := DiguiMenu(&menulist, menulist[i]) + + m = append(m, menusInfo) + } + return +} + +func (e *MenuRole) Get() (Menus []MenuRole, err error) { + table := orm.Eloquent.Table(e.TableName()) + if e.MenuName != "" { + table = table.Where("menu_name = ?", e.MenuName) + } + if err = table.Order("sort").Find(&Menus).Error; err != nil { + return + } + return +} + +func (e *Menu) GetByRoleName(rolename string) (Menus []Menu, err error) { + table := orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") + table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename) + if err = table.Order("sort").Find(&Menus).Error; err != nil { + return + } + return +} + +func (e *Menu) Get() (Menus []Menu, err error) { + table := orm.Eloquent.Table(e.TableName()) + if e.MenuName != "" { + table = table.Where("menu_name = ?", e.MenuName) + } + if e.Path != "" { + table = table.Where("path = ?", e.Path) + } + if e.Action != "" { + table = table.Where("action = ?", e.Action) + } + if e.MenuType != "" { + table = table.Where("menu_type = ?", e.MenuType) + } + + if err = table.Order("sort").Find(&Menus).Error; err != nil { + return + } + return +} + +func (e *Menu) GetPage() (Menus []Menu, err error) { + table := orm.Eloquent.Table(e.TableName()) + if e.MenuName != "" { + table = table.Where("menu_name = ?", e.MenuName) + } + if e.Title != "" { + table = table.Where("title = ?", e.Title) + } + if e.Visible != "" { + table = table.Where("visible = ?", e.Visible) + } + if e.MenuType != "" { + table = table.Where("menu_type = ?", e.MenuType) + } + + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + table, err = dataPermission.GetDataScope("sys_menu", table) + if err != nil { + return nil, err + } + if err = table.Order("sort").Find(&Menus).Error; err != nil { + return + } + return +} + +func (e *Menu) Create() (id int, err error) { + result := orm.Eloquent.Table(e.TableName()).Create(&e) + if result.Error != nil { + err = result.Error + return + } + err = InitPaths(e) + if err != nil { + return + } + id = e.MenuId + return +} + +func InitPaths(menu *Menu) (err error) { + parentMenu := new(Menu) + if int(menu.ParentId) != 0 { + orm.Eloquent.Table("sys_menu").Where("menu_id = ?", menu.ParentId).First(parentMenu) + if parentMenu.Paths == "" { + err = errors.New("父级paths异常,请尝试对当前节点父级菜单进行更新操作!") + return + } + menu.Paths = parentMenu.Paths + "/" + tools.IntToString(menu.MenuId) + } else { + menu.Paths = "/0/" + tools.IntToString(menu.MenuId) + } + orm.Eloquent.Table("sys_menu").Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths) + return +} + +func (e *Menu) Update(id int) (update Menu, err error) { + if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + err = InitPaths(e) + if err != nil { + return + } + return +} + +func (e *Menu) Delete(id int) (success bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("menu_id = ?", id).Delete(&Menu{}).Error; err != nil { + success = false + return + } + success = true + return +} diff --git a/models/model.go b/models/model.go new file mode 100644 index 0000000..1293241 --- /dev/null +++ b/models/model.go @@ -0,0 +1,11 @@ +package models + +import ( + "time" +) + +type BaseModel struct { + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt *time.Time `sql:"index" json:"deletedAt"` +} diff --git a/models/post.go b/models/post.go new file mode 100644 index 0000000..a4ebfb8 --- /dev/null +++ b/models/post.go @@ -0,0 +1,144 @@ +package models + +import ( + "ferry/global/orm" + "ferry/tools" +) + +type Post struct { + PostId int `gorm:"primary_key;AUTO_INCREMENT" json:"postId"` //岗位编号 + PostName string `gorm:"type:varchar(128);" json:"postName"` //岗位名称 + PostCode string `gorm:"type:varchar(128);" json:"postCode"` //岗位代码 + Sort int `gorm:"type:int(4);" json:"sort"` //岗位排序 + Status string `gorm:"type:int(1);" json:"status"` //状态 + Remark string `gorm:"type:varchar(255);" json:"remark"` //描述 + CreateBy string `gorm:"type:varchar(128);" json:"createBy"` + UpdateBy string `gorm:"type:varchar(128);" json:"updateBy"` + DataScope string `gorm:"-" json:"dataScope"` + Params string `gorm:"-" json:"params"` + BaseModel +} + +func (Post) TableName() string { + return "sys_post" +} + +func (e *Post) Create() (Post, error) { + var doc Post + result := orm.Eloquent.Table(e.TableName()).Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + return doc, nil +} + +func (e *Post) Get() (Post, error) { + var doc Post + + table := orm.Eloquent.Table(e.TableName()) + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + if e.PostName != "" { + table = table.Where("post_name = ?", e.PostName) + } + if e.PostCode != "" { + table = table.Where("post_code = ?", e.PostCode) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +func (e *Post) GetList() ([]Post, error) { + var doc []Post + + table := orm.Eloquent.Table(e.TableName()) + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + if e.PostName != "" { + table = table.Where("post_name = ?", e.PostName) + } + if e.PostCode != "" { + table = table.Where("post_code = ?", e.PostCode) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + + if err := table.Find(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +func (e *Post) GetPage(pageSize int, pageIndex int) ([]Post, int, error) { + var doc []Post + + table := orm.Eloquent.Select("*").Table(e.TableName()) + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + if e.PostName != "" { + table = table.Where("post_name = ?", e.PostName) + } + if e.PostCode != "" { + table = table.Where("post_code = ?", e.PostCode) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + table, err := dataPermission.GetDataScope("sys_post", table) + if err != nil { + return nil, 0, err + } + var count int + + if err := table.Order("sort").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("`deleted_at` IS NULL").Count(&count) + return doc, count, nil +} + +func (e *Post) Update(id int) (update Post, err error) { + if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + return +} + +func (e *Post) Delete(id int) (success bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("post_id = ?", id).Delete(&Post{}).Error; err != nil { + success = false + return + } + success = true + return +} + +func (e *Post) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("post_id in (?)", id).Delete(&Post{}).Error; err != nil { + return + } + Result = true + return +} diff --git a/models/role.go b/models/role.go new file mode 100644 index 0000000..1c18e62 --- /dev/null +++ b/models/role.go @@ -0,0 +1,176 @@ +package models + +import ( + "ferry/global/orm" + "ferry/tools" + + "github.com/pkg/errors" +) + +type SysRole struct { + RoleId int `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"` // 角色编码 + RoleName string `json:"roleName" gorm:"type:varchar(128);"` // 角色名称 + Status string `json:"status" gorm:"type:int(1);"` // + RoleKey string `json:"roleKey" gorm:"type:varchar(128);"` //角色代码 + RoleSort int `json:"roleSort" gorm:"type:int(4);"` //角色排序 + Flag string `json:"flag" gorm:"type:varchar(128);"` // + CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // + UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // + Remark string `json:"remark" gorm:"type:varchar(255);"` //备注 + Admin bool `json:"admin" gorm:"type:char(1);"` + DataScope string `json:"dataScope" gorm:"type:varchar(128);"` + Params string `json:"params" gorm:"-"` + MenuIds []int `json:"menuIds" gorm:"-"` + DeptIds []int `json:"deptIds" gorm:"-"` + BaseModel +} + +func (SysRole) TableName() string { + return "sys_role" +} + +type MenuIdList struct { + MenuId int `json:"menuId"` +} + +func (e *SysRole) GetPage(pageSize int, pageIndex int) ([]SysRole, int, error) { + var doc []SysRole + + table := orm.Eloquent.Select("*").Table("sys_role") + if e.RoleId != 0 { + table = table.Where("role_id = ?", e.RoleId) + } + if e.RoleName != "" { + table = table.Where("role_name = ?", e.RoleName) + } + if e.Status != "" { + table = table.Where("status = ?", e.Status) + } + if e.RoleKey != "" { + table = table.Where("role_key = ?", e.RoleKey) + } + + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + table, err := dataPermission.GetDataScope("sys_role", table) + if err != nil { + return nil, 0, err + } + var count int + + if err := table.Order("role_sort").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("`deleted_at` IS NULL").Count(&count) + return doc, count, nil +} + +func (role *SysRole) Get() (SysRole SysRole, err error) { + table := orm.Eloquent.Table("sys_role") + if role.RoleId != 0 { + table = table.Where("role_id = ?", role.RoleId) + } + if role.RoleName != "" { + table = table.Where("role_name = ?", role.RoleName) + } + if err = table.First(&SysRole).Error; err != nil { + return + } + + return +} + +func (role *SysRole) GetList() (SysRole []SysRole, err error) { + table := orm.Eloquent.Table("sys_role") + if role.RoleId != 0 { + table = table.Where("role_id = ?", role.RoleId) + } + if role.RoleName != "" { + table = table.Where("role_name = ?", role.RoleName) + } + if err = table.Order("role_sort").Find(&SysRole).Error; err != nil { + return + } + + return +} + +// 获取角色对应的菜单ids +func (role *SysRole) GetRoleMeunId() ([]int, error) { + menuIds := make([]int, 0) + menuList := make([]MenuIdList, 0) + if err := orm.Eloquent.Table("sys_role_menu").Select("sys_role_menu.menu_id").Joins("LEFT JOIN sys_menu on sys_menu.menu_id=sys_role_menu.menu_id").Where("role_id = ? ", role.RoleId).Where(" sys_role_menu.menu_id not in(select sys_menu.parent_id from sys_role_menu LEFT JOIN sys_menu on sys_menu.menu_id=sys_role_menu.menu_id where role_id =? )", role.RoleId).Find(&menuList).Error; err != nil { + return nil, err + } + + for i := 0; i < len(menuList); i++ { + menuIds = append(menuIds, menuList[i].MenuId) + } + return menuIds, nil +} + +func (role *SysRole) Insert() (id int, err error) { + i := 0 + orm.Eloquent.Table("sys_role").Where("role_name=? or role_key = ?", role.RoleName, role.RoleKey).Count(&i) + if i > 0 { + return 0, errors.New("角色名称或者角色标识已经存在!") + } + role.UpdateBy = "" + result := orm.Eloquent.Table("sys_role").Create(&role) + if result.Error != nil { + err = result.Error + return + } + id = role.RoleId + return +} + +type DeptIdList struct { + DeptId int `json:"DeptId"` +} + +func (role *SysRole) GetRoleDeptId() ([]int, error) { + deptIds := make([]int, 0) + deptList := make([]DeptIdList, 0) + if err := orm.Eloquent.Table("sys_role_dept").Select("sys_role_dept.dept_id").Joins("LEFT JOIN sys_dept on sys_dept.dept_id=sys_role_dept.dept_id").Where("role_id = ? ", role.RoleId).Where(" sys_role_dept.dept_id not in(select sys_dept.parent_id from sys_role_dept LEFT JOIN sys_dept on sys_dept.dept_id=sys_role_dept.dept_id where role_id =? )", role.RoleId).Find(&deptList).Error; err != nil { + return nil, err + } + + for i := 0; i < len(deptList); i++ { + deptIds = append(deptIds, deptList[i].DeptId) + } + + return deptIds, nil +} + +//修改 +func (role *SysRole) Update(id int) (update SysRole, err error) { + if err = orm.Eloquent.Table("sys_role").First(&update, id).Error; err != nil { + return + } + + if role.RoleName != "" && role.RoleName != update.RoleName { + return update, errors.New("角色名称不允许修改!") + } + + if role.RoleKey != "" && role.RoleKey != update.RoleKey { + return update, errors.New("角色标识不允许修改!") + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table("sys_role").Model(&update).Updates(&role).Error; err != nil { + return + } + return +} + +//批量删除 +func (e *SysRole) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table("sys_role").Where("role_id in (?)", id).Delete(&SysRole{}).Error; err != nil { + return + } + Result = true + return +} diff --git a/models/roledept.go b/models/roledept.go new file mode 100644 index 0000000..0171e85 --- /dev/null +++ b/models/roledept.go @@ -0,0 +1,46 @@ +package models + +import ( + "ferry/global/orm" + "fmt" +) + +//sys_role_dept +type SysRoleDept struct { + RoleId int `gorm:"type:int(11)"` + DeptId int `gorm:"type:int(11)"` +} + +func (SysRoleDept) TableName() string { + return "sys_role_dept" +} + +func (rm *SysRoleDept) Insert(roleId int, deptIds []int) (bool, error) { + //ORM不支持批量插入所以需要拼接 sql 串 + sql := "INSERT INTO `sys_role_dept` (`role_id`,`dept_id`) VALUES " + + for i := 0; i < len(deptIds); i++ { + if len(deptIds)-1 == i { + //最后一条数据 以分号结尾 + sql += fmt.Sprintf("(%d,%d);", roleId, deptIds[i]) + } else { + sql += fmt.Sprintf("(%d,%d),", roleId, deptIds[i]) + } + } + orm.Eloquent.Exec(sql) + + return true, nil +} + +func (rm *SysRoleDept) DeleteRoleDept(roleId int) (bool, error) { + if err := orm.Eloquent.Table("sys_role_dept").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { + return false, err + } + var role SysRole + if err := orm.Eloquent.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { + return false, err + } + + return true, nil + +} diff --git a/models/rolemenu.go b/models/rolemenu.go new file mode 100644 index 0000000..46cc48f --- /dev/null +++ b/models/rolemenu.go @@ -0,0 +1,147 @@ +package models + +import ( + "ferry/global/orm" + "ferry/tools" + "fmt" +) + +type RoleMenu struct { + RoleId int `gorm:"type:int(11)"` + MenuId int `gorm:"type:int(11)"` + RoleName string `gorm:"type:varchar(128)"` + CreateBy string `gorm:"type:varchar(128)"` + UpdateBy string `gorm:"type:varchar(128)"` +} + +func (RoleMenu) TableName() string { + return "sys_role_menu" +} + +type MenuPath struct { + Path string `json:"path"` +} + +func (rm *RoleMenu) Get() ([]RoleMenu, error) { + var r []RoleMenu + table := orm.Eloquent.Table("sys_role_menu") + if rm.RoleId != 0 { + table = table.Where("role_id = ?", rm.RoleId) + + } + if err := table.Find(&r).Error; err != nil { + return nil, err + } + return r, nil +} + +func (rm *RoleMenu) GetPermis() ([]string, error) { + var r []Menu + table := orm.Eloquent.Select("sys_menu.permission").Table("sys_menu").Joins("left join sys_role_menu on sys_menu.menu_id = sys_role_menu.menu_id") + + table = table.Where("role_id = ?", rm.RoleId) + + table = table.Where("sys_menu.menu_type in('F','C')") + if err := table.Find(&r).Error; err != nil { + return nil, err + } + var list []string + for i := 0; i < len(r); i++ { + list = append(list, r[i].Permission) + } + return list, nil +} + +func (rm *RoleMenu) GetIDS() ([]MenuPath, error) { + var r []MenuPath + table := orm.Eloquent.Select("sys_menu.path").Table("sys_role_menu") + table = table.Joins("left join sys_role on sys_role.role_id=sys_role_menu.role_id") + table = table.Joins("left join sys_menu on sys_menu.id=sys_role_menu.menu_id") + table = table.Where("sys_role.role_name = ? and sys_menu.type=1", rm.RoleName) + if err := table.Find(&r).Error; err != nil { + return nil, err + } + return r, nil +} + +func (rm *RoleMenu) DeleteRoleMenu(roleId int) (bool, error) { + if err := orm.Eloquent.Table("sys_role_dept").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { + return false, err + } + if err := orm.Eloquent.Table("sys_role_menu").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { + return false, err + } + var role SysRole + if err := orm.Eloquent.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { + return false, err + } + sql3 := "delete from casbin_rule where v0= '" + role.RoleKey + "';" + orm.Eloquent.Exec(sql3) + + return true, nil + +} + +func (rm *RoleMenu) BatchDeleteRoleMenu(roleIds []int) (bool, error) { + if err := orm.Eloquent.Table("sys_role_menu").Where("role_id in (?)", roleIds).Delete(&rm).Error; err != nil { + return false, err + } + var role []SysRole + if err := orm.Eloquent.Table("sys_role").Where("role_id in (?)", roleIds).Find(&role).Error; err != nil { + return false, err + } + sql := "" + for i := 0; i < len(role); i++ { + sql += "delete from casbin_rule where v0= '" + role[i].RoleName + "';" + } + orm.Eloquent.Exec(sql) + return true, nil + +} + +func (rm *RoleMenu) Insert(roleId int, menuId []int) (bool, error) { + var role SysRole + if err := orm.Eloquent.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { + return false, err + } + var menu []Menu + if err := orm.Eloquent.Table("sys_menu").Where("menu_id in (?)", menuId).Find(&menu).Error; err != nil { + return false, err + } + //ORM不支持批量插入所以需要拼接 sql 串 + sql := "INSERT INTO `sys_role_menu` (`role_id`,`menu_id`,`role_name`) VALUES " + + sql2 := "INSERT INTO casbin_rule (`p_type`,`v0`,`v1`,`v2`) VALUES " + for i := 0; i < len(menu); i++ { + if len(menu)-1 == i { + //最后一条数据 以分号结尾 + sql += fmt.Sprintf("(%d,%d,'%s');", role.RoleId, menu[i].MenuId, role.RoleKey) + if menu[i].MenuType == "A" { + sql2 += fmt.Sprintf("('p','%s','%s','%s');", role.RoleKey, menu[i].Path, menu[i].Action) + } + } else { + sql += fmt.Sprintf("(%d,%d,'%s'),", role.RoleId, menu[i].MenuId, role.RoleKey) + if menu[i].MenuType == "A" { + sql2 += fmt.Sprintf("('p','%s','%s','%s'),", role.RoleKey, menu[i].Path, menu[i].Action) + } + } + } + orm.Eloquent.Exec(sql) + sql2 = sql2[0:len(sql2)-1] + ";" + orm.Eloquent.Exec(sql2) + + return true, nil +} + +func (rm *RoleMenu) Delete(RoleId string, MenuID string) (bool, error) { + rm.RoleId, _ = tools.StringToInt(RoleId) + table := orm.Eloquent.Table("sys_role_menu").Where("role_id = ?", RoleId) + if MenuID != "" { + table = table.Where("menu_id = ?", MenuID) + } + if err := table.Delete(&rm).Error; err != nil { + return false, err + } + return true, nil + +} diff --git a/models/sysuser.go b/models/sysuser.go new file mode 100644 index 0000000..1048248 --- /dev/null +++ b/models/sysuser.go @@ -0,0 +1,317 @@ +package models + +import ( + "errors" + "ferry/global/orm" + "ferry/tools" + "strings" + + log "github.com/sirupsen/logrus" + "golang.org/x/crypto/bcrypt" +) + +// User +type User struct { + // key + IdentityKey string + // 用户名 + UserName string + FirstName string + LastName string + // 角色 + Role string +} + +type UserName struct { + Username string `gorm:"type:varchar(64)" json:"username"` +} + +type PassWord struct { + // 密码 + Password string `gorm:"type:varchar(128)" json:"password"` +} + +type LoginM struct { + UserName + PassWord +} + +type SysUserId struct { + UserId int `gorm:"primary_key;AUTO_INCREMENT" json:"userId"` // 编码 +} + +type SysUserB struct { + NickName string `gorm:"type:varchar(128)" json:"nickName"` // 昵称 + Phone string `gorm:"type:varchar(11)" json:"phone"` // 手机号 + RoleId int `gorm:"type:int(11)" json:"roleId"` // 角色编码 + Salt string `gorm:"type:varchar(255)" json:"salt"` //盐 + Avatar string `gorm:"type:varchar(255)" json:"avatar"` //头像 + Sex string `gorm:"type:varchar(255)" json:"sex"` //性别 + Email string `gorm:"type:varchar(128)" json:"email"` //邮箱 + DeptId int `gorm:"type:int(11)" json:"deptId"` //部门编码 + PostId int `gorm:"type:int(11)" json:"postId"` //职位编码 + CreateBy string `gorm:"type:varchar(128)" json:"createBy"` // + UpdateBy string `gorm:"type:varchar(128)" json:"updateBy"` // + Remark string `gorm:"type:varchar(255)" json:"remark"` //备注 + Status string `gorm:"type:int(1);" json:"status"` + DataScope string `gorm:"-" json:"dataScope"` + Params string `gorm:"-" json:"params"` + + BaseModel +} + +type SysUser struct { + SysUserId + SysUserB + LoginM +} + +func (SysUser) TableName() string { + return "sys_user" +} + +type SysUserPwd struct { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` +} + +type SysUserPage struct { + SysUserId + SysUserB + LoginM + DeptName string `gorm:"-" json:"deptName"` +} + +type SysUserView struct { + SysUserId + SysUserB + LoginM + RoleName string `gorm:"column:role_name" json:"role_name"` +} + +// 获取用户数据 +func (e *SysUser) Get() (SysUserView SysUserView, err error) { + + table := orm.Eloquent.Table(e.TableName()).Select([]string{"sys_user.*", "sys_role.role_name"}) + table = table.Joins("left join sys_role on sys_user.role_id=sys_role.role_id") + if e.UserId != 0 { + table = table.Where("user_id = ?", e.UserId) + } + + if e.Username != "" { + table = table.Where("username = ?", e.Username) + } + + if e.Password != "" { + table = table.Where("password = ?", e.Password) + } + + if e.RoleId != 0 { + table = table.Where("role_id = ?", e.RoleId) + } + + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + + if err = table.First(&SysUserView).Error; err != nil { + return + } + + SysUserView.Password = "" + return +} + +func (e *SysUser) GetUserInfo() (SysUserView SysUserView, err error) { + + table := orm.Eloquent.Table(e.TableName()).Select([]string{"sys_user.*", "sys_role.role_name"}) + table = table.Joins("left join sys_role on sys_user.role_id=sys_role.role_id") + if e.UserId != 0 { + table = table.Where("user_id = ?", e.UserId) + } + + if e.Username != "" { + table = table.Where("username = ?", e.Username) + } + + if e.Password != "" { + table = table.Where("password = ?", e.Password) + } + + if e.RoleId != 0 { + table = table.Where("role_id = ?", e.RoleId) + } + + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + + if err = table.First(&SysUserView).Error; err != nil { + return + } + return +} + +func (e *SysUser) GetList() (SysUserView []SysUserView, err error) { + + table := orm.Eloquent.Table(e.TableName()).Select([]string{"sys_user.*", "sys_role.role_name"}) + table = table.Joins("left join sys_role on sys_user.role_id=sys_role.role_id") + if e.UserId != 0 { + table = table.Where("user_id = ?", e.UserId) + } + + if e.Username != "" { + table = table.Where("username = ?", e.Username) + } + + if e.Password != "" { + table = table.Where("password = ?", e.Password) + } + + if e.RoleId != 0 { + table = table.Where("role_id = ?", e.RoleId) + } + + if e.DeptId != 0 { + table = table.Where("dept_id = ?", e.DeptId) + } + + if e.PostId != 0 { + table = table.Where("post_id = ?", e.PostId) + } + + if err = table.Find(&SysUserView).Error; err != nil { + return + } + return +} + +func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int, error) { + var doc []SysUserPage + table := orm.Eloquent.Select("sys_user.*,sys_dept.dept_name").Table(e.TableName()) + table = table.Joins("left join sys_dept on sys_dept.dept_id = sys_user.dept_id") + + if e.Username != "" { + table = table.Where("username = ?", e.Username) + } + if e.Status != "" { + table = table.Where("sys_user.status = ?", e.Status) + } + + if e.Phone != "" { + table = table.Where("sys_user.phone = ?", e.Phone) + } + + if e.DeptId != 0 { + table = table.Where("sys_user.dept_id in (select dept_id from sys_dept where dept_path like ? )", "%"+tools.IntToString(e.DeptId)+"%") + } + + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + table, err := dataPermission.GetDataScope("sys_user", table) + if err != nil { + return nil, 0, err + } + var count int + + if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("sys_user.deleted_at IS NULL").Count(&count) + return doc, count, nil +} + +//加密 +func (e *SysUser) Encrypt() (err error) { + if e.Password == "" { + return + } + + var hash []byte + if hash, err = bcrypt.GenerateFromPassword([]byte(e.Password), bcrypt.DefaultCost); err != nil { + return + } else { + e.Password = string(hash) + return + } +} + +//添加 +func (e SysUser) Insert() (id int, err error) { + if err = e.Encrypt(); err != nil { + return + } + + // check 用户名 + var count int + orm.Eloquent.Table(e.TableName()).Where("username = ?", e.Username).Count(&count) + if count > 0 { + err = errors.New("账户已存在!") + return + } + + //添加数据 + if err = orm.Eloquent.Table(e.TableName()).Create(&e).Error; err != nil { + return + } + id = e.UserId + return +} + +//修改 +func (e *SysUser) Update(id int) (update SysUser, err error) { + if e.Password != "" { + if err = e.Encrypt(); err != nil { + return + } + } + if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { + return + } + if e.RoleId == 0 { + e.RoleId = update.RoleId + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + return +} + +func (e *SysUser) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("user_id in (?)", id).Delete(&SysUser{}).Error; err != nil { + return + } + Result = true + return +} + +func (e *SysUser) SetPwd(pwd SysUserPwd) (Result bool, err error) { + user, err := e.GetUserInfo() + if err != nil { + tools.HasError(err, "获取用户数据失败(代码202)", 500) + } + _, err = tools.CompareHashAndPassword(user.Password, pwd.OldPassword) + if err != nil { + if strings.Contains(err.Error(), "hashedPassword is not the hash of the given password") { + tools.HasError(err, "密码错误(代码202)", 500) + } + log.Print(err) + return + } + e.Password = pwd.NewPassword + _, err = e.Update(e.UserId) + tools.HasError(err, "更新密码失败(代码202)", 500) + return +} diff --git a/models/tools/dbcolumns.go b/models/tools/dbcolumns.go new file mode 100644 index 0000000..f08821c --- /dev/null +++ b/models/tools/dbcolumns.go @@ -0,0 +1,61 @@ +package tools + +import ( + "errors" + "ferry/global/orm" + config2 "ferry/tools/config" +) + +type DBColumns struct { + TableSchema string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"` + TableName string `gorm:"column:TABLE_NAME" json:"tableName"` + ColumnName string `gorm:"column:COLUMN_NAME" json:"columnName"` + ColumnDefault string `gorm:"column:COLUMN_DEFAULT" json:"columnDefault"` + IsNullable string `gorm:"column:IS_NULLABLE" json:"isNullable"` + DataType string `gorm:"column:DATA_TYPE" json:"dataType"` + CharacterMaximumLength string `gorm:"column:CHARACTER_MAXIMUM_LENGTH" json:"characterMaximumLength"` + CharacterSetName string `gorm:"column:CHARACTER_SET_NAME" json:"characterSetName"` + ColumnType string `gorm:"column:COLUMN_TYPE" json:"columnType"` + ColumnKey string `gorm:"column:COLUMN_KEY" json:"columnKey"` + Extra string `gorm:"column:EXTRA" json:"extra"` + ColumnComment string `gorm:"column:COLUMN_COMMENT" json:"columnComment"` +} + +func (e *DBColumns) GetPage(pageSize int, pageIndex int) ([]DBColumns, int, error) { + var doc []DBColumns + + table := orm.Eloquent.Select("*").Table("information_schema.`COLUMNS`") + table = table.Where("table_schema= ? ", config2.DatabaseConfig.Name) + + if e.TableName != "" { + return nil, 0, errors.New("table name cannot be empty!") + } + + table = table.Where("TABLE_NAME = ?", e.TableName) + + var count int + + if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Count(&count) + return doc, count, nil +} + +func (e *DBColumns) GetList() ([]DBColumns, error) { + var doc []DBColumns + + table := orm.Eloquent.Select("*").Table("information_schema.columns") + table = table.Where("table_schema= ? ", config2.DatabaseConfig.Name) + + if e.TableName == "" { + return nil, errors.New("table name cannot be empty!") + } + + table = table.Where("TABLE_NAME = ?", e.TableName) + + if err := table.Find(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} diff --git a/models/tools/dbtables.go b/models/tools/dbtables.go new file mode 100644 index 0000000..d80f87a --- /dev/null +++ b/models/tools/dbtables.go @@ -0,0 +1,53 @@ +package tools + +import ( + "errors" + "ferry/global/orm" + config2 "ferry/tools/config" +) + +type DBTables struct { + TableName string `gorm:"column:TABLE_NAME" json:"tableName"` + Engine string `gorm:"column:ENGINE" json:"engine"` + TableRows string `gorm:"column:TABLE_ROWS" json:"tableRows"` + TableCollation string `gorm:"column:TABLE_COLLATION" json:"tableCollation"` + CreateTime string `gorm:"column:CREATE_TIME" json:"createTime"` + UpdateTime string `gorm:"column:UPDATE_TIME" json:"updateTime"` + TableComment string `gorm:"column:TABLE_COMMENT" json:"tableComment"` +} + +func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int, error) { + var doc []DBTables + + table := orm.Eloquent.Select("*").Table("information_schema.tables") + table = table.Where("TABLE_NAME not in (select table_name from " + config2.DatabaseConfig.Name + ".sys_tables) ") + table = table.Where("table_schema= ? ", config2.DatabaseConfig.Name) + + if e.TableName != "" { + table = table.Where("TABLE_NAME = ?", e.TableName) + } + + var count int + + if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Count(&count) + return doc, count, nil +} + +func (e *DBTables) Get() (DBTables, error) { + var doc DBTables + + table := orm.Eloquent.Select("*").Table("information_schema.tables") + table = table.Where("table_schema= ? ", config2.DatabaseConfig.Name) + if e.TableName == "" { + return doc, errors.New("table name cannot be empty!") + } + table = table.Where("TABLE_NAME = ?", e.TableName) + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} diff --git a/models/tools/syscolumns.go b/models/tools/syscolumns.go new file mode 100644 index 0000000..fa4438d --- /dev/null +++ b/models/tools/syscolumns.go @@ -0,0 +1,84 @@ +package tools + +import ( + "ferry/global/orm" + "ferry/models" +) + +type SysColumns struct { + ColumnId int `gorm:"primary_key;auto_increment" json:"columnId"` + TableId int `gorm:"type:int(11);" json:"tableId"` + ColumnName string `gorm:"type:varchar(128);" json:"columnName"` + ColumnComment string `gorm:"column:column_comment;type:varchar(128);" json:"columnComment"` + ColumnType string `gorm:"column:column_type;type:varchar(128);" json:"columnType"` + GoType string `gorm:"column:go_type;type:varchar(128);" json:"goType"` + GoField string `gorm:"column:go_field;type:varchar(128);" json:"goField"` + JsonField string `gorm:"column:json_field;type:varchar(128);" json:"jsonField"` + IsPk string `gorm:"column:is_pk;type:char(4);" json:"isPk"` + IsIncrement string `gorm:"column:is_increment;type:char(4);" json:"isIncrement"` + IsRequired string `gorm:"column:is_required;type:char(4);" json:"isRequired"` + IsInsert string `gorm:"column:is_insert;type:char(4);" json:"isInsert"` + IsEdit string `gorm:"column:is_edit;type:char(4);" json:"isEdit"` + IsList string `gorm:"column:is_list;type:char(4);" json:"isList"` + IsQuery string `gorm:"column:is_query;type:char(4);" json:"isQuery"` + QueryType string `gorm:"column:query_type;type:varchar(128);" json:"queryType"` + HtmlType string `gorm:"column:html_type;type:varchar(128);" json:"htmlType"` + DictType string `gorm:"column:dict_type;type:varchar(128);" json:"dictType"` + Sort int `gorm:"column:sort;type:int(4);" json:"sort"` + List string `gorm:"column:list;type:char(1);" json:"list"` + Pk bool `gorm:"column:pk;type:char(1);" json:"pk"` + Required bool `gorm:"column:required;type:char(1);" json:"required"` + SuperColumn bool `gorm:"column:super_column;type:char(1);" json:"superColumn"` + UsableColumn bool `gorm:"column:usable_column;type:char(1);" json:"usableColumn"` + Increment bool `gorm:"column:increment;type:char(1);" json:"increment"` + Insert bool `gorm:"column:insert;type:char(1);" json:"insert"` + Edit bool `gorm:"column:edit;type:char(1);" json:"edit"` + Query bool `gorm:"column:query;type:char(1);" json:"query"` + Remark string `gorm:"column:remark;type:varchar(255);" json:"remark"` + CreateBy string `gorm:"column:create_by;type:varchar(128);" json:"createBy"` + UpdateBy string `gorm:"column:update_By;type:varchar(128);" json:"updateBy"` + + models.BaseModel +} + +func (SysColumns) TableName() string { + return "sys_columns" +} + +func (e *SysColumns) GetList() ([]SysColumns, error) { + var doc []SysColumns + + table := orm.Eloquent.Select("*").Table("sys_columns") + + table = table.Where("table_id = ?", e.TableId) + + if err := table.Find(&doc).Error; err != nil { + return nil, err + } + return doc, nil +} + +func (e *SysColumns) Create() (SysColumns, error) { + var doc SysColumns + result := orm.Eloquent.Table("sys_columns").Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + return doc, nil +} + +func (e *SysColumns) Update() (update SysColumns, err error) { + if err = orm.Eloquent.Table("sys_columns").First(&update, e.ColumnId).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table("sys_columns").Model(&update).Updates(&e).Error; err != nil { + return + } + + return +} diff --git a/models/tools/systables.go b/models/tools/systables.go new file mode 100644 index 0000000..41b73d4 --- /dev/null +++ b/models/tools/systables.go @@ -0,0 +1,152 @@ +package tools + +import ( + "ferry/global/orm" + "ferry/models" +) + +type SysTables struct { + TableId int `gorm:"primary_key;auto_increment" json:"tableId"` //表编码 + TBName string `gorm:"column:table_name;type:varchar(255);" json:"tableName"` //表名称 + TableComment string `gorm:"type:varchar(255);" json:"tableComment"` //表备注 + ClassName string `gorm:"type:varchar(255);" json:"className"` //类名 + TplCategory string `gorm:"type:varchar(255);" json:"tplCategory"` + PackageName string `gorm:"type:varchar(255);" json:"packageName"` //包名 + ModuleName string `gorm:"type:varchar(255);" json:"moduleName"` //模块名 + BusinessName string `gorm:"type:varchar(255);" json:"businessName"` + FunctionName string `gorm:"type:varchar(255);" json:"functionName"` //功能名称 + FunctionAuthor string `gorm:"type:varchar(255);" json:"functionAuthor"` //功能作者 + PkColumn string `gorm:"type:varchar(255);" json:"pkColumn"` + PkGoField string `gorm:"type:varchar(255);" json:"pkGoField"` + PkJsonField string `gorm:"type:varchar(255);" json:"pkJsonField"` + Options string `gorm:"type:varchar(255);" json:"options"` + TreeCode string `gorm:"type:varchar(255);" json:"treeCode"` + TreeParentCode string `gorm:"type:varchar(255);" json:"treeParentCode"` + TreeName string `gorm:"type:varchar(255);" json:"treeName"` + Tree bool `gorm:"type:char(1);" json:"tree"` + Crud bool `gorm:"type:char(1);" json:"crud"` + Remark string `gorm:"type:varchar(255);" json:"remark"` + IsLogicalDelete string `gorm:"type:char(1);" json:"isLogicalDelete"` + LogicalDelete bool `gorm:"type:char(1);" json:"logicalDelete"` + LogicalDeleteColumn string `gorm:"type:varchar(128);" json:"logicalDeleteColumn"` + CreateBy string `gorm:"type:varchar(128);" json:"createBy"` + UpdateBy string `gorm:"type:varchar(128);" json:"updateBy"` + DataScope string `gorm:"-" json:"dataScope"` + Params Params `gorm:"-" json:"params"` + Columns []SysColumns `gorm:"-" json:"columns"` + + models.BaseModel +} + +func (SysTables) TableName() string { + return "sys_tables" +} + +type Params struct { + TreeCode string `gorm:"-" json:"treeCode"` + TreeParentCode string `gorm:"-" json:"treeParentCode"` + TreeName string `gorm:"-" json:"treeName"` +} + +func (e *SysTables) GetPage(pageSize int, pageIndex int) ([]SysTables, int, error) { + var doc []SysTables + + table := orm.Eloquent.Select("*").Table("sys_tables") + + if e.TBName != "" { + table = table.Where("table_name = ?", e.TBName) + } + if e.TableComment != "" { + table = table.Where("table_comment = ?", e.TableComment) + } + + var count int + + if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("`deleted_at` IS NULL").Count(&count) + return doc, count, nil +} + +func (e *SysTables) Get() (SysTables, error) { + var doc SysTables + var err error + table := orm.Eloquent.Select("*").Table("sys_tables") + + if e.TBName != "" { + table = table.Where("table_name = ?", e.TBName) + } + if e.TableId != 0 { + table = table.Where("table_id = ?", e.TableId) + } + if e.TableComment != "" { + table = table.Where("table_comment = ?", e.TableComment) + } + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + var col SysColumns + col.TableId = doc.TableId + if doc.Columns, err = col.GetList(); err != nil { + return doc, err + } + + return doc, nil +} + +func (e *SysTables) Create() (SysTables, error) { + var doc SysTables + result := orm.Eloquent.Table("sys_tables").Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + for i := 0; i < len(e.Columns); i++ { + e.Columns[i].TableId = doc.TableId + + e.Columns[i].Create() + } + + return doc, nil +} + +func (e *SysTables) Update() (update SysTables, err error) { + if err = orm.Eloquent.Table("sys_tables").First(&update, e.TableId).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table("sys_tables").Model(&update).Updates(&e).Error; err != nil { + return + } + + for i := 0; i < len(e.Columns); i++ { + _, _ = e.Columns[i].Update() + } + return +} + +func (e *SysTables) Delete() (success bool, err error) { + if err = orm.Eloquent.Table("sys_tables").Delete(SysTables{}, "table_id = ?", e.TableId).Error; err != nil { + success = false + return + } + if err = orm.Eloquent.Table("sys_columns").Delete(SysColumns{}, "table_id = ?", e.TableId).Error; err != nil { + success = false + return + } + success = true + return +} + +func (e *SysTables) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Unscoped().Table(e.TableName()).Where(" table_id in (?)", id).Delete(&SysColumns{}).Error; err != nil { + return + } + Result = true + return +} diff --git a/pkg/casbin/mycasbin.go b/pkg/casbin/mycasbin.go new file mode 100644 index 0000000..0e1ffed --- /dev/null +++ b/pkg/casbin/mycasbin.go @@ -0,0 +1,32 @@ +package mycasbin + +import ( + "ferry/global/orm" + "ferry/tools/config" + + "github.com/casbin/casbin/v2" + gormadapter "github.com/casbin/gorm-adapter/v2" + "github.com/go-kit/kit/endpoint" + _ "github.com/go-sql-driver/mysql" + log "github.com/sirupsen/logrus" +) + +var Em endpoint.Middleware + +func Casbin() (*casbin.Enforcer, error) { + conn := orm.MysqlConn + Apter, err := gormadapter.NewAdapter(config.DatabaseConfig.Dbtype, conn, true) + if err != nil { + return nil, err + } + e, err := casbin.NewEnforcer("config/rbac_model.conf", Apter) + if err != nil { + return nil, err + } + if err := e.LoadPolicy(); err == nil { + return e, err + } else { + log.Printf("casbin rbac_model or policy init error, message: %v \r\n", err.Error()) + return nil, err + } +} diff --git a/pkg/cronjob/testjob.go b/pkg/cronjob/testjob.go new file mode 100644 index 0000000..f6bdb27 --- /dev/null +++ b/pkg/cronjob/testjob.go @@ -0,0 +1,19 @@ +package cronjob + +import ( + "github.com/robfig/cron/v3" + log "github.com/sirupsen/logrus" +) + +func TestJob(c *cron.Cron) { + id, err := c.AddFunc("1 * * * *", func() { + + log.Println("Every hour on the one hour") + }) + if err != nil { + log.Println(err) + log.Println("start error") + } else { + log.Printf("Start Success; ID: %v \r\n", id) + } +} diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go new file mode 100644 index 0000000..23c8489 --- /dev/null +++ b/pkg/jwtauth/jwtauth.go @@ -0,0 +1,745 @@ +package jwtauth + +import ( + "crypto/rsa" + "errors" + config2 "ferry/tools/config" + "io/ioutil" + "net/http" + "strings" + "time" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" +) + +type MapClaims map[string]interface{} + +// GinJWTMiddleware provides a Json-Web-Token authentication implementation. On failure, a 401 HTTP response +// is returned. On success, the wrapped middleware is called, and the userID is made available as +// c.Get("userID").(string). +// Users can get a token by posting a json request to LoginHandler. The token then needs to be passed in +// the Authentication header. Example: Authorization:Bearer XXX_TOKEN_XXX +type GinJWTMiddleware struct { + // Realm name to display to the user. Required. + Realm string + + // signing algorithm - possible values are HS256, HS384, HS512 + // Optional, default is HS256. + SigningAlgorithm string + + // Secret key used for signing. Required. + Key []byte + + // Duration that a jwt token is valid. Optional, defaults to one hour. + Timeout time.Duration + + // This field allows clients to refresh their token until MaxRefresh has passed. + // Note that clients can refresh their token in the last moment of MaxRefresh. + // This means that the maximum validity timespan for a token is TokenTime + MaxRefresh. + // Optional, defaults to 0 meaning not refreshable. + MaxRefresh time.Duration + + // Callback function that should perform the authentication of the user based on login info. + // Must return user data as user identifier, it will be stored in Claim Array. Required. + // Check error (e) to determine the appropriate error message. + Authenticator func(c *gin.Context) (interface{}, error) + + // Callback function that should perform the authorization of the authenticated user. Called + // only after an authentication success. Must return true on success, false on failure. + // Optional, default to success. + Authorizator func(data interface{}, c *gin.Context) bool + + // Callback function that will be called during login. + // Using this function it is possible to add additional payload data to the webtoken. + // The data is then made available during requests via c.Get("JWT_PAYLOAD"). + // Note that the payload is not encrypted. + // The attributes mentioned on jwt.io can't be used as keys for the map. + // Optional, by default no additional data will be set. + PayloadFunc func(data interface{}) MapClaims + + // User can define own Unauthorized func. + Unauthorized func(*gin.Context, int, string) + + // User can define own LoginResponse func. + LoginResponse func(*gin.Context, int, string, time.Time) + + // User can define own RefreshResponse func. + RefreshResponse func(*gin.Context, int, string, time.Time) + + // Set the identity handler function + IdentityHandler func(*gin.Context) interface{} + + // Set the identity key + IdentityKey string + + // username + NiceKey string + + DataScopeKey string + + // rolekey + RKey string + + // roleId + RoleIdKey string + + RoleKey string + + // roleName + RoleNameKey string + + // TokenLookup is a string in the form of ":" that is used + // to extract token from the request. + // Optional. Default value "header:Authorization". + // Possible values: + // - "header:" + // - "query:" + // - "cookie:" + TokenLookup string + + // TokenHeadName is a string in the header. Default value is "Bearer" + TokenHeadName string + + // TimeFunc provides the current time. You can override it to use another time value. This is useful for testing or if your server uses a different time zone than your tokens. + TimeFunc func() time.Time + + // HTTP Status messages for when something in the JWT middleware fails. + // Check error (e) to determine the appropriate error message. + HTTPStatusMessageFunc func(e error, c *gin.Context) string + + // Private key file for asymmetric algorithms + PrivKeyFile string + + // Public key file for asymmetric algorithms + PubKeyFile string + + // Private key + privKey *rsa.PrivateKey + + // Public key + pubKey *rsa.PublicKey + + // Optionally return the token as a cookie + SendCookie bool + + // Allow insecure cookies for development over http + SecureCookie bool + + // Allow cookies to be accessed client side for development + CookieHTTPOnly bool + + // Allow cookie domain change for development + CookieDomain string + + // SendAuthorization allow return authorization header for every request + SendAuthorization bool + + // Disable abort() of context. + DisabledAbort bool + + // CookieName allow cookie name change for development + CookieName string +} + +var ( + // ErrMissingSecretKey indicates Secret key is required + ErrMissingSecretKey = errors.New("secret key is required") + + // ErrForbidden when HTTP status 403 is given + ErrForbidden = errors.New("you don't have permission to access this resource") + + // ErrMissingAuthenticatorFunc indicates Authenticator is required + ErrMissingAuthenticatorFunc = errors.New("ginJWTMiddleware.Authenticator func is undefined") + + // ErrMissingLoginValues indicates a user tried to authenticate without username or password + ErrMissingLoginValues = errors.New("missing Username or Password") + + // ErrFailedAuthentication indicates authentication failed, could be faulty username or password + ErrFailedAuthentication = errors.New("incorrect Username or Password") + + // ErrFailedTokenCreation indicates JWT Token failed to create, reason unknown + ErrFailedTokenCreation = errors.New("failed to create JWT Token") + + // ErrExpiredToken indicates JWT token has expired. Can't refresh. + ErrExpiredToken = errors.New("token is expired") + + // ErrEmptyAuthHeader can be thrown if authing with a HTTP header, the Auth header needs to be set + ErrEmptyAuthHeader = errors.New("auth header is empty") + + // ErrMissingExpField missing exp field in token + ErrMissingExpField = errors.New("missing exp field") + + // ErrWrongFormatOfExp field must be float64 format + ErrWrongFormatOfExp = errors.New("exp must be float64 format") + + // ErrInvalidAuthHeader indicates auth header is invalid, could for example have the wrong Realm name + ErrInvalidAuthHeader = errors.New("auth header is invalid") + + // ErrEmptyQueryToken can be thrown if authing with URL Query, the query token variable is empty + ErrEmptyQueryToken = errors.New("query token is empty") + + // ErrEmptyCookieToken can be thrown if authing with a cookie, the token cokie is empty + ErrEmptyCookieToken = errors.New("cookie token is empty") + + // ErrEmptyParamToken can be thrown if authing with parameter in path, the parameter in path is empty + ErrEmptyParamToken = errors.New("parameter token is empty") + + // ErrInvalidSigningAlgorithm indicates signing algorithm is invalid, needs to be HS256, HS384, HS512, RS256, RS384 or RS512 + ErrInvalidSigningAlgorithm = errors.New("invalid signing algorithm") + + ErrInvalidVerificationode = errors.New("验证码错误") + + // ErrNoPrivKeyFile indicates that the given private key is unreadable + ErrNoPrivKeyFile = errors.New("private key file unreadable") + + // ErrNoPubKeyFile indicates that the given public key is unreadable + ErrNoPubKeyFile = errors.New("public key file unreadable") + + // ErrInvalidPrivKey indicates that the given private key is invalid + ErrInvalidPrivKey = errors.New("private key invalid") + + // ErrInvalidPubKey indicates the the given public key is invalid + ErrInvalidPubKey = errors.New("public key invalid") + + // IdentityKey default identity key + IdentityKey = "identity" + + NiceKey = "nice" + + DataScopeKey = "datascope" + + RKey = "r" + RoleIdKey = "roleid" + + RoleKey = "rolekey" + + RoleNameKey = "rolename" +) + +// New for check error with GinJWTMiddleware +func New(m *GinJWTMiddleware) (*GinJWTMiddleware, error) { + if err := m.MiddlewareInit(); err != nil { + return nil, err + } + + return m, nil +} + +func (mw *GinJWTMiddleware) readKeys() error { + err := mw.privateKey() + if err != nil { + return err + } + err = mw.publicKey() + if err != nil { + return err + } + return nil +} + +func (mw *GinJWTMiddleware) privateKey() error { + keyData, err := ioutil.ReadFile(mw.PrivKeyFile) + if err != nil { + return ErrNoPrivKeyFile + } + key, err := jwt.ParseRSAPrivateKeyFromPEM(keyData) + if err != nil { + return ErrInvalidPrivKey + } + mw.privKey = key + return nil +} + +func (mw *GinJWTMiddleware) publicKey() error { + keyData, err := ioutil.ReadFile(mw.PubKeyFile) + if err != nil { + return ErrNoPubKeyFile + } + key, err := jwt.ParseRSAPublicKeyFromPEM(keyData) + if err != nil { + return ErrInvalidPubKey + } + mw.pubKey = key + return nil +} + +func (mw *GinJWTMiddleware) usingPublicKeyAlgo() bool { + switch mw.SigningAlgorithm { + case "RS256", "RS512", "RS384": + return true + } + return false +} + +// MiddlewareInit initialize jwt configs. +func (mw *GinJWTMiddleware) MiddlewareInit() error { + + if mw.TokenLookup == "" { + mw.TokenLookup = "header:Authorization" + } + + if mw.SigningAlgorithm == "" { + mw.SigningAlgorithm = "HS256" + } + + mw.Timeout = time.Hour + if config2.JwtConfig.Timeout != 0 { + // TODO: token过期时长 + mw.Timeout = time.Duration(config2.JwtConfig.Timeout) * time.Second + } + + if mw.TimeFunc == nil { + mw.TimeFunc = time.Now + } + + mw.TokenHeadName = strings.TrimSpace(mw.TokenHeadName) + if len(mw.TokenHeadName) == 0 { + mw.TokenHeadName = "Bearer" + } + + if mw.Authorizator == nil { + mw.Authorizator = func(data interface{}, c *gin.Context) bool { + return true + } + } + + if mw.Unauthorized == nil { + mw.Unauthorized = func(c *gin.Context, code int, message string) { + c.JSON(http.StatusOK, gin.H{ + "code": code, + "message": message, + }) + } + } + + if mw.LoginResponse == nil { + mw.LoginResponse = func(c *gin.Context, code int, token string, expire time.Time) { + c.JSON(http.StatusOK, gin.H{ + "code": http.StatusOK, + "token": token, + "expire": expire.Format(time.RFC3339), + }) + } + } + + if mw.RefreshResponse == nil { + mw.RefreshResponse = func(c *gin.Context, code int, token string, expire time.Time) { + c.JSON(http.StatusOK, gin.H{ + "code": http.StatusOK, + "token": token, + "expire": expire.Format(time.RFC3339), + }) + } + } + + if mw.IdentityKey == "" { + mw.IdentityKey = IdentityKey + } + + if mw.IdentityHandler == nil { + mw.IdentityHandler = func(c *gin.Context) interface{} { + claims := ExtractClaims(c) + return claims + } + } + + if mw.HTTPStatusMessageFunc == nil { + mw.HTTPStatusMessageFunc = func(e error, c *gin.Context) string { + return e.Error() + } + } + + if mw.Realm == "" { + mw.Realm = "gin jwt" + } + + if mw.CookieName == "" { + mw.CookieName = "jwt" + } + + if mw.usingPublicKeyAlgo() { + return mw.readKeys() + } + + if mw.Key == nil { + return ErrMissingSecretKey + } + return nil +} + +// MiddlewareFunc makes GinJWTMiddleware implement the Middleware interface. +func (mw *GinJWTMiddleware) MiddlewareFunc() gin.HandlerFunc { + return func(c *gin.Context) { + mw.middlewareImpl(c) + } +} + +func (mw *GinJWTMiddleware) middlewareImpl(c *gin.Context) { + claims, err := mw.GetClaimsFromJWT(c) + if err != nil { + mw.unauthorized(c, http.StatusUnauthorized, mw.HTTPStatusMessageFunc(err, c)) + return + } + + if claims["exp"] == nil { + mw.unauthorized(c, http.StatusBadRequest, mw.HTTPStatusMessageFunc(ErrMissingExpField, c)) + return + } + + if _, ok := claims["exp"].(float64); !ok { + mw.unauthorized(c, http.StatusBadRequest, mw.HTTPStatusMessageFunc(ErrWrongFormatOfExp, c)) + return + } + if int64(claims["exp"].(float64)) < mw.TimeFunc().Unix() { + mw.unauthorized(c, 6401, mw.HTTPStatusMessageFunc(ErrExpiredToken, c)) + return + } + + c.Set("JWT_PAYLOAD", claims) + identity := mw.IdentityHandler(c) + + if identity != nil { + c.Set(mw.IdentityKey, identity) + } + + if !mw.Authorizator(identity, c) { + mw.unauthorized(c, http.StatusForbidden, mw.HTTPStatusMessageFunc(ErrForbidden, c)) + return + } + + c.Next() +} + +// GetClaimsFromJWT get claims from JWT token +func (mw *GinJWTMiddleware) GetClaimsFromJWT(c *gin.Context) (MapClaims, error) { + token, err := mw.ParseToken(c) + + if err != nil { + return nil, err + } + + if mw.SendAuthorization { + if v, ok := c.Get("JWT_TOKEN"); ok { + c.Header("Authorization", mw.TokenHeadName+" "+v.(string)) + } + } + + claims := MapClaims{} + for key, value := range token.Claims.(jwt.MapClaims) { + claims[key] = value + } + + return claims, nil +} + +// LoginHandler can be used by clients to get a jwt token. +// Payload needs to be json in the form of {"username": "USERNAME", "password": "PASSWORD"}. +// Reply will be of the form {"token": "TOKEN"}. +func (mw *GinJWTMiddleware) LoginHandler(c *gin.Context) { + if mw.Authenticator == nil { + mw.unauthorized(c, http.StatusInternalServerError, mw.HTTPStatusMessageFunc(ErrMissingAuthenticatorFunc, c)) + return + } + + data, err := mw.Authenticator(c) + + if err != nil { + mw.unauthorized(c, 400, mw.HTTPStatusMessageFunc(err, c)) + return + } + + // Create the token + token := jwt.New(jwt.GetSigningMethod(mw.SigningAlgorithm)) + claims := token.Claims.(jwt.MapClaims) + + if mw.PayloadFunc != nil { + for key, value := range mw.PayloadFunc(data) { + claims[key] = value + } + } + + expire := mw.TimeFunc().Add(mw.Timeout) + claims["exp"] = expire.Unix() + claims["orig_iat"] = mw.TimeFunc().Unix() + tokenString, err := mw.signedString(token) + + if err != nil { + mw.unauthorized(c, http.StatusOK, mw.HTTPStatusMessageFunc(ErrFailedTokenCreation, c)) + return + } + + // set cookie + if mw.SendCookie { + maxage := int(expire.Unix() - time.Now().Unix()) + c.SetCookie( + mw.CookieName, + tokenString, + maxage, + "/", + mw.CookieDomain, + mw.SecureCookie, + mw.CookieHTTPOnly, + ) + } + + mw.LoginResponse(c, http.StatusOK, tokenString, expire) +} + +func (mw *GinJWTMiddleware) signedString(token *jwt.Token) (string, error) { + var tokenString string + var err error + if mw.usingPublicKeyAlgo() { + tokenString, err = token.SignedString(mw.privKey) + } else { + tokenString, err = token.SignedString(mw.Key) + } + return tokenString, err +} + +// RefreshHandler can be used to refresh a token. The token still needs to be valid on refresh. +// Shall be put under an endpoint that is using the GinJWTMiddleware. +// Reply will be of the form {"token": "TOKEN"}. +func (mw *GinJWTMiddleware) RefreshHandler(c *gin.Context) { + tokenString, expire, err := mw.RefreshToken(c) + if err != nil { + mw.unauthorized(c, http.StatusUnauthorized, mw.HTTPStatusMessageFunc(err, c)) + return + } + + mw.RefreshResponse(c, http.StatusOK, tokenString, expire) +} + +// RefreshToken refresh token and check if token is expired +func (mw *GinJWTMiddleware) RefreshToken(c *gin.Context) (string, time.Time, error) { + claims, err := mw.CheckIfTokenExpire(c) + if err != nil { + return "", time.Now(), err + } + + // Create the token + newToken := jwt.New(jwt.GetSigningMethod(mw.SigningAlgorithm)) + newClaims := newToken.Claims.(jwt.MapClaims) + + for key := range claims { + newClaims[key] = claims[key] + } + + expire := mw.TimeFunc().Add(mw.Timeout) + newClaims["exp"] = expire.Unix() + newClaims["orig_iat"] = mw.TimeFunc().Unix() + tokenString, err := mw.signedString(newToken) + + if err != nil { + return "", time.Now(), err + } + + // set cookie + if mw.SendCookie { + maxage := int(expire.Unix() - time.Now().Unix()) + c.SetCookie( + mw.CookieName, + tokenString, + maxage, + "/", + mw.CookieDomain, + mw.SecureCookie, + mw.CookieHTTPOnly, + ) + } + + return tokenString, expire, nil +} + +// CheckIfTokenExpire check if token expire +func (mw *GinJWTMiddleware) CheckIfTokenExpire(c *gin.Context) (jwt.MapClaims, error) { + token, err := mw.ParseToken(c) + + if err != nil { + // If we receive an error, and the error is anything other than a single + // ValidationErrorExpired, we want to return the error. + // If the error is just ValidationErrorExpired, we want to continue, as we can still + // refresh the token if it's within the MaxRefresh time. + // (see https://github.com/appleboy/gin-jwt/issues/176) + validationErr, ok := err.(*jwt.ValidationError) + if !ok || validationErr.Errors != jwt.ValidationErrorExpired { + return nil, err + } + } + + claims := token.Claims.(jwt.MapClaims) + + origIat := int64(claims["orig_iat"].(float64)) + + if origIat < mw.TimeFunc().Add(-mw.MaxRefresh).Unix() { + return nil, ErrExpiredToken + } + + return claims, nil +} + +// TokenGenerator method that clients can use to get a jwt token. +func (mw *GinJWTMiddleware) TokenGenerator(data interface{}) (string, time.Time, error) { + token := jwt.New(jwt.GetSigningMethod(mw.SigningAlgorithm)) + claims := token.Claims.(jwt.MapClaims) + + if mw.PayloadFunc != nil { + for key, value := range mw.PayloadFunc(data) { + claims[key] = value + } + } + + expire := mw.TimeFunc().UTC().Add(mw.Timeout) + claims["exp"] = expire.Unix() + claims["orig_iat"] = mw.TimeFunc().Unix() + tokenString, err := mw.signedString(token) + if err != nil { + return "", time.Time{}, err + } + + return tokenString, expire, nil +} + +func (mw *GinJWTMiddleware) jwtFromHeader(c *gin.Context, key string) (string, error) { + authHeader := c.Request.Header.Get(key) + + if authHeader == "" { + return "", ErrEmptyAuthHeader + } + + parts := strings.SplitN(authHeader, " ", 2) + if !(len(parts) == 2 && parts[0] == mw.TokenHeadName) { + return "", ErrInvalidAuthHeader + } + + return parts[1], nil +} + +func (mw *GinJWTMiddleware) jwtFromQuery(c *gin.Context, key string) (string, error) { + token := c.Query(key) + + if token == "" { + return "", ErrEmptyQueryToken + } + + return token, nil +} + +func (mw *GinJWTMiddleware) jwtFromCookie(c *gin.Context, key string) (string, error) { + cookie, _ := c.Cookie(key) + + if cookie == "" { + return "", ErrEmptyCookieToken + } + + return cookie, nil +} + +func (mw *GinJWTMiddleware) jwtFromParam(c *gin.Context, key string) (string, error) { + token := c.Param(key) + + if token == "" { + return "", ErrEmptyParamToken + } + + return token, nil +} + +// ParseToken parse jwt token from gin context +func (mw *GinJWTMiddleware) ParseToken(c *gin.Context) (*jwt.Token, error) { + var token string + var err error + + methods := strings.Split(mw.TokenLookup, ",") + for _, method := range methods { + if len(token) > 0 { + break + } + parts := strings.Split(strings.TrimSpace(method), ":") + k := strings.TrimSpace(parts[0]) + v := strings.TrimSpace(parts[1]) + switch k { + case "header": + token, err = mw.jwtFromHeader(c, v) + case "query": + token, err = mw.jwtFromQuery(c, v) + case "cookie": + token, err = mw.jwtFromCookie(c, v) + case "param": + token, err = mw.jwtFromParam(c, v) + } + } + + if err != nil { + return nil, err + } + + return jwt.Parse(token, func(t *jwt.Token) (interface{}, error) { + if jwt.GetSigningMethod(mw.SigningAlgorithm) != t.Method { + return nil, ErrInvalidSigningAlgorithm + } + if mw.usingPublicKeyAlgo() { + return mw.pubKey, nil + } + c.Set("JWT_TOKEN", token) + + return mw.Key, nil + }) +} + +// ParseTokenString parse jwt token string +func (mw *GinJWTMiddleware) ParseTokenString(token string) (*jwt.Token, error) { + return jwt.Parse(token, func(t *jwt.Token) (interface{}, error) { + if jwt.GetSigningMethod(mw.SigningAlgorithm) != t.Method { + return nil, ErrInvalidSigningAlgorithm + } + if mw.usingPublicKeyAlgo() { + return mw.pubKey, nil + } + + return mw.Key, nil + }) +} + +func (mw *GinJWTMiddleware) unauthorized(c *gin.Context, code int, message string) { + c.Header("WWW-Authenticate", "JWT realm="+mw.Realm) + if !mw.DisabledAbort { + c.Abort() + } + + mw.Unauthorized(c, code, message) +} + +// ExtractClaims help to extract the JWT claims +func ExtractClaims(c *gin.Context) MapClaims { + claims, exists := c.Get("JWT_PAYLOAD") + if !exists { + return make(MapClaims) + } + + return claims.(MapClaims) +} + +// ExtractClaimsFromToken help to extract the JWT claims from token +func ExtractClaimsFromToken(token *jwt.Token) MapClaims { + if token == nil { + return make(MapClaims) + } + + claims := MapClaims{} + for key, value := range token.Claims.(jwt.MapClaims) { + claims[key] = value + } + + return claims +} + +// GetToken help to get the JWT token string +func GetToken(c *gin.Context) string { + token, exists := c.Get("JWT_TOKEN") + if !exists { + return "" + } + + return token.(string) +} diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go new file mode 100644 index 0000000..4b27585 --- /dev/null +++ b/pkg/logger/logger.go @@ -0,0 +1,13 @@ +package logger + +import ( + log "github.com/sirupsen/logrus" +) + +var ( + Info *log.Logger + Warning *log.Logger + Error * log.Logger +) + + diff --git a/router/init_router.go b/router/init_router.go new file mode 100644 index 0000000..ffb716f --- /dev/null +++ b/router/init_router.go @@ -0,0 +1,32 @@ +package router + +import ( + "ferry/handler" + "ferry/middleware" + _ "ferry/pkg/jwtauth" + "ferry/tools" + config2 "ferry/tools/config" + + "github.com/gin-gonic/gin" +) + +func InitRouter() *gin.Engine { + + r := gin.New() + if config2.ApplicationConfig.IsHttps { + r.Use(handler.TlsHandler()) + } + middleware.InitMiddleware(r) + // the jwt middleware + authMiddleware, err := middleware.AuthInit() + tools.HasError(err, "JWT Init Error", 500) + + // 注册系统路由 + InitSysRouter(r, authMiddleware) + + // 注册业务路由 + // TODO: 这里可存放业务路由,里边并无实际路由是有演示代码 + InitExamplesRouter(r, authMiddleware) + + return r +} diff --git a/router/router.go b/router/router.go new file mode 100644 index 0000000..636cc64 --- /dev/null +++ b/router/router.go @@ -0,0 +1,37 @@ +package router + +import ( + "ferry/pkg/jwtauth" + jwt "ferry/pkg/jwtauth" + + "github.com/gin-gonic/gin" + _ "github.com/gin-gonic/gin" +) + +// 路由示例 +func InitExamplesRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine { + + // 无需认证的路由 + examplesNoCheckRoleRouter(r) + // 需要认证的路由 + examplesCheckRoleRouter(r, authMiddleware) + + return r +} + +// 无需认证的路由示例 +func examplesNoCheckRoleRouter(r *gin.Engine) { + + //v1 := r.Group("/api/v1") + //v1.GET("/examples/list", examples.apis) + +} + +// 需要认证的路由示例 +func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddleware) { + //v1 := r.Group("/api/v1") + //v1auth := v1.Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + //{ + // v1auth.GET("/examples/list", examples.apis) + //} +} diff --git a/router/sys_router.go b/router/sys_router.go new file mode 100644 index 0000000..0bcbe20 --- /dev/null +++ b/router/sys_router.go @@ -0,0 +1,198 @@ +package router + +import ( + log2 "ferry/apis/log" + "ferry/apis/monitor" + "ferry/apis/system" + . "ferry/apis/tools" + _ "ferry/docs" + "ferry/handler" + "ferry/middleware" + "ferry/pkg/jwtauth" + jwt "ferry/pkg/jwtauth" + + "github.com/gin-gonic/gin" + ginSwagger "github.com/swaggo/gin-swagger" + "github.com/swaggo/gin-swagger/swaggerFiles" +) + +func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.RouterGroup { + g := r.Group("") + sysBaseRouter(g) + // 静态文件 + sysStaticFileRouter(g) + + // swagger;注意:生产环境可以注释掉 + sysSwaggerRouter(g) + + // 无需认证 + sysNoCheckRoleRouter(g) + // 需要认证 + sysCheckRoleRouterInit(g, authMiddleware) + + return g +} + +func sysBaseRouter(r *gin.RouterGroup) { + r.GET("/", system.HelloWorld) + r.GET("/info", handler.Ping) +} + +func sysStaticFileRouter(r *gin.RouterGroup) { + r.Static("/static", "./static") +} + +func sysSwaggerRouter(r *gin.RouterGroup) { + r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) +} + +func sysNoCheckRoleRouter(r *gin.RouterGroup) { + v1 := r.Group("/api/v1") + + v1.GET("/monitor/server", monitor.ServerInfo) + v1.GET("/getCaptcha", system.GenerateCaptchaHandler) + v1.GET("/gen/preview/:tableId", Preview) + v1.GET("/menuTreeselect", system.GetMenuTreeelect) + + registerDBRouter(v1) + + registerSysTableRouter(v1) + +} + +func registerDBRouter(api *gin.RouterGroup) { + db := api.Group("/db") + { + db.GET("/tables/page", GetDBTableList) + db.GET("/columns/page", GetDBColumnList) + } +} + +func registerSysTableRouter(v1 *gin.RouterGroup) { + systables := v1.Group("/sys/tables") + { + systables.GET("/page", GetSysTableList) + tablesinfo := systables.Group("/info") + { + tablesinfo.POST("", InsertSysTable) + tablesinfo.PUT("", UpdateSysTable) + tablesinfo.DELETE("/:tableId", DeleteSysTables) + tablesinfo.GET("/:tableId", GetSysTables) + } + } +} + +func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwtauth.GinJWTMiddleware) { + r.POST("/login", authMiddleware.LoginHandler) + // Refresh time can be longer than token timeout + r.GET("/refresh_token", authMiddleware.RefreshHandler) + + v1 := r.Group("/api/v1") + + registerPageRouter(v1, authMiddleware) + registerBaseRouter(v1, authMiddleware) + registerDeptRouter(v1, authMiddleware) + registerSysUserRouter(v1, authMiddleware) + registerRoleRouter(v1, authMiddleware) + registerUserCenterRouter(v1, authMiddleware) + registerPostRouter(v1, authMiddleware) + registerMenuRouter(v1, authMiddleware) + registerLoginLogRouter(v1, authMiddleware) +} + +func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + v1auth := v1.Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + v1auth.GET("/getinfo", system.GetInfo) + v1auth.GET("/menurole", system.GetMenuRole) + v1auth.PUT("/roledatascope", system.UpdateRoleDataScope) + v1auth.GET("/roleMenuTreeselect/:roleId", system.GetMenuTreeRoleselect) + v1auth.GET("/roleDeptTreeselect/:roleId", system.GetDeptTreeRoleselect) + + v1auth.POST("/logout", handler.LogOut) + v1auth.GET("/menuids", system.GetMenuIDS) + } +} + +func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + v1auth := v1.Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + v1auth.GET("/deptList", system.GetDeptList) + v1auth.GET("/deptTree", system.GetDeptTree) + v1auth.GET("/sysUserList", system.GetSysUserList) + v1auth.GET("/rolelist", system.GetRoleList) + v1auth.GET("/postlist", system.GetPostList) + v1auth.GET("/menulist", system.GetMenuList) + v1auth.GET("/loginloglist", log2.GetLoginLogList) + } +} + +func registerUserCenterRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + user.GET("/profile", system.GetSysUserProfile) + user.POST("/avatar", system.InsetSysUserAvatar) + user.PUT("/pwd", system.SysUserUpdatePwd) + } +} + +func registerLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + loginlog := v1.Group("/loginlog").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + loginlog.GET("/:infoId", log2.GetLoginLog) + loginlog.POST("", log2.InsertLoginLog) + loginlog.PUT("", log2.UpdateLoginLog) + loginlog.DELETE("/:infoId", log2.DeleteLoginLog) + } +} + +func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + post := v1.Group("/post").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + post.GET("/:postId", system.GetPost) + post.POST("", system.InsertPost) + post.PUT("", system.UpdatePost) + post.DELETE("/:postId", system.DeletePost) + } +} + +func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + menu := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + menu.GET("/:id", system.GetMenu) + menu.POST("", system.InsertMenu) + menu.PUT("", system.UpdateMenu) + menu.DELETE("/:id", system.DeleteMenu) + } +} + +func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + role.GET("/:roleId", system.GetRole) + role.POST("", system.InsertRole) + role.PUT("", system.UpdateRole) + role.DELETE("/:roleId", system.DeleteRole) + } +} + +func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + sysuser := v1.Group("/sysUser").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + sysuser.GET("/:userId", system.GetSysUser) + sysuser.GET("/", system.GetSysUserInit) + sysuser.POST("", system.InsertSysUser) + sysuser.PUT("", system.UpdateSysUser) + sysuser.DELETE("/:userId", system.DeleteSysUser) + } +} + +func registerDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + dept := v1.Group("/dept").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + dept.GET("/:deptId", system.GetDept) + dept.POST("", system.InsertDept) + dept.PUT("", system.UpdateDept) + dept.DELETE("/:id", system.DeleteDept) + } +} diff --git a/static/go-admin.txt b/static/go-admin.txt new file mode 100644 index 0000000..2353fca --- /dev/null +++ b/static/go-admin.txt @@ -0,0 +1,15 @@ + + ____ + ,---, ,' , `. ,--, + ,---. ,---,. ,---.'| ,-+-,.' _ |,--.'| ,---, + ,----._,. ' ,'\ ,' .' | | | : ,-+-. ; , ||| |, ,-+-. / | + / / ' / / / |,---.' , ,--.--. | | | ,--.'|' | ||`--'_ ,--.'|' | +| : |. ; ,. :| | |/ \ ,--.__| || | ,', | |,,' ,'| | | ,"' | +| | .\ .' | |: :: : .'.--. .-. | / ,' || | / | |--' ' | | | | / | | +. ; '; |' | .; :: |.' \__\/: . .. ' / || : | | , | | : | | | | | +' . . || : |`---' ," .--.; |' ; |: || : | |/ ' : |__ | | | |/ + `---`-'| | \ \ / / / ,. || | '/ '| | |`-' | | '.'|| | |--' + .'__/\_: | `----' ; : .' \ : :|| ;/ ; : ;| |/ + | : : | , .-./\ \ / '---' | , / '---' + \ \ / `--`---' `----' ---`-' + `--`-' diff --git a/template/api.go.template b/template/api.go.template new file mode 100644 index 0000000..bf38af2 --- /dev/null +++ b/template/api.go.template @@ -0,0 +1,76 @@ +package apis + +import ( +"github.com/gin-gonic/gin" +"github.com/gin-gonic/gin/binding" +"ferry/models" +"ferry/tools" +"ferry/tools/app" +"ferry/tools/app/msg" +) + +func Get{{.ClassName}}List(c *gin.Context) { +var data models.{{.ClassName}} +var err error +var pageSize = 10 +var pageIndex = 1 + +if size := c.Request.FormValue("pageSize"); size != "" { +pageSize = tools.StrToInt(err, size) +} +if index := c.Request.FormValue("pageIndex"); index != "" { +pageIndex = tools.StrToInt(err, index) +} + +{{ range .Columns -}} + {{$z := .IsQuery}} + {{- if ($z) -}}data.{{.GoField}} = c.Request.FormValue("{{.JsonField}}") + {{ end -}} +{{end}} + +data.DataScope = tools.GetUserIdStr(c) +result, count, err := data.GetPage(pageSize, pageIndex) +tools.HasError(err, "", -1) + +app.PageOK(c, result, count, pageIndex, pageSize, "") +} + +func Get{{.ClassName}}(c *gin.Context) { +var data models.{{.ClassName}} +data.{{.PkGoField}}, _ = tools.StringToInt(c.Param("{{.PkJsonField}}")) +result, err := data.Get() +tools.HasError(err, "抱歉未找到相关信息", -1) + +app.OK(c, result, "") +} + +func Insert{{.ClassName}}(c *gin.Context) { +var data models.{{.ClassName}} +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 Update{{.ClassName}}(c *gin.Context) { +var data models.{{.ClassName}} +err := c.BindWith(&data, binding.JSON) +tools.HasError(err, "数据解析失败", -1) +data.UpdateBy = tools.GetUserIdStr(c) +result, err := data.Update(data.{{.PkGoField}}) +tools.HasError(err, "", -1) + +app.OK(c, result, "") +} + +func Delete{{.ClassName}}(c *gin.Context) { +var data models.{{.ClassName}} +data.UpdateBy = tools.GetUserIdStr(c) + +IDS := tools.IdsStrToIdsIntGroup("{{.PkJsonField}}", c) +_, err := data.BatchDelete(IDS) +tools.HasError(err, msg.DeletedFail, 500) +app.OK(c, nil, msg.DeletedSuccess) +} \ No newline at end of file diff --git a/template/js.go.template b/template/js.go.template new file mode 100644 index 0000000..efa51fe --- /dev/null +++ b/template/js.go.template @@ -0,0 +1,46 @@ +import request from '@/utils/request' + +// 查询{{.ClassName}}列表 +export function list{{.ClassName}}(query) { +return request({ +url: '/api/v1/{{.ModuleName}}List', +method: 'get', +params: query +}) +} + +// 查询{{.ClassName}}详细 +export function get{{.ClassName}} ({{.PkJsonField}}) { +return request({ +url: '/api/v1/{{.ModuleName}}/' + {{.PkJsonField}}, +method: 'get' +}) +} + + +// 新增{{.ClassName}} +export function add{{.ClassName}}(data) { +return request({ +url: '/api/v1/{{.ModuleName}}', +method: 'post', +data: data +}) +} + +// 修改{{.ClassName}} +export function update{{.ClassName}}(data) { +return request({ +url: '/api/v1/{{.ModuleName}}', +method: 'put', +data: data +}) +} + +// 删除{{.ClassName}} +export function del{{.ClassName}}({{.PkJsonField}}) { +return request({ +url: '/api/v1/{{.ModuleName}}/' + {{.PkJsonField}}, +method: 'delete' +}) +} + diff --git a/template/model.go.template b/template/model.go.template new file mode 100644 index 0000000..b75295b --- /dev/null +++ b/template/model.go.template @@ -0,0 +1,125 @@ +package models + +import ( +"ferry/global/orm" +"ferry/tools" +_ "time" +) + +type {{.ClassName}} struct { + {{ range .Columns -}} + {{$x := .Pk}} + {{- if ($x) }} + {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};primary_key"` // {{.ColumnComment}} + {{- else if eq .GoField "CreatedAt" -}} + {{- else if eq .GoField "UpdatedAt" -}} + {{- else if eq .GoField "DeletedAt" -}} + {{- else }} + {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};"` // {{.ColumnComment}}{{end -}} + {{- end }} + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + BaseModel +} + +func ({{.ClassName}}) TableName() string { + return "{{.TBName}}" +} + +// 创建{{.ClassName}} +func (e *{{.ClassName}}) Create() ({{.ClassName}}, error) { + var doc {{.ClassName}} + result := orm.Eloquent.Table(e.TableName()).Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + return doc, nil +} + + +// 获取{{.ClassName}} +func (e *{{.ClassName}}) Get() ({{.ClassName}}, error) { +var doc {{.ClassName}} + table := orm.Eloquent.Table(e.TableName()) + {{ range .Columns }} + {{$x := .Pk}} + {{- if ($x) }} + if e.{{.GoField}} != {{if eq .GoType "string" -}} "" {{ else if eq .GoType "int" -}} 0 {{- end}} { + table = table.Where("{{.ColumnName}}{{if eq .QueryType "EQ"}} = {{else if eq .QueryType "NE"}} != {{else if eq .QueryType "GT"}} > {{else if eq .QueryType "GTE"}} >= {{else if eq .QueryType "LT"}} < {{else if eq .QueryType "LTE"}} <= {{else if eq .QueryType "LIKE"}} like {{end}}?", {{ if eq .QueryType "LIKE"}}"%"+e.{{.GoField}}+"%"{{else}}e.{{.GoField}}{{end}}) + } + {{- else if .IsQuery }} + if e.{{.GoField}} != {{if eq .GoType "string" -}} "" {{ else if eq .GoType "int" -}} 0 {{- end}} { + table = table.Where("{{.ColumnName}}{{if eq .QueryType "EQ"}} = {{else if eq .QueryType "NE"}} != {{else if eq .QueryType "GT"}} > {{else if eq .QueryType "GTE"}} >= {{else if eq .QueryType "LT"}} < {{else if eq .QueryType "LTE"}} <= {{else if eq .QueryType "LIKE"}} like {{end}}?", {{ if eq .QueryType "LIKE"}}"%"+e.{{.GoField}}+"%"{{else}}e.{{.GoField}}{{end}}) + } + {{ end -}} + {{- end }} + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +// 获取{{.ClassName}}带分页 +func (e *{{.ClassName}}) GetPage(pageSize int, pageIndex int) ([]{{.ClassName}}, int, error) { + var doc []{{.ClassName}} + + table := orm.Eloquent.Select("*").Table(e.TableName()) + {{ range .Columns }} + {{- if .IsQuery }} + if e.{{.GoField}} != {{if eq .GoType "string" -}} "" {{ else if eq .GoType "int" -}} 0 {{- end}} { + table = table.Where("{{.ColumnName}}{{if eq .QueryType "EQ"}} = {{else if eq .QueryType "NE"}} != {{else if eq .QueryType "GT"}} > {{else if eq .QueryType "GTE"}} >= {{else if eq .QueryType "LT"}} < {{else if eq .QueryType "LTE"}} <= {{else if eq .QueryType "LIKE"}} like {{end}}?", {{ if eq .QueryType "LIKE"}}"%"+e.{{.GoField}}+"%"{{else}}e.{{.GoField}}{{end}}) + } + {{ end -}} + {{- end }} + + // 数据权限控制(如果不需要数据权限请将此处去掉) + dataPermission := new(DataPermission) + dataPermission.UserId, _ = tools.StringToInt(e.DataScope) + table,err := dataPermission.GetDataScope(e.TableName(), table) + if err != nil { + return nil, 0, err + } + var count int + + if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Where("`deleted_at` IS NULL").Count(&count) + return doc, count, nil +} + +// 更新{{.ClassName}} +func (e *{{.ClassName}}) Update(id int) (update {{.ClassName}}, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("{{.PkColumn}} = ?", id).First(&update).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + return + } + return +} + +// 删除{{.ClassName}} +func (e *{{.ClassName}}) Delete(id int) (success bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("{{.PkColumn}} = ?", id).Delete(&{{.ClassName}}{}).Error; err != nil { + success = false + return + } + success = true + return +} + +//批量删除 +func (e *{{.ClassName}}) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("{{.PkColumn}} in (?)", id).Delete(&{{.ClassName}}{}).Error; err != nil { + return + } + Result = true + return +} diff --git a/template/router.go.template b/template/router.go.template new file mode 100644 index 0000000..496c022 --- /dev/null +++ b/template/router.go.template @@ -0,0 +1,33 @@ + +// 需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + +r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +{ +r.GET("/:{{.PkJsonField}}", {{.ModuleName}}.Get{{.ClassName}}) +r.POST("", {{.ModuleName}}.Insert{{.ClassName}}) +r.PUT("", {{.ModuleName}}.Update{{.ClassName}}) +r.DELETE("/:{{.PkJsonField}}", {{.ModuleName}}.Delete{{.ClassName}}) +} + +l := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +{ +l.GET("/{{.ModuleName}}List",{{.ModuleName}}.Get{{.ClassName}}List) +} + +} + +// 无需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup) { + +v1.GET("/{{.ModuleName}}List",{{.ModuleName}}.Get{{.ClassName}}List) + +r := v1.Group("/{{.ModuleName}}") +{ +r.GET("/:{{.PkJsonField}}", {{.ModuleName}}.Get{{.ClassName}}) +r.POST("", {{.ModuleName}}.Insert{{.ClassName}}) +r.PUT("", {{.ModuleName}}.Update{{.ClassName}}) +r.DELETE("/:{{.PkJsonField}}", {{.ModuleName}}.Delete{{.ClassName}}) +} +} + diff --git a/template/vue.go.template b/template/vue.go.template new file mode 100644 index 0000000..e020a03 --- /dev/null +++ b/template/vue.go.template @@ -0,0 +1,339 @@ +{{$tableComment:=.TableComment}} + + + diff --git a/test/api.go.template b/test/api.go.template new file mode 100644 index 0000000..b844f92 --- /dev/null +++ b/test/api.go.template @@ -0,0 +1,126 @@ +package apis + +import ( +"github.com/gin-gonic/gin" +"github.com/gin-gonic/gin/binding" +"ferry/models" +"ferry/pkg" +"ferry/utils" +"net/http" +) + +// @Summary 配置列表数据 +// @Description 获取JSON +// @Tags 配置 +// @Param configKey query string false "configKey" +// @Param configName query string false "configName" +// @Param configType query string false "configType" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/configList [get] +// @Security +func Get{{.ClassName}}List(c *gin.Context) { + var data models.{{.ClassName}} + var err error + var pageSize = 10 + var pageIndex = 1 + + if size := c.Request.FormValue("pageSize"); size != "" { + pageSize = pkg.StrToInt(err, size) + } + + if index := c.Request.FormValue("pageIndex"); index != "" { + pageIndex = pkg.StrToInt(err, index) + } + + {{ range .Columns -}} + {{$z := .IsQuery}} + {{- if ($z) -}} + data.{{.GoField}} = c.Request.FormValue("{{.JsonField}}") + {{ end }} + {{- end -}} + + data.DataScope = utils.GetUserIdStr(c) + result, count, err := data.GetPage(pageSize, pageIndex) + pkg.HasError(err, "", -1) + + var mp = make(map[string]interface{}, 3) + mp["list"] = result + mp["count"] = count + mp["pageIndex"] = pageIndex + mp["pageIndex"] = pageSize + + var res app.Response + res.Data = mp + + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 获取配置 +// @Description 获取JSON +// @Tags 配置 +// @Param configId path int true "配置编码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/config/{configId} [get] +// @Security +func Get{{.ClassName}}(c *gin.Context) { + var data models.{{.ClassName}} + data.{{.PkGoField}}, _ = utils.StringToInt(c.Param("{{.PkJsonField}}")) + result, err := data.Get() + pkg.HasError(err, "抱歉未找到相关信息", -1) + + var res app.Response + res.Data = result + + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// @Summary 添加配置 +// @Description 获取JSON +// @Tags 配置 +// @Accept application/json +// @Product application/json +// @Param data body models.{{.ClassName}} true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dict/data [post] +// @Security Bearer +func Insert{{.ClassName}}(c *gin.Context) { + var data models.{{.ClassName}} + err := c.BindWith(&data, binding.JSON) + data.CreateBy = utils.GetUserIdStr(c) + pkg.HasError(err, "", 500) + result, err := data.Create() + pkg.HasError(err, "", -1) + + var res app.Response + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) + +} + +func Update{{.ClassName}}(c *gin.Context) { + var data models.{{.ClassName}} + err := c.BindWith(&data, binding.JSON) + pkg.HasError(err, "数据解析失败", -1) + data.UpdateBy = utils.GetUserIdStr(c) + result, err := data.Update(data.{{.PkGoField}}) + pkg.HasError(err, "", -1) + + var res app.Response + res.Data = result + c.JSON(http.StatusOK, res.ReturnOK()) +} + +func Delete{{.ClassName}}(c *gin.Context) { + var data models.{{.ClassName}} + id, err := utils.StringToInt(c.Param("{{.PkJsonField}}")) + data.UpdateBy = utils.GetUserIdStr(c) + _, err = data.Delete(id) + pkg.HasError(err, "修改失败", 500) + + var res app.Response + res.Msg = "删除成功" + c.JSON(http.StatusOK, res.ReturnOK()) +} \ No newline at end of file diff --git a/test/gen_test.go b/test/gen_test.go new file mode 100644 index 0000000..248cf88 --- /dev/null +++ b/test/gen_test.go @@ -0,0 +1,47 @@ +package test + +import ( + "ferry/models/tools" + "os" + "testing" + "text/template" +) + +func TestGoModelTemplate(t *testing.T) { + t1, err := template.ParseFiles("model.go.template") + if err != nil { + t.Error(err) + } + table := tools.SysTables{} + table.TBName = "sys_tables" + tab, err := table.Get() + if err != nil { + t.Error(err) + } + file, err := os.Create("models/" + table.PackageName + ".go") + if err != nil { + t.Error(err) + } + defer file.Close() + + _ = t1.Execute(file, tab) + t.Log("") +} + +func TestGoApiTemplate(t *testing.T) { + t1, err := template.ParseFiles("api.go.template") + if err != nil { + t.Error(err) + } + table := tools.SysTables{} + table.TBName = "sys_tables" + tab, _ := table.Get() + file, err := os.Create("apis/" + table.PackageName + ".go") + if err != nil { + t.Error(err) + } + defer file.Close() + + _ = t1.Execute(file, tab) + t.Log("") +} diff --git a/test/model.go.template b/test/model.go.template new file mode 100644 index 0000000..cc70663 --- /dev/null +++ b/test/model.go.template @@ -0,0 +1,104 @@ +package models + +import ( + "ferry/global/orm" + "ferry/utils" + "time" +) + +type {{.ClassName}} struct { + + {{ range .Columns -}} + {{$x := .Pk}} + // {{.ColumnComment}} + {{if ($x)}}{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"column:{{.ColumnName}};primary_key"`{{else}}{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"column:{{.ColumnName}};"`{{end}} + {{ end -}} +} + +// 创建{{.ClassName}} +func (e *{{.ClassName}}) Create() ({{.ClassName}}, error) { + var doc {{.ClassName}} + doc.IsDel = "0" + e.CreateTime = time.Now().String() + result := orm.Eloquent.Table("{{.TableName}}").Create(&e) + if result.Error != nil { + err := result.Error + return doc, err + } + doc = *e + return doc, nil +} + +// 获取{{.ClassName}} +func (e *{{.ClassName}}) Get() ({{.ClassName}}, error) { + var doc {{.ClassName}} + + table := orm.Eloquent.Table("{{.TableName}}") + {{ range .Columns -}} + {{$z := .IsQuery}} + {{- if ($z) -}}if e.{{.GoField}} != "" { + table = table.Where("{{.ColumnName}} = ?", e.{{.GoField}}) + } + {{ end }} + {{- end -}} + + if err := table.First(&doc).Error; err != nil { + return doc, err + } + return doc, nil +} + +// 获取{{.ClassName}}带分页 +func (e *{{.ClassName}}) GetPage(pageSize int, pageIndex int) ([]{{.ClassName}}, int32, error) { + var doc []{{.ClassName}} + + table := orm.Eloquent.Select("*").Table("{{.TableName}}") + {{ range .Columns -}} + {{$z := .IsQuery}} + {{- if ($z) -}}if e.{{.GoField}} != "" { + table = table.Where("{{.ColumnName}} = ?", e.{{.GoField}}) + } + {{ end }} + {{- end -}} + + // 数据权限控制 + dataPermission := new(DataPermission) + dataPermission.UserId, _ = utils.StringToInt(e.DataScope) + table,err := dataPermission.GetDataScope("{{.TableName}}", table) + if err != nil { + return nil, 0, err + } + var count int32 + table = table.Offset((pageIndex - 1) * pageSize).Limit(pageSize) + if err := table.Find(&doc).Error; err != nil { + return nil, 0, err + } + table.Count(&count) + return doc, count, nil +} + +// 更新{{.ClassName}} +func (e *{{.ClassName}}) Update(id int) (update {{.ClassName}}, err error) { + if err = orm.Eloquent.Table("{{.TableName}}").Where("{{.PkColumn}} = ?", id).First(&update).Error; err != nil { + return + } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + if err = orm.Eloquent.Table("{{.TableName}}").Model(&update).Updates(&e).Error; err != nil { + return + } + return +} + +// 删除{{.ClassName}} +func (e *{{.ClassName}}) Delete(id int) (success bool, err error) { + + if err = orm.Eloquent.Table("{{.TableName}}").Where("{{.PkColumn}} = ?", id).Delete(&{{.ClassName}}{}).Error; err != nil { + success = false + return + } + success = true + return +} + diff --git a/tools/app/model.go b/tools/app/model.go new file mode 100644 index 0000000..5892066 --- /dev/null +++ b/tools/app/model.go @@ -0,0 +1,46 @@ +package app + +type Response struct { + // 代码 + Code int `json:"code" example:"200"` + // 数据集 + Data interface{} `json:"data"` + // 消息 + Msg string `json:"msg"` +} + +type Page struct { + List interface{} `json:"list"` + Count int `json:"count"` + PageIndex int `json:"pageIndex"` + PageSize int `json:"pageSize"` +} + +type PageResponse struct { + // 代码 + Code int `json:"code" example:"200"` + // 数据集 + Data Page `json:"data"` + // 消息 + Msg string `json:"msg"` +} + + +func (res *Response) ReturnOK() *Response { + res.Code = 200 + return res +} + +func (res *Response) ReturnError(code int) *Response { + res.Code = code + return res +} + + +func (res *PageResponse) ReturnOK() *PageResponse { + res.Code = 200 + return res +} + + + diff --git a/tools/app/msg/message.go b/tools/app/msg/message.go new file mode 100644 index 0000000..8e239c2 --- /dev/null +++ b/tools/app/msg/message.go @@ -0,0 +1,10 @@ +package msg + +var ( + CreatedSuccess = "创建成功!" + UpdatedSuccess = "更新成功!" + DeletedSuccess = "删除成功!" + DeletedFail = "删除失败!" + GetSuccess = "查询成功!" + NotFound = "未找到相关内容或者数据为空!" +) diff --git a/tools/app/return.go b/tools/app/return.go new file mode 100644 index 0000000..0464228 --- /dev/null +++ b/tools/app/return.go @@ -0,0 +1,44 @@ +package app + +import ( + "github.com/gin-gonic/gin" + "net/http" +) + +// 失败数据处理 +func Error(c *gin.Context, code int, err error, msg string) { + var res Response + res.Msg = err.Error() + if msg != "" { + res.Msg = msg + } + c.JSON(http.StatusOK, res.ReturnError(code)) +} + +// 通常成功数据处理 +func OK(c *gin.Context, data interface{}, msg string) { + var res Response + res.Data = data + if msg != "" { + res.Msg = msg + } + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// 分页数据处理 +func PageOK(c *gin.Context, result interface{},count int,pageIndex int,pageSize int, msg string) { + var res PageResponse + res.Data.List = result + res.Data.Count = count + res.Data.PageIndex = pageIndex + res.Data.PageSize = pageSize + if msg != "" { + res.Msg = msg + } + c.JSON(http.StatusOK, res.ReturnOK()) +} + +// 兼容函数 +func Custum(c *gin.Context, data gin.H) { + c.JSON(http.StatusOK,data) +} diff --git a/tools/captcha/captcha.go b/tools/captcha/captcha.go new file mode 100644 index 0000000..63bb469 --- /dev/null +++ b/tools/captcha/captcha.go @@ -0,0 +1,41 @@ +package captcha + +import ( + "github.com/google/uuid" + "github.com/mojocn/base64Captcha" + "image/color" +) + +var store = base64Captcha.DefaultMemStore + +//configJsonBody json request body. +type configJsonBody struct { + Id string + CaptchaType string + VerifyValue string + DriverAudio *base64Captcha.DriverAudio + DriverString *base64Captcha.DriverString + DriverChinese *base64Captcha.DriverChinese + DriverMath *base64Captcha.DriverMath + DriverDigit *base64Captcha.DriverDigit +} + + +func DriverStringFunc() (id, b64s string, err error) { + e :=configJsonBody{} + e.Id = uuid.New().String() + e.DriverString = base64Captcha.NewDriverString(46, 140, 2, 2, 4, "234567890abcdefghjkmnpqrstuvwxyz", &color.RGBA{240, 240, 246, 246}, []string{"wqy-microhei.ttc"}) + driver := e.DriverString.ConvertFonts() + cap := base64Captcha.NewCaptcha(driver, store) + return cap.Generate() +} + + +func DriverDigitFunc() (id, b64s string, err error) { + e := configJsonBody{} + e.Id = uuid.New().String() + e.DriverDigit = base64Captcha.DefaultDriverDigit + driver := e.DriverDigit + cap := base64Captcha.NewCaptcha(driver, store) + return cap.Generate() +} \ No newline at end of file diff --git a/tools/config/application.go b/tools/config/application.go new file mode 100644 index 0000000..cd30685 --- /dev/null +++ b/tools/config/application.go @@ -0,0 +1,49 @@ +package config + +import "github.com/spf13/viper" + +type Application struct { + ReadTimeout int + WriterTimeout int + Host string + Port string + Name string + JwtSecret string + Mode string + DemoMsg string + Domain string + IsHttps bool +} + +func InitApplication(cfg *viper.Viper) *Application { + return &Application{ + ReadTimeout: cfg.GetInt("readTimeout"), + WriterTimeout: cfg.GetInt("writerTimeout"), + Host: cfg.GetString("host"), + Port: portDefault(cfg), + Name: cfg.GetString("name"), + JwtSecret: cfg.GetString("jwtSecret"), + Mode: cfg.GetString("mode"), + DemoMsg: cfg.GetString("demoMsg"), + Domain: cfg.GetString("domain"), + IsHttps: cfg.GetBool("ishttps"), + } +} + +var ApplicationConfig = new(Application) + +func portDefault(cfg *viper.Viper) string { + if cfg.GetString("port") == "" { + return "8000" + } else { + return cfg.GetString("port") + } +} + +func isHttpsDefault(cfg *viper.Viper) bool { + if cfg.GetString("ishttps") == "" || cfg.GetBool("ishttps") == false{ + return false + } else { + return true + } +} diff --git a/tools/config/config.go b/tools/config/config.go new file mode 100644 index 0000000..ce50784 --- /dev/null +++ b/tools/config/config.go @@ -0,0 +1,70 @@ +package config + +import ( + "fmt" + log "github.com/sirupsen/logrus" + "github.com/spf13/viper" + "io/ioutil" + "os" + "strings" +) + +var cfgDatabase *viper.Viper +var cfgApplication *viper.Viper +var cfgJwt *viper.Viper +var cfgLog *viper.Viper +var cfgSsl *viper.Viper + + +//载入配置文件 +func ConfigSetup(path string) { + viper.SetConfigFile(path) + content, err := ioutil.ReadFile(path) + if err != nil { + log.Fatal(fmt.Sprintf("Read config file fail: %s", err.Error())) + } + + + //Replace environment variables + err = viper.ReadConfig(strings.NewReader(os.ExpandEnv(string(content)))) + if err != nil { + log.Fatal(fmt.Sprintf("Parse config file fail: %s", err.Error())) + } + + cfgDatabase = viper.Sub("settings.database") + if cfgDatabase == nil { + panic("config not found settings.database") + } + DatabaseConfig = InitDatabase(cfgDatabase) + + cfgApplication = viper.Sub("settings.application") + if cfgApplication == nil { + panic("config not found settings.application") + } + ApplicationConfig = InitApplication(cfgApplication) + + cfgJwt = viper.Sub("settings.jwt") + if cfgJwt == nil { + panic("config not found settings.jwt") + } + JwtConfig = InitJwt(cfgJwt) + + cfgLog = viper.Sub("settings.log") + if cfgLog == nil { + panic("config not found settings.log") + } + LogConfig = InitLog(cfgLog) + + cfgSsl = viper.Sub("settings.ssl") + if cfgSsl == nil { + panic("config not found settings.ssl") + } + SslConfig = InitSsl(cfgSsl) +} + + +func SetConfig(configPath string, key string, value interface{}) { + viper.AddConfigPath(configPath) + viper.Set(key, value) + viper.WriteConfig() +} diff --git a/tools/config/database.go b/tools/config/database.go new file mode 100644 index 0000000..87f341d --- /dev/null +++ b/tools/config/database.go @@ -0,0 +1,25 @@ +package config + +import "github.com/spf13/viper" + +type Database struct { + Dbtype string + Host string + Port int + Name string + Username string + Password string +} + +func InitDatabase(cfg *viper.Viper) *Database { + return &Database{ + Port: cfg.GetInt("port"), + Dbtype: cfg.GetString("dbType"), + Host: cfg.GetString("host"), + Name: cfg.GetString("name"), + Username: cfg.GetString("username"), + Password: cfg.GetString("password"), + } +} + +var DatabaseConfig = new(Database) diff --git a/tools/config/jwt.go b/tools/config/jwt.go new file mode 100644 index 0000000..3636e1e --- /dev/null +++ b/tools/config/jwt.go @@ -0,0 +1,19 @@ +package config + +import ( + "github.com/spf13/viper" +) + +type Jwt struct { + Secret string + Timeout int64 +} + +func InitJwt(cfg *viper.Viper) *Jwt { + return &Jwt{ + Secret: cfg.GetString("secret"), + Timeout: cfg.GetInt64("timeout"), + } +} + +var JwtConfig = new(Jwt) diff --git a/tools/config/log.go b/tools/config/log.go new file mode 100644 index 0000000..cc537e5 --- /dev/null +++ b/tools/config/log.go @@ -0,0 +1,17 @@ +package config + +import "github.com/spf13/viper" + +type Log struct { + Dir string + Operdb bool +} + +func InitLog(cfg *viper.Viper) *Log { + return &Log{ + Dir: cfg.GetString("dir"), + Operdb: cfg.GetBool("operdb"), + } +} + +var LogConfig = new(Log) diff --git a/tools/config/ssl.go b/tools/config/ssl.go new file mode 100644 index 0000000..e64a4ab --- /dev/null +++ b/tools/config/ssl.go @@ -0,0 +1,17 @@ +package config + +import "github.com/spf13/viper" + +type Ssl struct { + KeyStr string + Pem string +} + +func InitSsl(cfg *viper.Viper) *Ssl { + return &Ssl{ + KeyStr: cfg.GetString("key"), + Pem: cfg.GetString("pem"), + } +} + +var SslConfig = new(Ssl) diff --git a/tools/env.go b/tools/env.go new file mode 100644 index 0000000..9cb337b --- /dev/null +++ b/tools/env.go @@ -0,0 +1,13 @@ +package tools + +type ( + Mode string +) + +const ( + ModeDev Mode = "dev" //开发模式 + ModeTest Mode = "test" //测试模式 + ModeProd Mode = "prod" //生产模式 + Mysql = "mysql" //mysql数据库标识 + Sqlite = "sqlite" //sqlite +) diff --git a/tools/float64.go b/tools/float64.go new file mode 100644 index 0000000..bc3cf86 --- /dev/null +++ b/tools/float64.go @@ -0,0 +1,7 @@ +package tools + +import "strconv" + +func Float64ToString(e float64) string { + return strconv.FormatFloat(e, 'E', -1, 64) +} \ No newline at end of file diff --git a/tools/int.go b/tools/int.go new file mode 100644 index 0000000..43f0643 --- /dev/null +++ b/tools/int.go @@ -0,0 +1,7 @@ +package tools + +import "strconv" + +func IntToString(e int) string { + return strconv.Itoa(e) +} \ No newline at end of file diff --git a/tools/int64.go b/tools/int64.go new file mode 100644 index 0000000..e469ed3 --- /dev/null +++ b/tools/int64.go @@ -0,0 +1,7 @@ +package tools + +import "strconv" + +func Int64ToString(e int64) string { + return strconv.FormatInt(e, 10) +} \ No newline at end of file diff --git a/tools/ip.go b/tools/ip.go new file mode 100644 index 0000000..a07287c --- /dev/null +++ b/tools/ip.go @@ -0,0 +1,33 @@ +package tools + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" +) + +func GetLocation(ip string) string { + if ip == "127.0.0.1" || ip == "localhost" { + return "内部IP" + } + resp, err := http.Get("https://restapi.amap.com/v3/ip?ip=" + ip + "&key=3fabc36c20379fbb9300c79b19d5d05e") + if err != nil { + panic(err) + + } + defer resp.Body.Close() + s, err := ioutil.ReadAll(resp.Body) + fmt.Printf(string(s)) + + m := make(map[string]string) + + err = json.Unmarshal(s, &m) + if err != nil { + fmt.Println("Umarshal failed:", err) + } + if m["province"] == "" { + return "未知位置" + } + return m["province"] + "-" + m["city"] +} \ No newline at end of file diff --git a/tools/logger.go b/tools/logger.go new file mode 100644 index 0000000..4d5e660 --- /dev/null +++ b/tools/logger.go @@ -0,0 +1,62 @@ +package tools + +import ( + "errors" + config2 "ferry/tools/config" + "os" + "time" + + log "github.com/sirupsen/logrus" +) + +func InitLogger() { + log.SetFormatter(&log.TextFormatter{FieldMap: log.FieldMap{ + log.FieldKeyTime: "@timestamp", + log.FieldKeyLevel: "@level", + log.FieldKeyMsg: "@message"}}) + + switch Mode(config2.ApplicationConfig.Mode) { + case ModeDev, ModeTest: + log.SetOutput(os.Stdout) + log.SetLevel(log.TraceLevel) + case ModeProd: + file, err := os.OpenFile(config2.LogConfig.Dir+"/api-"+time.Now().Format("2006-01-02")+".log", os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0600) + if err != nil { + log.Fatalln("log init failed") + } + + var info os.FileInfo + info, err = file.Stat() + if err != nil { + log.Fatal(err) + } + fileWriter := logFileWriter{file, info.Size()} + log.SetOutput(&fileWriter) + log.SetLevel(log.WarnLevel) + } + + log.SetReportCaller(true) +} + +type logFileWriter struct { + file *os.File + size int64 +} + +func (p *logFileWriter) Write(data []byte) (n int, err error) { + if p == nil { + return 0, errors.New("logFileWriter is nil") + } + if p.file == nil { + return 0, errors.New("file not opened") + } + n, e := p.file.Write(data) + p.size += int64(n) + //每天一个文件 + if p.file.Name() != config2.LogConfig.Dir+"/api-"+time.Now().Format("2006-01-02")+".log" { + p.file.Close() + p.file, _ = os.OpenFile(config2.LogConfig.Dir+"/api-"+time.Now().Format("2006-01-02")+".log", os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0600) + p.size = 0 + } + return n, e +} diff --git a/tools/string.go b/tools/string.go new file mode 100644 index 0000000..0269e74 --- /dev/null +++ b/tools/string.go @@ -0,0 +1,68 @@ +package tools + +import ( + "encoding/json" + "fmt" + "github.com/gin-gonic/gin" + "io/ioutil" + "strconv" + "time" +) + +func StringToInt64(e string) (int64, error) { + return strconv.ParseInt(e, 10, 64) +} + +func StringToInt(e string) (int, error) { + return strconv.Atoi(e) +} + + +func GetCurrntTimeStr() string { + return time.Now().Format("2006/01/02 15:04:05") +} + +func GetCurrntTime() time.Time { + return time.Now() +} + + +func StructToJsonStr(e interface{}) (string, error) { + if b, err := json.Marshal(e); err == nil { + return string(b), err + } else { + return "", err + } +} + +func GetBodyString(c *gin.Context) (string, error) { + body, err := ioutil.ReadAll(c.Request.Body) + if err != nil { + fmt.Printf("read body err, %v\n", err) + return string(body), nil + } else { + return "", err + } +} + +func JsonStrToMap(e string) (map[string]interface{}, error) { + var dict map[string]interface{} + if err := json.Unmarshal([]byte(e), &dict); err == nil { + return dict, err + } else { + return nil, err + } +} + +func StructToMap(data interface{}) (map[string]interface{}, error) { + dataBytes, err := json.Marshal(data) + if err != nil { + return nil, err + } + mapData := make(map[string]interface{}) + err = json.Unmarshal(dataBytes, &mapData) + if err != nil { + return nil, err + } + return mapData, nil +} diff --git a/tools/url.go b/tools/url.go new file mode 100644 index 0000000..c5ac027 --- /dev/null +++ b/tools/url.go @@ -0,0 +1,22 @@ +package tools + +import ( + "github.com/gin-gonic/gin" + "strings" +) + +//获取URL中批量id并解析 +func IdsStrToIdsIntGroup(key string, c *gin.Context) []int { + return idsStrToIdsIntGroup(c.Param(key)) +} + + +func idsStrToIdsIntGroup(keys string) []int { + IDS := make([]int, 0) + ids := strings.Split(keys, ",") + for i := 0; i < len(ids); i++ { + ID, _ := StringToInt(ids[i]) + IDS = append(IDS, ID) + } + return IDS +} \ No newline at end of file diff --git a/tools/user.go b/tools/user.go new file mode 100644 index 0000000..14a9733 --- /dev/null +++ b/tools/user.go @@ -0,0 +1,64 @@ +package tools + +import ( + jwt "ferry/pkg/jwtauth" + "fmt" + + "github.com/gin-gonic/gin" + log "github.com/sirupsen/logrus" +) + +func ExtractClaims(c *gin.Context) jwt.MapClaims { + claims, exists := c.Get("JWT_PAYLOAD") + if !exists { + return make(jwt.MapClaims) + } + + return claims.(jwt.MapClaims) +} + +func GetUserId(c *gin.Context) int { + data := ExtractClaims(c) + if data["identity"] != nil { + return int((data["identity"]).(float64)) + } + log.Println("****************************** 路径:" + c.Request.URL.Path + " 请求方法:" + c.Request.Method + " 说明:缺少identity") + return 0 +} + +func GetUserIdStr(c *gin.Context) string { + data := ExtractClaims(c) + if data["identity"] != nil { + return Int64ToString(int64((data["identity"]).(float64))) + } + log.Println("****************************** 路径:" + c.Request.URL.Path + " 请求方法:" + c.Request.Method + " 缺少identity") + return "" +} + +func GetUserName(c *gin.Context) string { + data := ExtractClaims(c) + if data["nice"] != nil { + return (data["nice"]).(string) + } + fmt.Println("****************************** 路径:" + c.Request.URL.Path + " 请求方法:" + c.Request.Method + " 缺少nice") + return "" +} + +func GetRoleName(c *gin.Context) string { + data := ExtractClaims(c) + if data["rolekey"] != nil { + return (data["rolekey"]).(string) + } + fmt.Println("****************************** 路径:" + c.Request.URL.Path + " 请求方法:" + c.Request.Method + " 缺少rolekey") + return "" +} + +func GetRoleId(c *gin.Context) int { + data := ExtractClaims(c) + if data["roleid"] != nil { + i := int((data["roleid"]).(float64)) + return i + } + fmt.Println("****************************** 路径:" + c.Request.URL.Path + " 请求方法:" + c.Request.Method + " 缺少roleid") + return 0 +} diff --git a/tools/utils.go b/tools/utils.go new file mode 100644 index 0000000..e048917 --- /dev/null +++ b/tools/utils.go @@ -0,0 +1,55 @@ +package tools + +import ( + log "github.com/sirupsen/logrus" + "golang.org/x/crypto/bcrypt" + "strconv" +) + +func StrToInt(err error, index string) int { + result, err := strconv.Atoi(index) + if err != nil { + HasError(err, "string to int error"+err.Error(), -1) + } + return result +} + +func CompareHashAndPassword(e string, p string) (bool, error) { + err := bcrypt.CompareHashAndPassword([]byte(e), []byte(p)) + if err != nil { + log.Print(err.Error()) + return false, err + } + return true, nil +} + +// Assert 条件断言 +// 当断言条件为 假 时触发 panic +// 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 +func Assert(condition bool, msg string, code ...int) { + if !condition { + statusCode := 200 + if len(code) > 0 { + statusCode = code[0] + } + panic("CustomError#" + strconv.Itoa(statusCode) + "#" + msg) + } +} + +// HasError 错误断言 +// 当 error 不为 nil 时触发 panic +// 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 +// 若 msg 为空,则默认为 error 中的内容 +func HasError(err error, msg string, code ...int) { + if err != nil { + statusCode := 200 + if len(code) > 0 { + statusCode = code[0] + } + if msg == "" { + msg = err.Error() + } + log.Println(err) + panic("CustomError#" + strconv.Itoa(statusCode) + "#" + msg) + } +}