Compare commits

..
199 Commits
Author SHA1 Message Date
wenjianzhang 1465bfdf15 Merge branch 'master' into dev1.18 2022-08-08 09:59:57 +08:00
zhangwenjian bccbd67450 config🔧: update README 2022-08-08 09:42:31 +08:00
zhangwenjian 50a3b39666 config🔧: Modify the client IP acquisition method 2022-08-08 09:26:14 +08:00
zhangwenjian 087ba38c24 config🔧: update README.md 2022-08-08 09:22:36 +08:00
zhangwenjian 8a3c50ea1a config🔧: 修改actions配置文件 2022-08-07 21:52:02 +08:00
zhangwenjian 86187e4c79 fix🐛: 修复获取菜单接口menurole,数据不完整 (#676) 2022-08-07 21:49:24 +08:00
zhangwenjian 98c495abb1 refactor🎨: update readme 2022-08-07 20:43:34 +08:00
zhangwenjian c53c4fd9f8 refactor🎨: update readme 2022-08-07 20:42:24 +08:00
zhangwenjian b231705a67 Merge remote-tracking branch 'origin/master' 2022-08-04 17:25:17 +08:00
zhangwenjian 86f94a2cb9 refactor🎨: errors 添加go mod 2022-08-04 17:24:53 +08:00
zhangwenjian ef41e07550 docs📝: 添加开发环境要求 2022-08-04 17:24:07 +08:00
zhangwenjian 255c72d3f1 refactor🎨: update version 2022-07-29 18:51:55 +08:00
zhangwenjian 260eedfcc6 refactor🎨: 移除失效文档链接 2022-07-29 18:50:46 +08:00
zhangwenjian f43cd117e3 refactor🎨: 角色创建和更新后重新load policy策略 2022-07-29 18:47:12 +08:00
zhangwenjian 83b219458f fix🐛: 菜单中paths未设置问题修复 2022-07-29 18:44:22 +08:00
zhangwenjian 0f1b9369df fix🐛: 自定义错误中间件bug修复 2022-07-29 18:43:38 +08:00
zhangwenjian b31e1c0d58 feat✨: 升级go1.18 2022-07-27 22:27:38 +08:00
zhangwenjian 0122024789 feat✨: 修改版本号 2022-07-27 21:55:59 +08:00
zhangwenjian f469536174 fix🐛: 添加bcrypt包的引用 2022-07-27 21:49:24 +08:00
wenjianzhang 70bd8b26ad Merge pull request #673 from go-admin-team/dev
Dev
2022-07-27 21:36:11 +08:00
zhangwenjian dabc4d88b3 Merge remote-tracking branch 'origin/master' 2022-07-27 21:34:07 +08:00
wenjianzhang 214f90b366 Merge pull request #661 from wxxiong6/patch-1
fix UpdatePwd error
2022-07-27 21:20:07 +08:00
wenjianzhang 3c4cc054df Merge pull request #671 from Silicon-He/fix-readme-cgo-url
Fix readme cgo url
2022-07-27 21:19:29 +08:00
wenjianzhang 4d329287ce Merge pull request #664 from zhouxixi-dev/dev
bugfix: https://github.com/go-admin-team/go-admin/issues/539
2022-07-27 21:17:43 +08:00
siliconhe 866714d75e update doc url of cgo-issue 2022-07-17 21:14:26 +08:00
lwnmengjing b268d03e30 💚 update workflow 2022-07-12 11:54:24 +08:00
lwnmengjing 953d3b4135 🐛 fix: delete pkg error package 2022-07-12 10:55:05 +08:00
zhouxixi-dev 0d6b347d7e bugfix: https://github.com/go-admin-team/go-admin/issues/539 修复角色新增、修改时,sys_casbin_rule表drop,然后重新create的问题 2022-06-23 15:47:55 +08:00
wxxiong6 a19622f6ac fix UpdatePwd error
fix UpdatePwd error
2022-06-13 23:36:12 +08:00
zhangwenjian 45c8737601 refactor🎨: 引入github.com/pkg/errors 2022-06-05 11:12:19 +08:00
wenjianzhang 4925383f5e Merge pull request #593 from ziux/ziux
fix bug
2022-06-05 11:08:09 +08:00
wenjianzhang 62ab985050 Merge pull request #552 from wkf928592/wkf928592-patch-1
fix: arm32位系统环境下使用migrate迁移功能时,版本号作为整型处理会出现内存溢出的问题
2022-06-05 10:36:27 +08:00
wenjianzhang 50f14f7658 Merge branch 'dev' into wkf928592-patch-1 2022-06-05 10:36:20 +08:00
wenjianzhang 1cd31079d7 Merge pull request #634 from defool/bugfix/throw_error_on_migrate
Throw error if migrate failed
2022-06-05 10:33:08 +08:00
wenjianzhang 46b62a9809 Merge pull request #655 from stephenzhang0713/dev
Fix: Unable to load config file to Docker container
2022-06-05 10:31:54 +08:00
Han Zhang 8f70a1dca4 fix🐛: Fix Dockerfile to load config file
fix🐛: Fix Dockerfile to load config file
2022-06-03 20:38:54 +08:00
zhangwenjian 937b62e641 添加errors包 2022-05-29 12:58:53 +08:00
wenjianzhang 3873342f6c Merge pull request #650 from go-admin-team/dev
refactor🎨: 修复问题
2022-05-28 00:40:06 +08:00
zhangwenjian 717903a2b6 fix🐛: 修复关闭中的job能够启动问题(#638) 2022-05-28 00:34:08 +08:00
zhangwenjian 88030e301a patch🚑: 更新版本信息 2022-05-28 00:17:35 +08:00
zhangwenjian cd0792e3d2 refactor🎨: 更新readme(#623) 2022-05-28 00:14:12 +08:00
zhangwenjian 6ed2fcbf6c fix🐛: 添加roleKey验证(#649) 2022-05-27 22:47:57 +08:00
kaiyuan eb33515e29 throw error if migrate failed 2022-04-08 10:32:07 +08:00
wenjianzhang bf93b86bd0 Merge pull request #629 from go-admin-team/dev
docs📝: update readme
2022-04-01 14:14:01 +08:00
wenjianzhang c41672c21a docs📝: update readme 2022-03-31 15:08:49 +08:00
wenjianzhang 8716b073df Merge pull request #628 from go-admin-team/dev
docs📝:  update readme
2022-03-31 14:13:26 +08:00
wenjianzhang 638bab3c9d docs📝: update readme 2022-03-31 14:01:15 +08:00
wenjianzhang c5d7a8c740 fix🐛: Fix password reset
fix🐛: Fix password reset
2022-03-15 11:33:21 +08:00
wenjianzhang b030be8f80 fix🐛: Fix password reset 2022-03-12 13:00:19 +08:00
wenjianzhang 1fe19d1c3b patch🚑: dev merge
patch🚑:  dev merge
2022-03-05 11:54:10 +08:00
wenjianzhang 1508e850fe Merge branch 'master' into dev 2022-03-05 11:52:44 +08:00
zhangwenjian 81bc15d77c config🔧: go-admin version info 2022-03-05 11:49:56 +08:00
zhangwenjian 24adca55e4 feat✨: added file update sdk;kodo、obs 2022-03-05 11:44:23 +08:00
wenjianzhang 9c8974a26e fix🐛: 修复前端设置数据权限不生效问题
fix🐛: 修复前端设置数据权限不生效问题
2022-03-05 11:23:41 +08:00
wenjianzhang 01e8984b79 fix🐛: Fix readme 404 link.
fix🐛:  Fix readme 404 link.
2022-03-05 11:13:08 +08:00
wenjianzhang 7f1aa89539 fix🐛: Fix the newline problem in time package in code generation
Fix gen code problem
2022-03-05 11:11:34 +08:00
zhangwenjian 4876fc0aa1 fix🐛: Fix password reset caused by modifying user information 2022-03-05 11:00:52 +08:00
zhangwenjian f998d20a86 feat✨: added obs,kodo 2022-02-21 18:07:37 +08:00
zhangwenjian cdb5faf043 refactor🎨: upgrade OXS interface 2022-02-21 18:06:11 +08:00
zhangwenjian dfaa2ff51e test✅: added oss test 2022-02-21 18:04:46 +08:00
zhangwenjian 8754ff8147 refactor🎨: upgrade oss 2022-02-21 18:04:18 +08:00
zhangwenjian cca84c3c21 docs📝: update License Copyright 2022-02-21 17:56:12 +08:00
wenjianzhang 72391f0201 Merge pull request #598 from go-admin-team/dev
fix🐛: fix monitor macos env error (#605)
2022-02-13 00:54:52 +08:00
zhangwenjian 39e26d738c docs📝: update version 2.0.9 2022-02-13 00:31:46 +08:00
zhangwenjian f114424079 fix🐛: fix monitor macos env error 2022-02-13 00:23:20 +08:00
wenjianzhang d02b52f383 feat✨: 添加sqlserver支持 2022-02-08 18:41:09 +08:00
horizonzy b52da434bb fix code gen problem. 2022-01-31 13:00:21 +08:00
horizonzy 3cfa7a2767 fix code gen problem. 2022-01-31 12:00:26 +08:00
horizonzy 054199d1e4 fix 404 link. 2022-01-30 17:19:50 +08:00
zhangwenjian 02b62a288d refactor🎨: 删除历史的sqlite文件 2022-01-22 23:05:38 +08:00
zhangwenjian 24908a8732 refactor🎨: 添加error判断返回 2022-01-22 23:03:01 +08:00
wenjianzhang 26ee7b7985 refactor🎨: 清空sqlite数据库文件 2022-01-22 21:49:42 +08:00
wenjianzhang b76db48112 refactor🎨: 修正针对sqlite3的事务问题 2022-01-22 21:49:11 +08:00
wenjianzhang e2c5075319 v2.0.8
1、修改sqplite的支持
2、修正已知问题
2022-01-22 20:03:21 +08:00
wenjianzhang e9f36e74ca refactor🎨: 修改版本号 2022-01-22 19:44:36 +08:00
wenjianzhang 0b73bd7b25 refactor🎨: 修改sqplite的支持 2022-01-22 19:37:56 +08:00
yangyu ccccab3104 fix bug 2022-01-12 17:10:52 +08:00
wenjianzhang ae8e32d806 Update README.Zh-cn.md 2022-01-10 13:18:59 +08:00
wenjianzhang fd2709affa Update README.md 2022-01-10 13:18:23 +08:00
wenjianzhang 34b3395d15 Update README.md 2022-01-10 13:17:28 +08:00
inits abdc80b756 修复前端设置数据权限不生效问题 2022-01-10 10:21:10 +08:00
lwnmengjing 492ac31973 Merge pull request #580 from go-admin-team/dev
push docker
2021-12-08 11:09:01 +08:00
linwenxiang 3ac1878c3c perf ⚡ performance docker build 2021-12-07 23:37:33 +08:00
linwenxiang 0cc27355f7 fix 🐛 push to gihub 2021-12-07 23:24:19 +08:00
linwenxiang 562f761807 feat ✨ add dev to ci 2021-12-07 22:47:44 +08:00
linwenxiang 88e4b37c03 feat ✨ push docker to github 2021-12-07 22:44:39 +08:00
wenjianzhang b73d88d6cf Merge pull request #564 from go-admin-team/dev
merge: 修正数据初始化的部分问题
2021-10-22 12:15:05 +08:00
wenjianzhang 443c30d48c Update 1599190683659_tables.go 2021-10-22 12:05:39 +08:00
wenjianzhang 64cbf31184 Update db.sql 2021-10-22 12:04:48 +08:00
wkf928592 ce9d9bd3ec fix:在32位系统中做迁移时,版本号作为整型处理会造成内存溢出的问题
修改版本号作为字符串处理
2021-09-10 10:19:33 +08:00
linwenxiang 57330784ac feat ✨ mirror to gitlab 2021-09-07 21:45:25 +08:00
lwnmengjing 85e1c6fe54 Merge branch 'dev' 2021-09-07 11:21:33 +08:00
lwnmengjing 7ca776bfab 💚 修复流水线CI bug 2021-09-07 11:20:55 +08:00
linwenxiang 082c369d41 feat ✨ 同步代码到gitee 2021-09-06 21:51:07 +08:00
lwnmengjing 0ac9f41e1a Merge pull request #549 from go-admin-team/dev
fix 🐛 gcc强依赖问题修复
2021-09-02 20:38:36 +08:00
linwenxiang 16701d38a6 feat ✨ 增加release pipeline 2021-09-02 20:31:00 +08:00
linwenxiang 30eb280698 fix 🐛 gcc强依赖问题修复 2021-09-02 20:21:18 +08:00
wenjianzhang 974a8096ca Merge pull request #546 from go-admin-team/dev
Dev
2021-08-21 14:20:26 +08:00
wenjianzhang bb83a97613 refactor🎨: 修改post接口文档 2021-08-20 18:28:04 +08:00
wenjianzhang 8baae5e712 fix🐛: 修复jwt密钥引用错误问题(#545) 2021-08-20 18:27:29 +08:00
wenjianzhang 49e4c19cbb Merge pull request #544 from go-admin-team/dev
Dev
2021-08-19 19:36:42 +08:00
wenjianzhang 6f67628012 Merge branch 'dev' of github.com:go-admin-team/go-admin into dev 2021-08-19 19:28:04 +08:00
wenjianzhang 8a1573cc14 docs📝: 更新2.0.6 2021-08-19 19:27:55 +08:00
wenjianzhang 03b916ef8a Merge pull request #543 from go-admin-team/dev
Dev
2021-08-19 19:26:31 +08:00
wenjianzhang 9d25648c1f Merge pull request #540 from ninstein/patch-8
BUGFIX:角色状态修改异常修复
2021-08-19 19:13:16 +08:00
wenjianzhang aa6c3df892 Merge pull request #542 from go-admin-team/dev
Dev
2021-08-19 19:12:32 +08:00
wenjianzhang bdaa6e0db0 refactor🎨: 升级包go-admin-core v1.3.7和go-admin-core/sdk v1.3.7至v1.3.8 2021-08-19 19:10:32 +08:00
wenjianzhang 4740a39808 refactor🎨: 删除移除功能的数据初始化 2021-08-19 19:08:47 +08:00
wenjianzhang 386c620b48 refactor🎨: 优化角色修改时循环AddNamedPolicy 2021-08-19 19:04:03 +08:00
wenjianzhang 2441412714 fix🐛: 修复参数验证信息 2021-08-19 19:03:19 +08:00
ninstein 9db940150a BUGFIX:角色状态修改异常修复
切换角色状态时参数传递丢失,导致切换异常新增了一条空记录
2021-08-18 14:45:22 +08:00
wenjianzhang 8c5639af53 Merge pull request #535 from go-admin-team/dev
Dev
2021-08-13 21:17:00 +08:00
wenjianzhang b4a6f82f5f Merge pull request #534 from appleboy/patch
chore: upgrade gin to v1.7.3
2021-08-13 21:15:58 +08:00
Bo-Yi Wu 7dd62a4cf8 chore: upgrade gin to v1.7.3
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-08-13 20:53:37 +08:00
wenjianzhang 095ed7c2fd Merge pull request #529 from go-admin-team/dev
Dev
2021-08-10 16:39:54 +08:00
zhangwenjian 76567eea84 docs📝: 更新2.0.5 2021-08-10 14:58:55 +08:00
zhangwenjian 5a65fcd477 fix🐛: 修复菜单树 2021-08-10 14:58:04 +08:00
wenjianzhang 27b0e1a07a Merge pull request #528 from go-admin-team/dev
Dev
2021-08-10 03:55:34 +08:00
zhangwenjian 3e20e93797 fix🐛: 修复菜单编辑未赋权接口列表 2021-08-10 03:47:31 +08:00
zhangwenjian 5d3b1c3d0f docs📝: 更新2.0.4 2021-08-10 03:37:02 +08:00
zhangwenjian b5a57e6dd9 refactor🎨: 优化生成功能的修改和删除询问提示 2021-08-10 03:36:20 +08:00
zhangwenjian 2decf43b4c fix🐛: 统一生成后的路由 2021-08-10 03:35:36 +08:00
wenjianzhang 7dd3e2b27e Merge pull request #525 from go-admin-team/dev
Dev
2021-08-06 10:49:41 +08:00
zhangwenjian 325c91989c refactor🎨: api自动添加不设置默认类型 2021-08-06 10:35:09 +08:00
wenjianzhang 96250bafb1 Merge pull request #521 from qliang/master
完善:接口检查新增记录-根据接口注释补充接口名称信息
2021-08-06 10:28:07 +08:00
wenjianzhang fff795ce5a Merge pull request #524 from go-admin-team/dev
fix🐛: 修复代码生成字典的问题 (#523  #517)
2021-08-06 10:27:32 +08:00
zhangwenjian 9887250407 docs📝: 更新2.0.3 2021-08-06 10:03:44 +08:00
zhangwenjian e42191c6af fix🐛: 修复代码生成字典的问题 (#523 #517) 2021-08-06 10:00:17 +08:00
lq adce44dc1f 完善:接口检查新增记录-根据接口注释补充接口名称信息 2021-08-03 17:24:58 +08:00
wenjianzhang a70ee44466 Merge pull request #511 from go-admin-team/dev
patch🚑:  merge dev
2021-07-28 10:00:12 +08:00
zhangwenjian fd0fa49f1c docs📝: 更新2.0.2 2021-07-28 09:06:23 +08:00
zhangwenjian 10491f9745 fix🐛: 修复删除部门的问题 (#510) 2021-07-28 08:53:18 +08:00
zhangwenjian 981313c0e2 fix🐛: 修复创建用户时的问题 ( #506) 2021-07-28 08:45:39 +08:00
zhangwenjian 6b88c9a004 fix🐛: 更新接口文档注释 (#507) 2021-07-27 19:16:47 +08:00
wenjianzhang 25395b5006 Merge pull request #504 from go-admin-team/dev
1. 修复菜单的目录(#500)
1. 调整字段判断逻辑
2021-07-23 00:43:34 +08:00
zhangwenjian 2f516b49cf refactor🎨: 调整字段判断逻辑 2021-07-23 00:33:39 +08:00
zhangwenjian 41ff26edc8 fix🐛: 修复菜单的目录(#500) 2021-07-23 00:33:00 +08:00
wenjianzhang a1c6f586cf Merge pull request #503 from go-admin-team/dev
fix🐛: 修复createapp时的问题(#493)
2021-07-22 23:11:56 +08:00
zhangwenjian 8b01126e0f fix🐛: 修复createapp时的问题(#493) 2021-07-22 23:03:44 +08:00
wenjianzhang e59d40af21 Merge pull request #495 from go-admin-team/dev
Dev
2021-07-22 22:22:20 +08:00
wenjianzhang 6b476bfab7 Update go.mod 2021-07-18 22:29:34 +08:00
wenjianzhang 12429d4585 Merge pull request #489 from Cassuis/dev
fix:修复createapp未初始化导致无法创建app以及修改资本资料导致密码重复加密问题
2021-07-16 20:52:40 +08:00
Vincent 6fe2edbe89 fix:修复修改基本资料导致密码重复加密问题 2021-07-15 11:13:37 +08:00
Vincent cee6bd6abd fix:修复createapp未初始化导致无法创建app的问题 2021-07-15 10:21:26 +08:00
zhangwenjian 4ac3350920 refactor🎨: 部分函数名称优化 2021-07-15 00:53:43 +08:00
zhangwenjian a45113258c refactor🎨: update request mode name 2021-07-15 00:43:06 +08:00
zhangwenjian 4a2659573b docs📝: 用户接口文档 2021-07-14 22:36:03 +08:00
zhangwenjian c74080664f refactor🎨: update version 2021-07-14 22:24:26 +08:00
wenjianzhang 84e06395a5 Merge pull request #487 from go-admin-team/dev
Dev
2021-07-14 16:24:46 +08:00
zhangwenjian 411b85afcd publish🚀: 2.0.0 2021-07-14 11:49:54 +08:00
zhangwenjian 57d128144d feat✨: Add the createapp command 2021-07-14 11:48:40 +08:00
wenjianzhang a7fa7e079b Merge pull request #486 from go-admin-team/dev
Dev
2021-07-14 11:40:05 +08:00
zhangwenjian 2781e413dc refactor🎨: 修改版本号 2021-07-14 11:16:27 +08:00
zhangwenjian 41d8daac97 fix🐛: 修改用户其它信息导致密码被置空,数据权限 #484 2021-07-14 11:13:26 +08:00
zhangwenjian dd22d55ee7 refactor🎨: request name cancel 2021-07-14 09:14:44 +08:00
zhangwenjian 32a1bd2511 refactor🎨: 升级gin和gorm版本 2021-07-05 00:31:31 +08:00
zhangwenjian 1130d20f14 refactor🎨: dto》request 2021-07-05 00:03:38 +08:00
wenjianzhang 90b17e995a Merge pull request #478 from go-admin-team/dev
Dev
2021-07-04 23:33:55 +08:00
zhangwenjian 1c41b0ec72 refactor🎨: 操作log dto模型名称修改 2021-07-04 23:26:43 +08:00
zhangwenjian 3f90605589 refactor🎨: 操作log添加字符限制 2021-07-04 23:13:14 +08:00
zhangwenjian c1347fbb5d refactor🎨: 升级依赖关系 2021-07-04 23:12:21 +08:00
zhangwenjian 0d1cb2ee33 docs📝: 升级qq群至2000人 2021-07-04 23:11:58 +08:00
zhangwenjian b6be297a1e refactor🎨: 添加默认demo代码生成表 2021-07-04 13:43:32 +08:00
zhangwenjian b9b3cbee93 refactor🎨: 调整登陆日志和api和操作日志模块 2021-07-04 13:43:11 +08:00
zhangwenjian 37d318b4d9 feat✨: vue-cli@3 升级为 vue-cli@4、Change Node Sass to Dart Sass、代码生成工具
1. vue-cli@3 升级为 vue-cli@4
2. Change Node Sass to Dart Sass
3. 代码生成工具
2021-07-04 05:46:20 +08:00
wenjianzhang 5368cfbcb8 Merge pull request #475 from G-Akiraka/patch-4
增加磁盘列表主机名称与当前时间
2021-07-02 22:26:09 +08:00
wenjianzhang 72a4ba077c Merge pull request #472 from G-Akiraka/patch-1
Update settings.yml
2021-07-02 22:25:53 +08:00
wenjianzhang fba03625d0 Merge pull request #473 from G-Akiraka/patch-2
翻译错误,管理员管理应该是用户管理
2021-07-02 22:24:25 +08:00
G-Akiraka 007807e776 增加磁盘列表主机名称与当前时间
上一个pr提交作废
2021-07-02 10:06:48 +08:00
G-Akiraka f2ae95d932 翻译错误,管理员管理应该是用户管理 2021-07-02 09:09:20 +08:00
G-Akiraka 25d7323ed1 Update settings.yml 2021-07-02 09:05:25 +08:00
wenjianzhang f7e737534d Merge pull request #471 from go-admin-team/dev
Dev
2021-07-01 23:13:03 +08:00
zhangwenjian 760c6b2814 refactor🎨: 修改版本号 2021-07-01 22:25:43 +08:00
zhangwenjian d0f49ef8c7 refactor🎨: 修改错误信息提示(#165) 2021-07-01 22:24:32 +08:00
wenjianzhang 1295b1fd35 Merge pull request #469 from go-admin-team/dev
DEV (#468)
2021-06-30 22:48:45 +08:00
zhangwenjian eb8062d19b refactor🎨: 生成逻辑调整 2021-06-30 22:36:26 +08:00
zhangwenjian d82129d364 refactor🎨: 代码生成模版升级 2021-06-30 22:35:49 +08:00
zhangwenjian 16923017b2 refactor🎨: 配置文件默认使用memory cache 2021-06-30 22:35:29 +08:00
zhangwenjian f4396e7e83 fix🐛: 用户修改头像接口入参模型分离(#468) 2021-06-30 18:55:16 +08:00
wenjianzhang acee466fc8 Merge pull request #467 from go-admin-team/dev
Dev(#457)
2021-06-30 02:04:10 +08:00
zhangwenjian 862f24d8a7 refactor🎨: 移除服务管理 2021-06-30 01:52:47 +08:00
wenjianzhang e2cb033670 refactor🎨: 增加server manager,提升服务启动流程规范
feature ✨ 增加server manager,提升服务启动流程规范
2021-06-29 16:58:50 +08:00
zhangwenjian 029c505501 refactor🎨: 修改包引用 2021-06-29 16:46:00 +08:00
zhangwenjian dd5f0c52fb refactor🎨: 修改错误信息提示 2021-06-29 16:33:03 +08:00
zhangwenjian f80e64688e refactor🎨: 修改请求参数命名 2021-06-29 16:32:44 +08:00
zhangwenjian 3fd34db3c1 docs📝: 修改接口文档 2021-06-29 16:30:47 +08:00
zhangwenjian 0607d462d0 docs📝: 修改config接口文档 2021-06-29 16:28:08 +08:00
zhangwenjian 7f8c302405 refactor🎨: 调整index to go-admin 接口 2021-06-29 16:27:10 +08:00
zhangwenjian c82c58443c refactor🎨: 验证码文档修改,去掉token验证 2021-06-29 16:26:27 +08:00
zhangwenjian 9591be883f refactor🎨:登陆模块接口文档整理 2021-06-25 11:34:26 +08:00
zhangwenjian acdcd0c867 refactor🎨:接口文档重新生成 2021-06-25 11:33:55 +08:00
zhangwenjian 0f623521c4 refactor🎨:代码生成功能迁移 2021-06-25 11:33:41 +08:00
wenjianzhang 91b93a3f48 refactor🎨:模版升级 2021-06-24 20:21:40 +08:00
wenjianzhang 32d123eb89 refactor🎨:格式化函数名称 2021-06-24 20:18:20 +08:00
wenjianzhang 2025809d91 refactor🎨:修改Syspost模块功能 2021-06-24 20:17:58 +08:00
wenjianzhang d552875e8a Merge pull request #461 from go-admin-team/dev
Dev
2021-06-23 12:21:13 +08:00
wenjianzhang 6994857f4b Merge pull request #460 from Cassuis/dev
bugfix:修正用户修改密码put接口url错误导致的无法修改密码问题,修正初始化SQL异常导致部分表无缺省参数问题
2021-06-23 12:08:37 +08:00
Vincent 7ac941c1d0 bugfix:
1.修正用户修改密码put接口url错误导致的无法修改密码问题
2.修正初始化SQL异常导致部分表无缺省参数问题
2021-06-23 09:46:51 +08:00
linwenxiang 7e9919e3ae feature ✨ 增加server manager,提升服务启动流程规范 2021-06-16 10:13:26 +08:00
119 changed files with 3998 additions and 2081 deletions
-60
View File
@@ -1,60 +0,0 @@
name: build
on:
push:
branches: [ dev-lwx ]
pull_request:
branches: [ dev-lwx ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
uses: actions/setup-go@v1
with:
go-version: 1.15
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: |
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o go-admin .
mv go-admin ./scripts
- uses: Azure/docker-login@v1
with:
login-server: registry.cn-shanghai.aliyuncs.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build ./scripts -t registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin:${{ github.sha }}
docker push registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin:${{ github.sha }}
- uses: Azure/k8s-set-context@v1
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- uses: Azure/k8s-create-secret@v1
with:
namespace: 'go-admin'
container-registry-url: registry.cn-shanghai.aliyuncs.com
container-registry-username: ${{ secrets.REGISTRY_USERNAME }}
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
secret-name: aliyuncs-k8s-secret
- uses: Azure/k8s-deploy@v1
with:
namespace: 'go-admin'
manifests: 'scripts/k8s/deploy.yml'
images: 'registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin:${{ github.sha }}'
imagepullsecrets: 'aliyuncs-k8s-secret'
kubectl-version: 'latest'
+41 -13
View File
@@ -2,9 +2,12 @@ name: build
on:
push:
branches: [ master ]
branches: [ master, dev ]
pull_request:
branches: [ master ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
@@ -13,22 +16,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: 1.14
go-version: 1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
- 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
run: go mod tidy
- name: Build
run: go build -v .
run: make build
- name: Log in to the Container registry
uses: docker/login-action@v2
if: startsWith(${{github.ref}}, 'refs/tags/')
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
if: startsWith(${{github.ref}}, 'refs/tags/')
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
tags: |
type=schedule
type=ref,event=tag
type=sha,prefix=,format=long,enable=true,priority=100
- name: Build and push Docker image
uses: docker/build-push-action@v3
if: startsWith(${{github.ref}}, 'refs/tags/')
with:
context: .
file: scripts/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+29
View File
@@ -0,0 +1,29 @@
name: 'GitHub Actions Mirror'
on: [push, delete]
jobs:
mirror_to_gitee:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v1
- name: 'Mirror to gitee'
uses: pixta-dev/repository-mirroring-action@v1
with:
target_repo_url:
git@gitee.com:go-admin-team/go-admin.git
ssh_private_key:
${{ secrets.GITEE_KEY }}
mirror_to_gitlab:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v1
- name: 'Mirror to gitlab'
uses: pixta-dev/repository-mirroring-action@v1
with:
target_repo_url:
git@gitlab.com:go-admin-team/go-admin.git
ssh_private_key:
${{ secrets.GITLAB_KEY }}
+23 -9
View File
@@ -1,14 +1,28 @@
FROM alpine
FROM golang:alpine as builder
MAINTAINER lwnmengjing
ENV GOPROXY https://goproxy.cn/
RUN apk update --no-cache
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache tzdata
ENV TZ Asia/Shanghai
WORKDIR /go/release
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update && apk add tzdata
COPY go.mod ./go.mod
RUN go mod tidy
COPY . .
RUN pwd && ls
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o go-admin .
FROM alpine
COPY --from=builder /go/release/go-admin /
COPY --from=builder /go/release/config/settings.yml /config/settings.yml
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY ./main /main
COPY ./config/settings.prod.yml /config/settings.yml
EXPOSE 8000
RUN chmod +x /main
CMD ["/main","server","-c", "/config/settings.yml"]
CMD ["/go-admin","server","-c", "/config/settings.yml"]
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 wenjianzhang
Copyright (c) 2020 go-admin-team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+4 -2
View File
@@ -2,9 +2,11 @@ PROJECT:=go-admin
.PHONY: build
build:
CGO_ENABLED=0 go build -o go-admin main.go
CGO_ENABLED=0 go build -ldflags="-w -s" -a -installsuffix -o go-admin .
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -a -installsuffix -o go-admin .
build-sqlite:
go build -tags sqlite3 -o go-admin main.go
go build -tags sqlite3 -ldflags="-w -s" -a -installsuffix -o go-admin .
#.PHONY: test
#test:
# go test -v ./... -cover
+62 -25
View File
@@ -1,6 +1,6 @@
# go-admin
<img align="right" width="320" src="https://gitee.com/mydearzwj/image/raw/master/img/go-admin.svg">
<img align="right" width="320" src="https://raw.githubusercontent.com/wenjianzhang/image/a44d60756c9fdedbd70f6bff076a31cbf314936a/img/go-admin.svg">
[![Build Status](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg)](https://github.com/go-admin-team/go-admin)
@@ -13,14 +13,18 @@
[在线文档](https://doc.go-admin.dev)
[github在线文档](https://wenjianzhang.github.io)
[gitee在线文档](http://mydearzwj.gitee.io/go-admin-doc/)
[前端项目](https://github.com/go-admin-team/go-admin-ui)
[视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737)
## 🎬 在线体验
vue体验:[https://www.go-admin.dev](https://www.go-admin.dev/#/login)
> ⚠️⚠️⚠️ 账号 / 密码: admin / 123456
antd体验:[https://preview.go-admin.dev](https://preview.go-admin.dev/)
> ⚠️⚠️⚠️ 账号 / 密码: admin / 123456
## ✨ 特性
- 遵循 RESTful API 设计规范
@@ -74,9 +78,9 @@
### 轻松实现go-admin写出第一个应用 - 文档教程
[步骤一 - 基础内容介绍](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial01.html)
[步骤一 - 基础内容介绍](https://doc.zhangwj.com/guide/intro/tutorial01.html)
[步骤二 - 实际应用 - 编写增删改查](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial02.html)
[步骤二 - 实际应用 - 编写增删改查](https://doc.zhangwj.com/guide/intro/tutorial02.html)
### 手把手教你从入门到放弃 - 视频教程
@@ -100,6 +104,14 @@
## 📦 本地开发
### 环境要求
go 1.18
node版本: v14.16.0
npm版本: 6.14.11
### 开发目录创建
```bash
@@ -158,7 +170,7 @@ D:\Code\go-admin>go build
cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
```
[解决cgo问题进入](https://doc.go-admin.dev/guide/other/faq.html#_5-cgo-exec-missing-cc-exec-missing-cc-file-does-not-exist)
[解决cgo问题进入](https://doc.go-admin.dev/zh-CN/guide/faq#cgo-%E7%9A%84%E9%97%AE%E9%A2%98)
:::
@@ -167,10 +179,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
``` bash
# 首次配置需要初始化数据库资源信息
# macOS or linux 下使用
$ ./go-admin migrate -c=config/settings.dev.yml
$ ./go-admin migrate -c config/settings.dev.yml
# ⚠️注意:windows 下使用
$ go-admin.exe migrate -c=config/settings.dev.yml
$ go-admin.exe migrate -c config/settings.dev.yml
# 启动项目,也可以用IDE进行调试
@@ -182,6 +194,13 @@ $ ./go-admin server -c config/settings.yml
$ go-admin.exe server -c config/settings.yml
```
#### sys_api 表的数据如何添加
在项目启动时,使用`-a true` 系统会自动添加缺少的接口数据
```bash
./go-admin server -c config/settings.yml -a true
```
#### 使用docker 编译启动
```shell
@@ -223,33 +242,49 @@ npm install --registry=https://registry.npm.taobao.org
npm run dev
```
## 🎬 在线体验
> admin / 123456
演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 互动
<table>
<tr>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
</tr>
<tr>
<td>微信</td>
<td>此群已满</td>
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=I8ZMqsExqCHpyu8SL4rbya700rBBXYLO&jump_from=webapi"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流甲号" title="go-admin技术交流甲号"></a></td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
</tr>
</table>
## 💎 主要成员
## 💎 贡献者
<span style="margin: 0 5px;" ><a href="https://github.com/wenjianzhang" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/3890175?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/G-Akiraka" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/45746659?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/lwnmengjing" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/12806223?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/bing127" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/31166183?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/chengxiao" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/1379545?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/NightFire0307" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/19854086?v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/appleboy" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/21979?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/ninstein" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/580303?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/kikiyou" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/17959053?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/horizonzy" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/22524871?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Cassuis" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/48005724?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/hqcchina" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/5179057?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/nodece" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/16235121?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/stephenzhang0713" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/18169290?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/zhouxixi-dev" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/100399679?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Jalins" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/31172582?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wkf928592" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/6063351?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wxxiong6" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/6983441?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Silicon-He" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/52478309?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/GizmoOAO" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20385106?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/bestgopher" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/36840497?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wxb1207" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20775558?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/misakichan" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/16569274?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/zhuxuyang" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/19301024?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/mss-boot" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/109259065?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
<a href="https://github.com/chengxiao"> <img src="https://avatars.githubusercontent.com/u/1379545?s=460&u=557da5503d0ac4a8628df6b4075b17853d5edcd9&v=4" width="80px"></a>
<a href="https://github.com/bing127"> <img src="https://avatars.githubusercontent.com/u/31166183?s=460&u=c085bff88df10bb7676c8c0351ba9dcd031d1fb3&v=4" width="80px"></a>
## JetBrains 开源证书支持
@@ -259,7 +294,8 @@ npm run dev
## 🤝 特别感谢
1. [chengxiao](https://github.com/chengxiao)
1. [ant-design](https://github.com/ant-design/ant-design)
2. [ant-design-pro](https://github.com/ant-design/ant-design-pro)
2. [gin](https://github.com/gin-gonic/gin)
2. [casbin](https://github.com/casbin/casbin)
2. [spf13/viper](https://github.com/spf13/viper)
@@ -270,6 +306,7 @@ npm run dev
2. [ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)
2. [form-generator](https://github.com/JakHuang/form-generator)
## 🤟 打赏
> 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink:
@@ -284,4 +321,4 @@ npm run dev
[MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
Copyright (c) 2022 wenjianzhang
+52 -19
View File
@@ -1,7 +1,7 @@
# go-admin
<img align="right" width="320" src="https://gitee.com/mydearzwj/image/raw/master/img/go-admin.svg">
<img align="right" width="320" src="https://raw.githubusercontent.com/wenjianzhang/image/a44d60756c9fdedbd70f6bff076a31cbf314936a/img/go-admin.svg">
[![Build Status](https://github.com/wenjianzhang/go-admin/workflows/build/badge.svg)](https://github.com/go-admin-team/go-admin)
@@ -18,6 +18,14 @@ The front-end and back-end separation authority management system based on Gin +
[Video tutorial](https://space.bilibili.com/565616721/channel/detail?cid=125737)
## 🎬 Online Demo
vue demo:[https://www.go-admin.dev](https://www.go-admin.dev/#/login)
> 账号 / 密码: admin / 123456
antd demo:[https://preview.go-admin.dev](https://preview.go-admin.dev/)
> 账号 / 密码: admin / 123456
>
## ✨ Feature
- Follow RESTful API design specifications
@@ -68,9 +76,9 @@ At the same time, a series of tutorials including videos and documents are provi
### Easily implement go-admin to write the first application-documentation tutorial
[Step 1 - basic content introduction](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial01.html)
[Step 1 - basic content introduction](https://doc.zhangwj.com/guide/intro/tutorial01.html)
[Step 2 - Practical application - writing database operations](http://doc.zhangwj.com/go-admin-site/guide/intro/tutorial02.html)
[Step 2 - Practical application - writing database operations](https://doc.zhangwj.com/guide/intro/tutorial02.html)
### Teach you from getting started to giving up-video tutorial
@@ -94,6 +102,14 @@ At the same time, a series of tutorials including videos and documents are provi
## 📦 Local development
### Environmental requirements
go 1.18
nodejs: v14.16.0
npm: 6.14.11
### Development directory creation
```bash
@@ -152,7 +168,7 @@ D:\Code\go-admin>go build
cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
```
[Solve the cgo problem and enter](https://doc.go-admin.dev/guide/other/faq.html#_5-cgo-exec-missing-cc-exec-missing-cc-file-does-not-exist)
[Solve the cgo problem and enter](https://doc.go-admin.dev/guide/faq#cgo-%E7%9A%84%E9%97%AE%E9%A2%98)
:::
@@ -161,10 +177,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH%
``` bash
# The first configuration needs to initialize the database resource information
# Use under macOS or linux
$ ./go-admin migrate -c=config/settings.dev.yml
$ ./go-admin migrate -c config/settings.dev.yml
# ⚠️Note: Use under windows
$ go-admin.exe migrate -c=config/settings.dev.yml
$ go-admin.exe migrate -c config/settings.dev.yml
# Start the project, you can also use the IDE for debugging
# Use under macOS or linux
@@ -214,12 +230,6 @@ npm install # or cnpm install
npm run dev
```
## 🎬 Online Demo
> admin / 123456
演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login)
## 📨 Interactive
<table>
@@ -233,12 +243,33 @@ npm run dev
</tr>
</table>
## 💎 Members
## 💎 Contributors
<a href="https://github.com/wenjianzhang"> <img src="https://avatars.githubusercontent.com/u/3890175?s=460&u=20eac63daef81588fbac611da676b99859319251&v=4" width="80px"></a>
<a href="https://github.com/lwnmengjing"> <img src="https://avatars.githubusercontent.com/u/12806223?s=400&u=a89272dce50100b77b4c0d5c81c718bf78ebb580&v=4" width="80px"></a>
<a href="https://github.com/chengxiao"> <img src="https://avatars.githubusercontent.com/u/1379545?s=460&u=557da5503d0ac4a8628df6b4075b17853d5edcd9&v=4" width="80px"></a>
<a href="https://github.com/bing127"> <img src="https://avatars.githubusercontent.com/u/31166183?s=460&u=c085bff88df10bb7676c8c0351ba9dcd031d1fb3&v=4" width="80px"></a>
<span style="margin: 0 5px;" ><a href="https://github.com/wenjianzhang" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/3890175?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/G-Akiraka" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/45746659?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/lwnmengjing" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/12806223?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/bing127" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/31166183?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/chengxiao" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/1379545?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/NightFire0307" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/19854086?v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/appleboy" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/21979?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/ninstein" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/580303?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/kikiyou" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/17959053?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/horizonzy" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/22524871?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Cassuis" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/48005724?s=64&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/hqcchina" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/5179057?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/nodece" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/16235121?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/stephenzhang0713" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/18169290?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/zhouxixi-dev" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/100399679?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Jalins" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/31172582?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wkf928592" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/6063351?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wxxiong6" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/6983441?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/Silicon-He" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/52478309?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/GizmoOAO" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20385106?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/bestgopher" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/36840497?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/wxb1207" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20775558?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/misakichan" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/16569274?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/zhuxuyang" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/19301024?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
<span style="margin: 0 5px;" ><a href="https://github.com/mss-boot" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/109259065?s=60&v=4&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
@@ -250,7 +281,9 @@ The `go-admin` project has always been developed in the GoLand integrated develo
## 🤝 Thanks
1. [chengxiao](https://github.com/chengxiao)
1. [ant-design](https://github.com/ant-design/ant-design)
2. [ant-design-pro](https://github.com/ant-design/ant-design-pro)
2. [gin](https://github.com/gin-gonic/gin)
2. [casbin](https://github.com/casbin/casbin)
2. [spf13/viper](https://github.com/spf13/viper)
@@ -274,4 +307,4 @@ The `go-admin` project has always been developed in the GoLand integrated develo
[MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md)
Copyright (c) 2020 wenjianzhang
Copyright (c) 2022 wenjianzhang
+6
View File
@@ -10,6 +10,12 @@ type System struct {
api.Api
}
// GenerateCaptchaHandler 获取验证码
// @Summary 获取验证码
// @Description 获取验证码
// @Tags 登陆
// @Success 200 {object} response.Response{data=string,id=string,msg=string} "{"code": 200, "data": [...]}"
// @Router /api/v1/captcha [get]
func (e System) GenerateCaptchaHandler(c *gin.Context) {
err := e.MakeContext(c).Errors
if err != nil {
@@ -33,7 +33,7 @@ $(function(){
</html>
`
func HelloWorld(c *gin.Context) {
func GoAdmin(c *gin.Context) {
c.Header("Content-Type", "text/html; charset=utf-8")
c.String(200, INDEX)
}
+7 -8
View File
@@ -32,7 +32,7 @@ type SysApi struct {
// @Security Bearer
func (e SysApi) GetPage(c *gin.Context) {
s := service.SysApi{}
req := dto.SysApiSearch{}
req := dto.SysApiGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -64,7 +64,7 @@ func (e SysApi) GetPage(c *gin.Context) {
// @Router /api/v1/sys-api/{id} [get]
// @Security Bearer
func (e SysApi) Get(c *gin.Context) {
req := dto.SysApiById{}
req := dto.SysApiGetReq{}
s := service.SysApi{}
err := e.MakeContext(c).
MakeOrm().
@@ -92,12 +92,12 @@ func (e SysApi) Get(c *gin.Context) {
// @Tags 接口管理
// @Accept application/json
// @Product application/json
// @Param data body dto.SysApiControl true "body"
// @Param data body dto.SysApiUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/sys-api/{id} [put]
// @Security Bearer
func (e SysApi) Update(c *gin.Context) {
req := dto.SysApiControl{}
req := dto.SysApiUpdateReq{}
s := service.SysApi{}
err := e.MakeContext(c).
MakeOrm().
@@ -122,23 +122,22 @@ func (e SysApi) Update(c *gin.Context) {
// @Summary 删除接口管理
// @Description 删除接口管理
// @Tags 接口管理
// @Param ids body []int false "ids"
// @Param data body dto.SysApiDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
// @Router /api/v1/sys-api [delete]
// @Security Bearer
func (e SysApi) DeleteSysApi(c *gin.Context) {
req := dto.SysApiById{}
req := dto.SysApiDeleteReq{}
s := service.SysApi{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
e.Logger.Error(err)
return
}
req.SetUpdateBy(user.GetUserId(c))
p := actions.GetPermissionFromContext(c)
err = s.Remove(&req, p)
if err != nil {
+8 -9
View File
@@ -30,7 +30,7 @@ type SysConfig struct {
// @Security Bearer
func (e SysConfig) GetPage(c *gin.Context) {
s := service.SysConfig{}
req := dto.SysConfigSearch{}
req := dto.SysConfigGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -60,7 +60,7 @@ func (e SysConfig) GetPage(c *gin.Context) {
// @Router /api/v1/sys-config/{id} [get]
// @Security Bearer
func (e SysConfig) Get(c *gin.Context) {
req := dto.SysConfigById{}
req := dto.SysConfigGetReq{}
s := service.SysConfig{}
err := e.MakeContext(c).
MakeOrm().
@@ -158,7 +158,7 @@ func (e SysConfig) Update(c *gin.Context) {
// @Security Bearer
func (e SysConfig) Delete(c *gin.Context) {
s := service.SysConfig{}
req := dto.SysConfigById{}
req := dto.SysConfigDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -179,15 +179,14 @@ func (e SysConfig) Delete(c *gin.Context) {
e.OK(req.GetId(), "删除成功")
}
// GetSysConfigBySysApp 获取系统配置信息
// @Summary 获取系统前台配置信息,主要注意这里不在验证数据权限
// @Description 获取系统配置信息,主要注意这里不在验证数据权限
// Get2SysApp 获取系统配置信息
// @Summary 获取系统前台配置信息,主要注意这里不在验证权限
// @Description 获取系统配置信息,主要注意这里不在验证权限
// @Tags 配置管理
// @Success 200 {object} response.Response{data=map[string]string} "{"code": 200, "data": [...]}"
// @Router /api/v1/app-config [get]
// @Security Bearer
func (e SysConfig) GetSysConfigBySysApp(c *gin.Context) {
req := dto.SysConfigSearch{}
func (e SysConfig) Get2SysApp(c *gin.Context) {
req := dto.SysConfigGetToSysAppReq{}
s := service.SysConfig{}
err := e.MakeContext(c).
MakeOrm().
+13 -13
View File
@@ -29,10 +29,10 @@ type SysDept struct {
// @Security Bearer
func (e SysDept) GetPage(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptSearch{}
req := dto.SysDeptGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -50,17 +50,16 @@ func (e SysDept) GetPage(c *gin.Context) {
}
// Get
// @Summary 部门列表数据
// @Summary 获取部门数据
// @Description 获取JSON
// @Tags 部门
// @Param deptId path string false "deptId"
// @Param position query string false "position"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dept/{deptId} [get]
// @Security Bearer
func (e SysDept) Get(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptById{}
req := dto.SysDeptGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -88,14 +87,14 @@ func (e SysDept) Get(c *gin.Context) {
// @Tags 部门
// @Accept application/json
// @Product application/json
// @Param data body dto.SysDeptControl true "data"
// @Param data body dto.SysDeptInsertReq true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dept [post]
// @Security Bearer
func (e SysDept) Insert(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptControl{}
req := dto.SysDeptInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -124,17 +123,17 @@ func (e SysDept) Insert(c *gin.Context) {
// @Accept application/json
// @Product application/json
// @Param id path int true "id"
// @Param data body dto.SysDeptControl true "body"
// @Param data body dto.SysDeptUpdateReq true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dept/{deptId} [put]
// @Security Bearer
func (e SysDept) Update(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptControl{}
req := dto.SysDeptUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -155,13 +154,14 @@ func (e SysDept) Update(c *gin.Context) {
// @Summary 删除部门
// @Description 删除数据
// @Tags 部门
// @Param data body dto.SysDeptById true "body"
// @Param data body dto.SysDeptDeleteReq true "body"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/dept [delete]
// @Security Bearer
func (e SysDept) Delete(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptById{}
req := dto.SysDeptDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -184,7 +184,7 @@ func (e SysDept) Delete(c *gin.Context) {
// Get2Tree 用户管理 左侧部门树
func (e SysDept) Get2Tree(c *gin.Context) {
s := service.SysDept{}
req := dto.SysDeptSearch{}
req := dto.SysDeptGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req,binding.Form).
+28 -27
View File
@@ -1,14 +1,12 @@
package apis
import (
"github.com/gin-gonic/gin/binding"
"go-admin/app/admin/models"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
@@ -32,7 +30,7 @@ type SysDictData struct {
// @Security Bearer
func (e SysDictData) GetPage(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataSearch{}
req := dto.SysDictDataGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -65,7 +63,7 @@ func (e SysDictData) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysDictData) Get(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataById{}
req := dto.SysDictDataGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil).
@@ -82,7 +80,7 @@ func (e SysDictData) Get(c *gin.Context) {
err = s.Get(&req, &object)
if err != nil {
e.Logger.Warnf("Get error: %s", err.Error())
e.Error(http.StatusInternalServerError, err, "查询失败")
e.Error(500, err, "查询失败")
return
}
@@ -95,14 +93,13 @@ func (e SysDictData) Get(c *gin.Context) {
// @Tags 字典数据
// @Accept application/json
// @Product application/json
// @Param data body dto.SysDictDataControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Param data body dto.SysDictDataInsertReq true "data"
// @Success 200 {object} response.Response "{"code": 200, "message": "添加成功"}"
// @Router /api/v1/dict/data [post]
// @Security Bearer
func (e SysDictData) Insert(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataControl{}
req := dto.SysDictDataInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -129,14 +126,13 @@ func (e SysDictData) Insert(c *gin.Context) {
// @Tags 字典数据
// @Accept application/json
// @Product application/json
// @Param data body dto.SysDictDataControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Param data body dto.SysDictDataUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/dict/data/{dictCode} [put]
// @Security Bearer
func (e SysDictData) Update(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataControl{}
req := dto.SysDictDataUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -160,14 +156,13 @@ func (e SysDictData) Update(c *gin.Context) {
// @Summary 删除字典数据
// @Description 删除数据
// @Tags 字典数据
// @Param dictCode body dto.SysDictDataById true "body"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Param dictCode body dto.SysDictDataDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
// @Router /api/v1/dict/data [delete]
// @Security Bearer
func (e SysDictData) Delete(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataById{}
req := dto.SysDictDataDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -187,21 +182,20 @@ func (e SysDictData) Delete(c *gin.Context) {
e.OK(req.GetId(), "删除成功")
}
// GetSysDictDataAll 数据字典根据key获取 业务页面使用
// GetAll 数据字典根据key获取 业务页面使用
// @Summary 数据字典根据key获取
// @Description 数据字典根据key获取
// @Tags 字典数据
// @Param dictType query int true "dictType"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Success 200 {object} response.Response{data=[]dto.SysDictDataGetAllResp} "{"code": 200, "data": [...]}"
// @Router /api/v1/dict-data/option-select [get]
// @Security Bearer
func (e SysDictData) GetSysDictDataAll(c *gin.Context) {
func (e SysDictData) GetAll(c *gin.Context) {
s := service.SysDictData{}
req := dto.SysDictDataSearch{}
req := dto.SysDictDataGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -215,5 +209,12 @@ func (e SysDictData) GetSysDictDataAll(c *gin.Context) {
e.Error(500, err, "查询失败")
return
}
e.OK(list, "查询成功")
}
l := make([]dto.SysDictDataGetAllResp, 0)
for _, i := range list {
d := dto.SysDictDataGetAllResp{}
e.Translate(i, &d)
l = append(l, d)
}
e.OK(l,"查询成功")
}
+13 -15
View File
@@ -31,7 +31,7 @@ type SysDictType struct {
// @Security Bearer
func (e SysDictType) GetPage(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeSearch{}
req :=dto.SysDictTypeGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -62,7 +62,7 @@ func (e SysDictType) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysDictType) Get(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeById{}
req :=dto.SysDictTypeGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil).
@@ -88,14 +88,13 @@ func (e SysDictType) Get(c *gin.Context) {
// @Tags 字典类型
// @Accept application/json
// @Product application/json
// @Param data body dto.SysDictTypeControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Param data body dto.SysDictTypeInsertReq true "data"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type [post]
// @Security Bearer
func (e SysDictType) Insert(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeControl{}
req :=dto.SysDictTypeInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -122,14 +121,13 @@ func (e SysDictType) Insert(c *gin.Context) {
// @Tags 字典类型
// @Accept application/json
// @Product application/json
// @Param data body dto.SysDictTypeControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Param data body dto.SysDictTypeUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type/{dictId} [put]
// @Security Bearer
func (e SysDictType) Update(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeControl{}
req :=dto.SysDictTypeUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -153,13 +151,13 @@ func (e SysDictType) Update(c *gin.Context) {
// @Summary 删除字典类型
// @Description 删除数据
// @Tags 字典类型
// @Param dictId path int true "dictId"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Param dictCode body dto.SysDictTypeDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type [delete]
// @Security Bearer
func (e SysDictType) Delete(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeById{}
req :=dto.SysDictTypeDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -191,7 +189,7 @@ func (e SysDictType) Delete(c *gin.Context) {
// @Security Bearer
func (e SysDictType) GetAll(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeSearch{}
req :=dto.SysDictTypeGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
+8 -9
View File
@@ -4,7 +4,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
@@ -30,7 +29,7 @@ type SysLoginLog struct {
// @Security Bearer
func (e SysLoginLog) GetPage(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogSearch {}
req :=dto.SysLoginLogGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -51,7 +50,7 @@ func (e SysLoginLog) GetPage(c *gin.Context) {
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
}
// GetSysLoginLog 登录日志通过id获取
// Get 登录日志通过id获取
// @Summary 登录日志通过id获取
// @Description 获取JSON
// @Tags 登录日志
@@ -61,10 +60,10 @@ func (e SysLoginLog) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysLoginLog) Get(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogById{}
req :=dto.SysLoginLogGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -81,16 +80,17 @@ func (e SysLoginLog) Get(c *gin.Context) {
e.OK(object, "查询成功")
}
// DeleteSysLoginLog 登录日志删除
// Delete 登录日志删除
// @Summary 登录日志删除
// @Description 登录日志删除
// @Tags 登录日志
// @Param data body dto.SysLoginLogById true "body"
// @Param data body dto.SysLoginLogDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-login-log [delete]
// @Security Bearer
func (e SysLoginLog) Delete(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogById{}
req :=dto.SysLoginLogDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -101,7 +101,6 @@ func (e SysLoginLog) Delete(c *gin.Context) {
e.Error(500, err, err.Error())
return
}
req.SetUpdateBy(user.GetUserId(c))
err = s.Remove(&req)
if err != nil {
e.Error(500, err, "删除失败")
+14 -16
View File
@@ -1,13 +1,11 @@
package apis
import (
"github.com/gin-gonic/gin/binding"
"go-admin/app/admin/models"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
@@ -22,13 +20,12 @@ type SysMenu struct {
// @Description 获取JSON
// @Tags 菜单
// @Param menuName query string false "menuName"
// @Param menuName query string false "menuName"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/menu [get]
// @Security Bearer
func (e SysMenu) GetPage(c *gin.Context) {
s := service.SysMenu{}
req := dto.SysMenuSearch{}
req := dto.SysMenuGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -57,7 +54,7 @@ func (e SysMenu) GetPage(c *gin.Context) {
// @Router /api/v1/menu/{id} [get]
// @Security Bearer
func (e SysMenu) Get(c *gin.Context) {
req := dto.SysMenuById{}
req := dto.SysMenuGetReq{}
s := new(service.SysMenu)
err := e.MakeContext(c).
MakeOrm().
@@ -85,12 +82,12 @@ func (e SysMenu) Get(c *gin.Context) {
// @Tags 菜单
// @Accept application/json
// @Product application/json
// @Param data body dto.SysMenuControl true "data"
// @Param data body dto.SysMenuInsertReq true "data"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/menu [post]
// @Security Bearer
func (e SysMenu) Insert(c *gin.Context) {
req := dto.SysMenuControl{}
req := dto.SysMenuInsertReq{}
s := new(service.SysMenu)
err := e.MakeContext(c).
MakeOrm().
@@ -119,12 +116,12 @@ func (e SysMenu) Insert(c *gin.Context) {
// @Accept application/json
// @Product application/json
// @Param id path int true "id"
// @Param data body dto.SysMenuControl true "body"
// @Param data body dto.SysMenuUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/menu/{id} [put]
// @Security Bearer
func (e SysMenu) Update(c *gin.Context) {
req := dto.SysMenuControl{}
req := dto.SysMenuUpdateReq{}
s := new(service.SysMenu)
err := e.MakeContext(c).
MakeOrm().
@@ -150,11 +147,12 @@ func (e SysMenu) Update(c *gin.Context) {
// @Summary 删除菜单
// @Description 删除数据
// @Tags 菜单
// @Param data body dto.SysMenuById true "body"
// @Param data body dto.SysMenuDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/menu [delete]
// @Security Bearer
func (e SysMenu) Delete(c *gin.Context) {
control := new(dto.SysMenuById)
control := new(dto.SysMenuDeleteReq)
s := new(service.SysMenu)
err := e.MakeContext(c).
MakeOrm().
@@ -169,7 +167,7 @@ func (e SysMenu) Delete(c *gin.Context) {
err = s.Remove(control).Error
if err != nil {
e.Logger.Errorf("RemoveSysMenu error, %s", err)
e.Error(http.StatusInternalServerError, err, "删除失败")
e.Error(500, err, "删除失败")
return
}
e.OK(control.GetId(), "删除成功")
@@ -197,7 +195,7 @@ func (e SysMenu) GetMenuRole(c *gin.Context) {
result, err := s.SetMenuRole(user.GetRoleName(c))
if err != nil {
e.Error(http.StatusInternalServerError, err, "查询失败")
e.Error(500, err, "查询失败")
return
}
@@ -255,7 +253,7 @@ func (e SysMenu) GetMenuRole(c *gin.Context) {
func (e SysMenu) GetMenuTreeSelect(c *gin.Context) {
m := service.SysMenu{}
r := service.SysRole{}
req := dto.SelectRole{}
req :=dto.SelectRole{}
err := e.MakeContext(c).
MakeOrm().
MakeService(&m.Service).
+8 -9
View File
@@ -2,12 +2,10 @@ package apis
import (
"fmt"
"github.com/gin-gonic/gin/binding"
"go-admin/app/admin/models"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
)
@@ -33,7 +31,7 @@ type SysOperaLog struct {
// @Security Bearer
func (e SysOperaLog) GetPage(c *gin.Context) {
s := service.SysOperaLog{}
req := new(dto.SysOperaLogSearch)
req := new(dto.SysOperaLogGetPageReq)
err := e.MakeContext(c).
MakeOrm().
Bind(req, binding.Form).
@@ -50,7 +48,7 @@ func (e SysOperaLog) GetPage(c *gin.Context) {
err = s.GetPage(req, &list, &count)
if err != nil {
e.Error(http.StatusUnprocessableEntity, err, "查询失败")
e.Error(500, err, "查询失败")
return
}
@@ -67,7 +65,7 @@ func (e SysOperaLog) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysOperaLog) Get(c *gin.Context) {
s := new(service.SysOperaLog)
req := dto.SysOperaLogById{}
req :=dto.SysOperaLogGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil).
@@ -92,12 +90,13 @@ func (e SysOperaLog) Get(c *gin.Context) {
// @Summary 删除操作日志
// @Description 删除数据
// @Tags 操作日志
// @Param data body dto.SysOperaLogById true "body"
// @Param data body dto.SysOperaLogDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-opera-log [delete]
// @Security Bearer
func (e SysOperaLog) Delete(c *gin.Context) {
s := new(service.SysOperaLog)
req := dto.SysOperaLogById{}
req :=dto.SysOperaLogDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
+27 -29
View File
@@ -1,10 +1,10 @@
package apis
import (
"github.com/gin-gonic/gin/binding"
"net/http"
"fmt"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
@@ -31,7 +31,7 @@ type SysPost struct {
// @Security Bearer
func (e SysPost) GetPage(c *gin.Context) {
s := service.SysPost{}
req := dto.SysPostSearch{}
req :=dto.SysPostPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -46,9 +46,9 @@ func (e SysPost) GetPage(c *gin.Context) {
list := make([]models.SysPost, 0)
var count int64
err = s.GetSysPostPage(&req, &list, &count)
err = s.GetPage(&req, &list, &count)
if err != nil {
e.Error(http.StatusUnprocessableEntity, err, "查询失败")
e.Error(500, err, "查询失败")
return
}
@@ -59,13 +59,13 @@ func (e SysPost) GetPage(c *gin.Context) {
// @Summary 获取岗位信息
// @Description 获取JSON
// @Tags 岗位
// @Param postId path int true "postId"
// @Param id path int true "编码"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post/{postId} [get]
// @Security Bearer
func (e SysPost) Get(c *gin.Context) {
s := service.SysPost{}
req := dto.SysPostById{}
req :=dto.SysPostGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil).
@@ -78,9 +78,9 @@ func (e SysPost) Get(c *gin.Context) {
}
var object models.SysPost
err = s.GetSysPost(&req, &object)
err = s.Get(&req, &object)
if err != nil {
e.Error(500, err, "查询失败")
e.Error(500, err, fmt.Sprintf("岗位信息获取失败!错误详情:%s", err.Error()))
return
}
@@ -93,14 +93,13 @@ func (e SysPost) Get(c *gin.Context) {
// @Tags 岗位
// @Accept application/json
// @Product application/json
// @Param data body dto.SysPostControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Param data body dto.SysPostInsertReq true "data"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post [post]
// @Security Bearer
func (e SysPost) Insert(c *gin.Context) {
s := service.SysPost{}
req := dto.SysPostControl{}
req :=dto.SysPostInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -112,9 +111,9 @@ func (e SysPost) Insert(c *gin.Context) {
return
}
req.SetCreateBy(user.GetUserId(c))
err = s.InsertSysPost(&req)
err = s.Insert(&req)
if err != nil {
e.Error(500, err, "创建失败")
e.Error(500, err, fmt.Sprintf("新建岗位失败!错误详情:%s", err.Error()))
return
}
e.OK(req.GetId(), "创建成功")
@@ -126,14 +125,13 @@ func (e SysPost) Insert(c *gin.Context) {
// @Tags 岗位
// @Accept application/json
// @Product application/json
// @Param data body dto.SysPostControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/post/ [put]
// @Param data body dto.SysPostUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post/{id} [put]
// @Security Bearer
func (e SysPost) Update(c *gin.Context) {
s := service.SysPost{}
req := dto.SysPostControl{}
req :=dto.SysPostUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -147,9 +145,9 @@ func (e SysPost) Update(c *gin.Context) {
req.SetUpdateBy(user.GetUserId(c))
err = s.UpdateSysPost(&req)
err = s.Update(&req)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, fmt.Sprintf("岗位更新失败!错误详情:%s", err.Error()))
return
}
e.OK(req.GetId(), "更新成功")
@@ -159,13 +157,13 @@ func (e SysPost) Update(c *gin.Context) {
// @Summary 删除岗位
// @Description 删除数据
// @Tags 岗位
// @Param id path int true "id"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 500 {string} string "{"code": 500, "message": "删除失败"}"
// @Param id body dto.SysPostDeleteReq true "请求参数"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post [delete]
// @Security Bearer
func (e SysPost) Delete(c *gin.Context) {
s := service.SysPost{}
req := dto.SysPostById{}
req :=dto.SysPostDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -177,9 +175,9 @@ func (e SysPost) Delete(c *gin.Context) {
return
}
req.SetUpdateBy(user.GetUserId(c))
err = s.RemoveSysPost(&req)
err = s.Remove(&req)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, fmt.Sprintf("岗位删除失败!错误详情:%s", err.Error()))
return
}
e.OK(req.GetId(), "删除成功")
+25 -23
View File
@@ -2,10 +2,12 @@ package apis
import (
"fmt"
"go-admin/common/global"
"net/http"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk"
"go-admin/app/admin/models"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
@@ -14,7 +16,6 @@ import (
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
"go-admin/common/global"
)
type SysRole struct {
@@ -35,7 +36,7 @@ type SysRole struct {
// @Security Bearer
func (e SysRole) GetPage(c *gin.Context) {
s := service.SysRole{}
req := dto.SysRoleSearch{}
req := dto.SysRoleGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
@@ -69,7 +70,7 @@ func (e SysRole) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysRole) Get(c *gin.Context) {
s := service.SysRole{}
req := dto.SysRoleById{}
req := dto.SysRoleGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil).
@@ -98,13 +99,13 @@ func (e SysRole) Get(c *gin.Context) {
// @Tags 角色/Role
// @Accept application/json
// @Product application/json
// @Param data body dto.SysRoleControl true "data"
// @Param data body dto.SysRoleInsertReq true "data"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/role [post]
// @Security Bearer
func (e SysRole) Insert(c *gin.Context) {
s := service.SysRole{}
req := dto.SysRoleControl{}
req := dto.SysRoleInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -125,12 +126,13 @@ func (e SysRole) Insert(c *gin.Context) {
err = s.Insert(&req, cb)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "创建失败")
e.Error(500, err, "创建失败,"+err.Error())
return
}
_, err = global.LoadPolicy(c)
if err != nil {
e.Error(500, err, "")
e.Logger.Error(err)
e.Error(500, err, "创建失败,"+err.Error())
return
}
e.OK(req.GetId(), "创建成功")
@@ -142,13 +144,13 @@ func (e SysRole) Insert(c *gin.Context) {
// @Tags 角色/Role
// @Accept application/json
// @Product application/json
// @Param data body dto.SysRoleControl true "body"
// @Param data body dto.SysRoleUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/role/{id} [put]
// @Security Bearer
func (e SysRole) Update(c *gin.Context) {
s := service.SysRole{}
req := dto.SysRoleControl{}
req := dto.SysRoleUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil, binding.JSON).
@@ -168,11 +170,14 @@ func (e SysRole) Update(c *gin.Context) {
e.Logger.Error(err)
return
}
_, err = global.LoadPolicy(c)
if err != nil {
e.Error(http.StatusInternalServerError, err, "")
e.Logger.Error(err)
e.Error(500, err, "更新失败,"+err.Error())
return
}
e.OK(req.GetId(), "更新成功")
}
@@ -180,13 +185,13 @@ func (e SysRole) Update(c *gin.Context) {
// @Summary 删除用户角色
// @Description 删除数据
// @Tags 角色/Role
// @Param data body dto.SysRoleById true "body"
// @Param data body dto.SysRoleDeleteReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/role [delete]
// @Security Bearer
func (e SysRole) Delete(c *gin.Context) {
s := new(service.SysRole)
req := dto.SysRoleById{}
req := dto.SysRoleDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -198,17 +203,14 @@ func (e SysRole) Delete(c *gin.Context) {
return
}
err = s.Remove(&req)
cb := sdk.Runtime.GetCasbinKey(c.Request.Host)
err = s.Remove(&req, cb)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
_, err = global.LoadPolicy(c)
if err != nil {
e.Error(500, err, fmt.Sprintf("删除角色 %v 失败,失败信息 %s", req.Id, err.Error()))
return
}
e.OK(req.GetId(), fmt.Sprintf("删除角色角色 %v 状态成功!", req.GetId()))
}
@@ -227,7 +229,7 @@ func (e SysRole) Update2Status(c *gin.Context) {
req := dto.UpdateStatusReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, nil, binding.JSON).
Bind(&req, binding.JSON, nil).
MakeService(&s.Service).
Errors
if err != nil {
@@ -255,7 +257,7 @@ func (e SysRole) Update2Status(c *gin.Context) {
// @Router /api/v1/role-status/{id} [put]
// @Security Bearer
func (e SysRole) Update2DataScope(c *gin.Context) {
s := &service.SysRole{}
s := service.SysRole{}
req := dto.RoleDataScopeReq{}
err := e.MakeContext(c).
MakeOrm().
@@ -275,8 +277,8 @@ func (e SysRole) Update2DataScope(c *gin.Context) {
data.UpdateBy = user.GetUserId(c)
err = s.UpdateDataScope(&req).Error
if err != nil {
e.Error(http.StatusInternalServerError, err, "")
e.Error(500, err, fmt.Sprintf("更新角色数据权限失败!错误详情:%s", err.Error()))
return
}
e.OK(nil, "操作成功")
}
}
+48 -22
View File
@@ -2,7 +2,9 @@ package apis
import (
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/config"
"go-admin/app/admin/models"
"golang.org/x/crypto/bcrypt"
"net/http"
"github.com/gin-gonic/gin"
@@ -30,10 +32,10 @@ type SysUser struct {
// @Security Bearer
func (e SysUser) GetPage(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserSearch{}
req := dto.SysUserGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -63,7 +65,7 @@ func (e SysUser) GetPage(c *gin.Context) {
// @Tags 用户
// @Param userId path int true "用户编码"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sysUser/{userId} [get]
// @Router /api/v1/sys-user/{userId} [get]
// @Security Bearer
func (e SysUser) Get(c *gin.Context) {
s := service.SysUser{}
@@ -95,12 +97,13 @@ func (e SysUser) Get(c *gin.Context) {
// @Tags 用户
// @Accept application/json
// @Product application/json
// @Param data body dto.SysUserControl true "用户数据"
// @Param data body dto.SysUserInsertReq true "用户数据"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sysUser [post]
// @Router /api/v1/sys-user [post]
// @Security Bearer
func (e SysUser) Insert(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
req := dto.SysUserInsertReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON).
@@ -129,15 +132,16 @@ func (e SysUser) Insert(c *gin.Context) {
// @Tags 用户
// @Accept application/json
// @Product application/json
// @Param data body dto.SysUserControl true "body"
// @Param data body dto.SysUserUpdateReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-user/{userId} [put]
// @Security Bearer
func (e SysUser) Update(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
req := dto.SysUserUpdateReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -166,6 +170,7 @@ func (e SysUser) Update(c *gin.Context) {
// @Param userId path int true "userId"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-user/{userId} [delete]
// @Security Bearer
func (e SysUser) Delete(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserById{}
@@ -202,9 +207,10 @@ func (e SysUser) Delete(c *gin.Context) {
// @Param file formData file true "file"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/avatar [post]
// @Security Bearer
func (e SysUser) InsetAvatar(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
req := dto.UpdateSysUserAvatarReq{}
err := e.MakeContext(c).
MakeOrm().
MakeService(&s.Service).
@@ -233,7 +239,7 @@ func (e SysUser) InsetAvatar(c *gin.Context) {
req.UserId = p.UserId
req.Avatar = "/" + filPath
err = s.Update(&req, p)
err = s.UpdateAvatar(&req, p)
if err != nil {
e.Logger.Error(err)
return
@@ -250,6 +256,7 @@ func (e SysUser) InsetAvatar(c *gin.Context) {
// @Param data body dto.UpdateSysUserStatusReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/status [put]
// @Security Bearer
func (e SysUser) UpdateStatus(c *gin.Context) {
s := service.SysUser{}
req := dto.UpdateSysUserStatusReq{}
@@ -269,7 +276,7 @@ func (e SysUser) UpdateStatus(c *gin.Context) {
//数据权限检查
p := actions.GetPermissionFromContext(c)
err = s.UpdateSysUserStatus(&req, p)
err = s.UpdateStatus(&req, p)
if err != nil {
e.Logger.Error(err)
return
@@ -286,6 +293,7 @@ func (e SysUser) UpdateStatus(c *gin.Context) {
// @Param data body dto.ResetSysUserPwdReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/pwd/reset [put]
// @Security Bearer
func (e SysUser) ResetPwd(c *gin.Context) {
s := service.SysUser{}
req := dto.ResetSysUserPwdReq{}
@@ -305,23 +313,30 @@ func (e SysUser) ResetPwd(c *gin.Context) {
//数据权限检查
p := actions.GetPermissionFromContext(c)
err = s.ResetSysUserPwd(&req, p)
if req.UserId == 1 && config.ApplicationConfig.Mode == "demo" {
req.Password = "123456"
}
err = s.ResetPwd(&req, p)
if err != nil {
e.Logger.Error(err)
return
}
e.OK(req.GetId(), "更新成功")
if req.UserId == 1 && config.ApplicationConfig.Mode == "demo" {
e.OK(req.GetId(), "admin:现在使用的预览环境,休想改掉我!否则会影响其他朋友体验的哦!可以创建其他用户体验该功能!")
} else {
e.OK(req.GetId(), "更新成功")
}
}
// UpdatePwd
// @Summary 重置密码
// @Summary 修改密码
// @Description 获取JSON
// @Tags 用户
// @Accept application/json
// @Product application/json
// @Param data body dto.PassWord true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/pwd [post]
// @Router /api/v1/user/pwd/set [put]
// @Security Bearer
func (e SysUser) UpdatePwd(c *gin.Context) {
s := service.SysUser{}
@@ -339,14 +354,26 @@ func (e SysUser) UpdatePwd(c *gin.Context) {
// 数据权限检查
p := actions.GetPermissionFromContext(c)
if user.GetUserId(c) == 1 && config.ApplicationConfig.Mode == "demo" {
req.NewPassword = "123456"
}
err = s.UpdateSysUserPwd(user.GetUserId(c), req.OldPassword, req.NewPassword, p)
var hash []byte
if hash, err = bcrypt.GenerateFromPassword([]byte(req.NewPassword), bcrypt.DefaultCost); err != nil {
req.NewPassword = string(hash)
}
err = s.UpdatePwd(user.GetUserId(c), req.OldPassword, req.NewPassword, p)
if err != nil {
e.Logger.Error(err)
e.Error(http.StatusForbidden, err, "密码修改失败")
return
}
e.OK(nil, "密码修改成功")
if user.GetUserId(c) == 1 && config.ApplicationConfig.Mode == "demo" {
e.OK(nil, "admin:现在使用的预览环境,休想改掉我!否则会影响其他朋友体验的哦!可以创建其他用户体验该功能!")
} else {
e.OK(nil, "密码修改成功")
}
}
// GetProfile
@@ -374,7 +401,7 @@ func (e SysUser) GetProfile(c *gin.Context) {
sysUser := models.SysUser{}
roles := make([]models.SysRole, 0)
posts := make([]models.SysPost, 0)
err = s.GetSysUserProfile(&req, &sysUser, &roles, &posts)
err = s.GetProfile(&req, &sysUser, &roles, &posts)
if err != nil {
e.Logger.Errorf("get user profile error, %s", err.Error())
e.Error(500, err, "获取用户信息失败")
@@ -415,8 +442,6 @@ func (e SysUser) GetInfo(c *gin.Context) {
permissions[0] = "*:*:*"
var buttons = make([]string, 1)
buttons[0] = "*:*:*"
//RoleMenu := models.RoleMenu{}
//RoleMenu.RoleId = user.GetRoleId(c)
var mp = make(map[string]interface{})
mp["roles"] = roles
@@ -444,5 +469,6 @@ func (e SysUser) GetInfo(c *gin.Context) {
mp["userId"] = sysUser.UserId
mp["deptId"] = sysUser.DeptId
mp["name"] = sysUser.NickName
mp["code"] = 200
e.OK(mp, "")
}
}
+18 -1
View File
@@ -1,10 +1,14 @@
package models
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"regexp"
"strings"
"github.com/bitly/go-simplejson"
"github.com/go-admin-team/go-admin-core/sdk"
"github.com/go-admin-team/go-admin-core/sdk/runtime"
"github.com/go-admin-team/go-admin-core/storage"
@@ -58,8 +62,21 @@ func SaveSysApi(message storage.Messager) (err error) {
strings.Contains(v.RelativePath, "/static/") ||
strings.Contains(v.RelativePath, "/form-generator/") ||
strings.Contains(v.RelativePath, "/sys/tables") {
// 根据接口方法注释里的@Summary填充接口名称,适用于代码生成器
// 可在此处增加配置路径前缀的if判断,只对代码生成的自建应用进行定向的接口名称填充
jsonFile, _ := ioutil.ReadFile("docs/swagger.json")
jsonData, _ := simplejson.NewFromReader(bytes.NewReader(jsonFile))
urlPath := v.RelativePath
idPatten := "(.*)/:(\\w+)" // 正则替换,把:id换成{id}
reg, _ := regexp.Compile(idPatten)
if reg.MatchString(urlPath) {
urlPath = reg.ReplaceAllString(v.RelativePath, "${1}/{${2}}") // 把:id换成{id}
}
apiTitle, _ := jsonData.Get("paths").Get(urlPath).Get(strings.ToLower(v.HttpMethod)).Get("summary").String()
err := d.Debug().Where(SysApi{Path: v.RelativePath, Action: v.HttpMethod}).
Attrs(SysApi{Handle: v.Handler}).
Attrs(SysApi{Handle: v.Handler, Title: apiTitle}).
FirstOrCreate(&SysApi{}).
//Update("handle", v.Handler).
Error
+12 -4
View File
@@ -57,24 +57,32 @@ func SaveOperaLog(message storage.Messager) (err error) {
if db == nil {
err = errors.New("db not exist")
log.Errorf("host[%s]'s %s", message.GetPrefix(), err.Error())
return err
// Log writing to the database ignores error
return nil
}
var rb []byte
rb, err = json.Marshal(message.GetValues())
if err != nil {
log.Errorf("json Marshal error, %s", err.Error())
return err
// Log writing to the database ignores error
return nil
}
var l SysOperaLog
err = json.Unmarshal(rb, &l)
if err != nil {
log.Errorf("json Unmarshal error, %s", err.Error())
return err
// Log writing to the database ignores error
return nil
}
// 超出100个字符返回值截断
if len(l.JsonResult) > 100 {
l.JsonResult = l.JsonResult[:100]
}
err = db.Create(&l).Error
if err != nil {
log.Errorf("db create error, %s", err.Error())
return err
// Log writing to the database ignores error
return nil
}
return nil
}
+1 -1
View File
@@ -31,7 +31,7 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
r2 := v1.Group("/app-config")
{
r2.GET("", api.GetSysConfigBySysApp)
r2.GET("", api.Get2SysApp)
}
r3 := v1.Group("/set-config").Use(authMiddleware.MiddlewareFunc())
+1 -1
View File
@@ -21,7 +21,7 @@ func registerSysDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
r.GET("/:id", api.Get)
r.POST("", api.Insert)
r.PUT("/:id", api.Update)
r.DELETE("/:id", api.Delete)
r.DELETE("", api.Delete)
}
r1 := v1.Group("").Use(authMiddleware.MiddlewareFunc())
+1 -1
View File
@@ -32,6 +32,6 @@ func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
}
opSelect := v1.Group("/dict-data").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
{
opSelect.GET("/option-select", dataApi.GetSysDictDataAll)
opSelect.GET("/option-select", dataApi.GetAll)
}
}
+21 -11
View File
@@ -1,6 +1,7 @@
package router
import (
"github.com/go-admin-team/go-admin-core/sdk/config"
"go-admin/app/admin/apis"
"mime"
@@ -21,7 +22,9 @@ func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Rou
// 静态文件
sysStaticFileRouter(g)
// swagger;注意:生产环境可以注释掉
sysSwaggerRouter(g)
if config.ApplicationConfig.Mode != "prod" {
sysSwaggerRouter(g)
}
// 需要认证
sysCheckRoleRouterInit(g, authMiddleware)
return g
@@ -33,7 +36,9 @@ func sysBaseRouter(r *gin.RouterGroup) {
go ws.WebsocketManager.SendService()
go ws.WebsocketManager.SendAllService()
r.GET("/", apis.HelloWorld)
if config.ApplicationConfig.Mode != "prod" {
r.GET("/", apis.GoAdmin)
}
r.GET("/info", handler.Ping)
}
@@ -43,7 +48,9 @@ func sysStaticFileRouter(r *gin.RouterGroup) {
return
}
r.Static("/static", "./static")
r.Static("/form-generator", "./static/form-generator")
if config.ApplicationConfig.Mode != "prod" {
r.Static("/form-generator", "./static/form-generator")
}
}
func sysSwaggerRouter(r *gin.RouterGroup) {
@@ -51,16 +58,19 @@ func sysSwaggerRouter(r *gin.RouterGroup) {
}
func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/ws/:id/:channel", ws.WebsocketManager.WsClient)
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient)
v1 := r.Group("/api/v1")
wss:=r.Group("").Use(authMiddleware.MiddlewareFunc())
{
wss.GET("/ws/:id/:channel", ws.WebsocketManager.WsClient)
wss.GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient)
}
v1.POST("/login", authMiddleware.LoginHandler)
// Refresh time can be longer than token timeout
v1.GET("/refresh_token", authMiddleware.RefreshHandler)
//registerPageRouter(v1, authMiddleware)
v1 := r.Group("/api/v1")
{
v1.POST("/login", authMiddleware.LoginHandler)
// Refresh time can be longer than token timeout
v1.GET("/refresh_token", authMiddleware.RefreshHandler)
}
registerBaseRouter(v1, authMiddleware)
//registerDictRouter(v1, authMiddleware)
}
func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
+1 -1
View File
@@ -28,7 +28,7 @@ func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
{
user.GET("/profile", api.GetProfile)
user.POST("/avatar", api.InsetAvatar)
user.PUT("/pwd", api.UpdatePwd)
user.PUT("/pwd/set", api.UpdatePwd)
user.PUT("/pwd/reset", api.ResetPwd)
user.PUT("/status", api.UpdateStatus)
}
+41 -18
View File
@@ -6,7 +6,8 @@ import (
common "go-admin/common/models"
)
type SysApiSearch struct {
// SysApiGetPageReq 功能列表请求参数
type SysApiGetPageReq struct {
dto.Pagination `search:"-"`
Title string `form:"title" search:"type:contains;column:title;table:sys_api" comment:"标题"`
Path string `form:"path" search:"type:contains;column:path;table:sys_api" comment:"地址"`
@@ -21,11 +22,35 @@ type SysApiOrder struct {
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAtOrder"`
}
func (m *SysApiSearch) GetNeedSearch() interface{} {
func (m *SysApiGetPageReq) GetNeedSearch() interface{} {
return *m
}
type SysApiControl struct {
// SysApiInsertReq 功能创建请求参数
type SysApiInsertReq struct {
Id int `json:"-" comment:"编码"` // 编码
Handle string `json:"handle" comment:"handle"`
Title string `json:"title" comment:"标题"`
Path string `json:"path" comment:"地址"`
Type string `json:"type" comment:""`
Action string `json:"action" comment:"类型"`
common.ControlBy
}
func (s *SysApiInsertReq) Generate(model *models.SysApi) {
model.Handle = s.Handle
model.Title = s.Title
model.Path = s.Path
model.Type = s.Type
model.Action = s.Action
}
func (s *SysApiInsertReq) GetId() interface{} {
return s.Id
}
// SysApiUpdateReq 功能更新请求参数
type SysApiUpdateReq struct {
Id int `uri:"id" comment:"编码"` // 编码
Handle string `json:"handle" comment:"handle"`
Title string `json:"title" comment:"标题"`
@@ -35,7 +60,7 @@ type SysApiControl struct {
common.ControlBy
}
func (s *SysApiControl) Generate(model *models.SysApi) {
func (s *SysApiUpdateReq) Generate(model *models.SysApi) {
if s.Id != 0 {
model.Id = s.Id
}
@@ -46,28 +71,26 @@ func (s *SysApiControl) Generate(model *models.SysApi) {
model.Action = s.Action
}
func (s *SysApiControl) GetId() interface{} {
func (s *SysApiUpdateReq) GetId() interface{} {
return s.Id
}
type SysApiById struct {
dto.ObjectById
common.ControlBy
// SysApiGetReq 功能获取请求参数
type SysApiGetReq struct {
Id int `uri:"id"`
}
func (s *SysApiById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysApiGetReq) GetId() interface{} {
return s.Id
}
func (s *SysApiById) Generate() dto.Control {
o := *s
return &o
// SysApiDeleteReq 功能删除请求参数
type SysApiDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysApiById) GenerateM() (common.ActiveRecord, error) {
return &models.SysApi{}, nil
func (s *SysApiDeleteReq) GetId() interface{} {
return s.Ids
}
+22 -17
View File
@@ -6,8 +6,8 @@ import (
common "go-admin/common/models"
)
// SysConfigSearch 列表或者搜索使用结构体
type SysConfigSearch struct {
// SysConfigGetPageReq 列表或者搜索使用结构体
type SysConfigGetPageReq struct {
dto.Pagination `search:"-"`
ConfigName string `form:"configName" search:"type:contains;column:config_name;table:sys_config"`
ConfigKey string `form:"configKey" search:"type:contains;column:config_key;table:sys_config"`
@@ -24,7 +24,15 @@ type SysConfigOrder struct {
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_config" form:"createdAtOrder"`
}
func (m *SysConfigSearch) GetNeedSearch() interface{} {
func (m *SysConfigGetPageReq) GetNeedSearch() interface{} {
return *m
}
type SysConfigGetToSysAppReq struct {
IsFrontend int `form:"isFrontend" search:"type:exact;column:is_frontend;table:sys_config"`
}
func (m *SysConfigGetToSysAppReq) GetNeedSearch() interface{} {
return *m
}
@@ -86,22 +94,19 @@ type GetSysConfigByKEYForServiceResp struct {
ConfigValue string `json:"configValue" comment:""`
}
// SysConfigById 获取单个或者删除的结构体
type SysConfigById struct {
Id int `uri:"id"`
type SysConfigGetReq struct {
Id int `uri:"id"`
}
func (s *SysConfigGetReq) GetId() interface{} {
return s.Id
}
type SysConfigDeleteReq struct {
Ids []int `json:"ids"`
common.ControlBy
}
func (s *SysConfigById) Generate() *SysConfigById {
cp := *s
return &cp
}
func (s *SysConfigById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
return s.Id
func (s *SysConfigDeleteReq) GetId() interface{} {
return s.Ids
}
+56 -35
View File
@@ -3,13 +3,10 @@ package dto
import (
"go-admin/app/admin/models"
common "go-admin/common/models"
"go-admin/common/dto"
)
// SysDeptSearch 列表或者搜索使用结构体
type SysDeptSearch struct {
dto.Pagination `search:"-"`
// SysDeptGetPageReq 列表或者搜索使用结构体
type SysDeptGetPageReq struct {
DeptId int `form:"deptId" search:"type:exact;column:dept_id;table:sys_dept" comment:"id"` //id
ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_dept" comment:"上级部门"` //上级部门
DeptPath string `form:"deptPath" search:"type:exact;column:dept_path;table:sys_dept" comment:""` //路径
@@ -21,26 +18,24 @@ type SysDeptSearch struct {
Status string `form:"status" search:"type:exact;column:status;table:sys_dept" comment:"状态"` //状态
}
func (m *SysDeptSearch) GetNeedSearch() interface{} {
func (m *SysDeptGetPageReq) GetNeedSearch() interface{} {
return *m
}
// SysDeptControl 增、改使用的结构体
type SysDeptControl struct {
DeptId int `uri:"id" comment:"编码"` // 编码
ParentId int `json:"parentId" comment:"上级部门"` //上级部门
DeptPath string `json:"deptPath" comment:""` //路径
DeptName string `json:"deptName" comment:"部门名称"` //部门名称
Sort int `json:"sort" comment:"排序"` //排序
Leader string `json:"leader" comment:"负责人"` //负责人
Phone string `json:"phone" comment:"手机"` //手机
Email string `json:"email" comment:"邮箱"` //邮箱
Status int `json:"status" comment:"状态"` //状态
type SysDeptInsertReq struct {
DeptId int `uri:"id" comment:"编码"` // 编码
ParentId int `json:"parentId" comment:"上级部门" vd:"?"` //上级部门
DeptPath string `json:"deptPath" comment:""` //路径
DeptName string `json:"deptName" comment:"部门名称" vd:"len($)>0"` //部门名称
Sort int `json:"sort" comment:"排序" vd:"?"` //排序
Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
Phone string `json:"phone" comment:"手机" vd:"?"` //手机
Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
Status int `json:"status" comment:"状态" vd:"$>0"` //状态
common.ControlBy
}
// Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
func (s *SysDeptControl) Generate(model *models.SysDept) {
func (s *SysDeptInsertReq) Generate(model *models.SysDept) {
if s.DeptId != 0 {
model.DeptId = s.DeptId
}
@@ -55,31 +50,57 @@ func (s *SysDeptControl) Generate(model *models.SysDept) {
}
// GetId 获取数据对应的ID
func (s *SysDeptControl) GetId() interface{} {
func (s *SysDeptInsertReq) GetId() interface{} {
return s.DeptId
}
// SysDeptById 获取单个或者删除的结构体
type SysDeptById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
type SysDeptUpdateReq struct {
DeptId int `uri:"id" comment:"编码"` // 编码
ParentId int `json:"parentId" comment:"上级部门" vd:"?"` //上级部门
DeptPath string `json:"deptPath" comment:""` //路径
DeptName string `json:"deptName" comment:"部门名称" vd:"len($)>0"` //部门名称
Sort int `json:"sort" comment:"排序" vd:"?"` //排序
Leader string `json:"leader" comment:"负责人" vd:"@:len($)>0; msg:'leader不能为空'"` //负责人
Phone string `json:"phone" comment:"手机" vd:"?"` //手机
Email string `json:"email" comment:"邮箱" vd:"?"` //邮箱
Status int `json:"status" comment:"状态" vd:"$>0"` //状态
common.ControlBy
}
func (s *SysDeptById) Generate() *SysDeptById {
cp := *s
return &cp
}
func (s *SysDeptById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
// Generate 结构体数据转化 从 SysDeptControl 至 SysDept 对应的模型
func (s *SysDeptUpdateReq) Generate(model *models.SysDept) {
if s.DeptId != 0 {
model.DeptId = s.DeptId
}
model.DeptName = s.DeptName
model.ParentId = s.ParentId
model.DeptPath = s.DeptPath
model.Sort = s.Sort
model.Leader = s.Leader
model.Phone = s.Phone
model.Email = s.Email
model.Status = s.Status
}
// GetId 获取数据对应的ID
func (s *SysDeptUpdateReq) GetId() interface{} {
return s.DeptId
}
type SysDeptGetReq struct {
Id int `uri:"id"`
}
func (s *SysDeptGetReq) GetId() interface{} {
return s.Id
}
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
return &models.SysDept{}, nil
type SysDeptDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysDeptDeleteReq) GetId() interface{} {
return s.Ids
}
type DeptLabel struct {
+57 -21
View File
@@ -6,7 +6,7 @@ import (
common "go-admin/common/models"
)
type SysDictDataSearch struct {
type SysDictDataGetPageReq struct {
dto.Pagination `search:"-"`
Id int `form:"id" search:"type:exact;column:dict_code;table:sys_dict_data" comment:""`
DictLabel string `form:"dictLabel" search:"type:contains;column:dict_label;table:sys_dict_data" comment:""`
@@ -15,12 +15,17 @@ type SysDictDataSearch struct {
Status string `form:"status" search:"type:exact;column:status;table:sys_dict_data" comment:""`
}
func (m *SysDictDataSearch) GetNeedSearch() interface{} {
func (m *SysDictDataGetPageReq) GetNeedSearch() interface{} {
return *m
}
type SysDictDataControl struct {
Id int `uri:"dictCode" comment:""`
type SysDictDataGetAllResp struct {
DictLabel string `json:"label"`
DictValue string `json:"value"`
}
type SysDictDataInsertReq struct {
Id int `json:"-" comment:""`
DictSort int `json:"dictSort" comment:""`
DictLabel string `json:"dictLabel" comment:""`
DictValue string `json:"dictValue" comment:""`
@@ -28,14 +33,13 @@ type SysDictDataControl struct {
CssClass string `json:"cssClass" comment:""`
ListClass string `json:"listClass" comment:""`
IsDefault string `json:"isDefault" comment:""`
Status int `json:"status" comment:""`
Status int `json:"status" comment:""`
Default string `json:"default" comment:""`
Remark string `json:"remark" comment:""`
common.ControlBy
}
func (s *SysDictDataControl) Generate(model *models.SysDictData) {
func (s *SysDictDataInsertReq) Generate(model *models.SysDictData) {
model.DictCode = s.Id
model.DictSort = s.DictSort
model.DictLabel = s.DictLabel
@@ -49,24 +53,56 @@ func (s *SysDictDataControl) Generate(model *models.SysDictData) {
model.Remark = s.Remark
}
func (s *SysDictDataControl) GetId() interface{} {
func (s *SysDictDataInsertReq) GetId() interface{} {
return s.Id
}
type SysDictDataById struct {
Id int `uri:"dictCode"`
Ids []int `json:"ids"`
type SysDictDataUpdateReq struct {
Id int `uri:"dictCode" comment:""`
DictSort int `json:"dictSort" comment:""`
DictLabel string `json:"dictLabel" comment:""`
DictValue string `json:"dictValue" comment:""`
DictType string `json:"dictType" comment:""`
CssClass string `json:"cssClass" comment:""`
ListClass string `json:"listClass" comment:""`
IsDefault string `json:"isDefault" comment:""`
Status int `json:"status" comment:""`
Default string `json:"default" comment:""`
Remark string `json:"remark" comment:""`
common.ControlBy
}
func (s *SysDictDataUpdateReq) Generate(model *models.SysDictData) {
model.DictCode = s.Id
model.DictSort = s.DictSort
model.DictLabel = s.DictLabel
model.DictValue = s.DictValue
model.DictType = s.DictType
model.CssClass = s.CssClass
model.ListClass = s.ListClass
model.IsDefault = s.IsDefault
model.Status = s.Status
model.Default = s.Default
model.Remark = s.Remark
}
func (s *SysDictDataUpdateReq) GetId() interface{} {
return s.Id
}
type SysDictDataGetReq struct {
Id int `uri:"dictCode"`
}
func (s *SysDictDataGetReq) GetId() interface{} {
return s.Id
}
type SysDictDataDeleteReq struct {
Ids []int `json:"ids"`
common.ControlBy `json:"-"`
}
func (s *SysDictDataById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
return s.Id
}
func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) {
return &models.SysDictData{}, nil
func (s *SysDictDataDeleteReq) GetId() interface{} {
return s.Ids
}
+36 -17
View File
@@ -7,7 +7,7 @@ import (
common "go-admin/common/models"
)
type SysDictTypeSearch struct {
type SysDictTypeGetPageReq struct {
dto.Pagination `search:"-"`
DictId []int `form:"dictId" search:"type:in;column:dict_id;table:sys_dict_type"`
DictName string `form:"dictName" search:"type:icontains;column:dict_name;table:sys_dict_type"`
@@ -19,11 +19,11 @@ type SysDictTypeOrder struct {
DictIdOrder string `search:"type:order;column:dict_id;table:sys_dict_type" form:"dictIdOrder"`
}
func (m *SysDictTypeSearch) GetNeedSearch() interface{} {
func (m *SysDictTypeGetPageReq) GetNeedSearch() interface{} {
return *m
}
type SysDictTypeControl struct {
type SysDictTypeInsertReq struct {
Id int `uri:"id"`
DictName string `json:"dictName"`
DictType string `json:"dictType"`
@@ -32,7 +32,7 @@ type SysDictTypeControl struct {
common.ControlBy
}
func (s *SysDictTypeControl) Generate(model *models.SysDictType) {
func (s *SysDictTypeInsertReq) Generate(model *models.SysDictType) {
if s.Id != 0 {
model.ID = s.Id
}
@@ -43,28 +43,47 @@ func (s *SysDictTypeControl) Generate(model *models.SysDictType) {
}
func (s *SysDictTypeControl) GetId() interface{} {
func (s *SysDictTypeInsertReq) GetId() interface{} {
return s.Id
}
type SysDictTypeById struct {
dto.ObjectById
type SysDictTypeUpdateReq struct {
Id int `uri:"id"`
DictName string `json:"dictName"`
DictType string `json:"dictType"`
Status int `json:"status"`
Remark string `json:"remark"`
common.ControlBy
}
func (s *SysDictTypeById) Generate() dto.Control {
cp := *s
return &cp
func (s *SysDictTypeUpdateReq) Generate(model *models.SysDictType) {
if s.Id != 0 {
model.ID = s.Id
}
model.DictName = s.DictName
model.DictType = s.DictType
model.Status = s.Status
model.Remark = s.Remark
}
func (s *SysDictTypeById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysDictTypeUpdateReq) GetId() interface{} {
return s.Id
}
func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) {
return &models.SysDictType{}, nil
type SysDictTypeGetReq struct {
Id int `uri:"id"`
}
func (s *SysDictTypeGetReq) GetId() interface{} {
return s.Id
}
type SysDictTypeDeleteReq struct {
Ids []int `json:"ids"`
common.ControlBy
}
func (s *SysDictTypeDeleteReq) GetId() interface{} {
return s.Ids
}
+10 -34
View File
@@ -1,14 +1,12 @@
package dto
import (
"go-admin/app/admin/models"
"time"
"go-admin/common/dto"
common "go-admin/common/models"
)
type SysLoginLogSearch struct {
type SysLoginLogGetPageReq struct {
dto.Pagination `search:"-"`
Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"`
Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"`
@@ -23,7 +21,7 @@ type SysLoginLogOrder struct {
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_login_log" form:"createdAtOrder"`
}
func (m *SysLoginLogSearch) GetNeedSearch() interface{} {
func (m *SysLoginLogGetPageReq) GetNeedSearch() interface{} {
return *m
}
@@ -41,41 +39,19 @@ type SysLoginLogControl struct {
Msg string `json:"msg" comment:"信息"`
}
func (s *SysLoginLogControl) Generate() (*models.SysLoginLog, error) {
return &models.SysLoginLog{
Model: common.Model{Id: s.ID},
Username: s.Username,
Status: s.Status,
Ipaddr: s.Ipaddr,
LoginLocation: s.LoginLocation,
Browser: s.Browser,
Os: s.Os,
Platform: s.Platform,
LoginTime: s.LoginTime,
Remark: s.Remark,
Msg: s.Msg,
}, nil
type SysLoginLogGetReq struct {
Id int `uri:"id"`
}
func (s *SysLoginLogControl) GetId() interface{} {
return s.ID
}
type SysLoginLogById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
common.ControlBy
}
func (s *SysLoginLogById) GetId() interface{} {
func (s *SysLoginLogGetReq) GetId() interface{} {
return s.Id
}
func (s *SysLoginLogById) Generate() *SysLoginLogById {
cp := *s
return &cp
// SysLoginLogDeleteReq 功能删除请求参数
type SysLoginLogDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysLoginLogById) GenerateM() (*models.SysLoginLog, error) {
return &models.SysLoginLog{}, nil
func (s *SysLoginLogDeleteReq) GetId() interface{} {
return s.Ids
}
+72 -36
View File
@@ -7,19 +7,18 @@ import (
"go-admin/common/dto"
)
// SysMenuSearch 列表或者搜索使用结构体
type SysMenuSearch struct {
// SysMenuGetPageReq 列表或者搜索使用结构体
type SysMenuGetPageReq struct {
dto.Pagination `search:"-"`
Title string `form:"title" search:"type:contains;column:title;table:sys_menu" comment:"菜单名称"` // 菜单名称
Visible int `form:"visible" search:"type:exact;column:visible;table:sys_menu" comment:"显示状态"` // 显示状态
}
func (m *SysMenuSearch) GetNeedSearch() interface{} {
func (m *SysMenuGetPageReq) GetNeedSearch() interface{} {
return *m
}
// SysMenuControl 增、改使用的结构体
type SysMenuControl struct {
type SysMenuInsertReq struct {
MenuId int `uri:"id" comment:"编码"` // 编码
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
Title string `form:"title" comment:"显示名称"` //显示名称
@@ -41,16 +40,7 @@ type SysMenuControl struct {
common.ControlBy
}
func (s *SysMenuControl) SetCreateBy(id int) {
s.CreateBy = id
}
func (s *SysMenuControl) SetUpdateBy(id int) {
s.UpdateBy = id
}
// Generate 结构体数据转化 从 Control 至 model 对应的模型
func (s *SysMenuControl) Generate(model *models.SysMenu) {
func (s *SysMenuInsertReq) Generate(model *models.SysMenu) {
if s.MenuId != 0 {
model.MenuId = s.MenuId
}
@@ -78,33 +68,79 @@ func (s *SysMenuControl) Generate(model *models.SysMenu) {
}
}
// GetId 获取数据对应的ID
func (s *SysMenuControl) GetId() interface{} {
func (s *SysMenuInsertReq) GetId() interface{} {
return s.MenuId
}
// SysMenuById 获取单个或者删除的结构体
type SysMenuById struct {
Id int `uri:"id"`
type SysMenuUpdateReq struct {
MenuId int `uri:"id" comment:"编码"` // 编码
MenuName string `form:"menuName" comment:"菜单name"` //菜单name
Title string `form:"title" comment:"显示名称"` //显示名称
Icon string `form:"icon" comment:"图标"` //图标
Path string `form:"path" comment:"路径"` //路径
Paths string `form:"paths" comment:"id路径"` //id路径
MenuType string `form:"menuType" comment:"菜单类型"` //菜单类型
SysApi []models.SysApi `form:"sysApi"`
Apis []int `form:"apis"`
Action string `form:"action" comment:"请求方式"` //请求方式
Permission string `form:"permission" comment:"权限编码"` //权限编码
ParentId int `form:"parentId" comment:"上级菜单"` //上级菜单
NoCache bool `form:"noCache" comment:"是否缓存"` //是否缓存
Breadcrumb string `form:"breadcrumb" comment:"是否面包屑"` //是否面包屑
Component string `form:"component" comment:"组件"` //组件
Sort int `form:"sort" comment:"排序"` //排序
Visible string `form:"visible" comment:"是否显示"` //是否显示
IsFrame string `form:"isFrame" comment:"是否frame"` //是否frame
common.ControlBy
}
func (s *SysMenuUpdateReq) Generate(model *models.SysMenu) {
if s.MenuId != 0 {
model.MenuId = s.MenuId
}
model.MenuName = s.MenuName
model.Title = s.Title
model.Icon = s.Icon
model.Path = s.Path
model.Paths = s.Paths
model.MenuType = s.MenuType
model.Action = s.Action
model.SysApi = s.SysApi
model.Permission = s.Permission
model.ParentId = s.ParentId
model.NoCache = s.NoCache
model.Breadcrumb = s.Breadcrumb
model.Component = s.Component
model.Sort = s.Sort
model.Visible = s.Visible
model.IsFrame = s.IsFrame
if s.CreateBy != 0 {
model.CreateBy = s.CreateBy
}
if s.UpdateBy != 0 {
model.UpdateBy = s.UpdateBy
}
}
func (s *SysMenuUpdateReq) GetId() interface{} {
return s.MenuId
}
type SysMenuGetReq struct {
Id int `uri:"id"`
}
func (s *SysMenuGetReq) GetId() interface{} {
return s.Id
}
type SysMenuDeleteReq struct {
Ids []int `json:"ids"`
common.ControlBy
}
func (s *SysMenuById) Generate() *SysMenuById {
cp := *s
return &cp
}
func (s *SysMenuById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
return s.Id
}
func (s *SysMenuById) GenerateM() (*models.SysMenu, error) {
return &models.SysMenu{}, nil
func (s *SysMenuDeleteReq) GetId() interface{} {
return s.Ids
}
type MenuLabel struct {
@@ -120,4 +156,4 @@ type MenuRole struct {
type SelectRole struct {
RoleId int `uri:"roleId"`
}
}
+11 -11
View File
@@ -8,7 +8,7 @@ import (
common "go-admin/common/models"
)
type SysOperaLogSearch struct {
type SysOperaLogGetPageReq struct {
dto.Pagination `search:"-"`
Title string `form:"title" search:"type:contains;column:title;table:sys_opera_log" comment:"操作模块"`
Method string `form:"method" search:"type:contains;column:method;table:sys_opera_log" comment:"函数"`
@@ -25,7 +25,7 @@ type SysOperaLogOrder struct {
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_opera_log" form:"createdAtOrder"`
}
func (m *SysOperaLogSearch) GetNeedSearch() interface{} {
func (m *SysOperaLogGetPageReq) GetNeedSearch() interface{} {
return *m
}
@@ -79,19 +79,19 @@ func (s *SysOperaLogControl) GetId() interface{} {
return s.ID
}
type SysOperaLogById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
type SysOperaLogGetReq struct {
Id int `uri:"id"`
}
func (s *SysOperaLogById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysOperaLogGetReq) GetId() interface{} {
return s.Id
}
func (s *SysOperaLogById) SetUpdateBy(id int) {
// SysOperaLogDeleteReq 功能删除请求参数
type SysOperaLogDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysOperaLogDeleteReq) GetId() interface{} {
return s.Ids
}
+49 -23
View File
@@ -7,8 +7,8 @@ import (
"go-admin/common/dto"
)
// SysPostSearch 列表或者搜索使用结构体
type SysPostSearch struct {
// SysPostPageReq 列表或者搜索使用结构体
type SysPostPageReq struct {
dto.Pagination `search:"-"`
PostId int `form:"postId" search:"type:exact;column:post_id;table:sys_post" comment:"id"` // id
PostName string `form:"postName" search:"type:contains;column:post_name;table:sys_post" comment:"名称"` // 名称
@@ -18,12 +18,12 @@ type SysPostSearch struct {
Remark string `form:"remark" search:"type:exact;column:remark;table:sys_post" comment:"备注"` // 备注
}
func (m *SysPostSearch) GetNeedSearch() interface{} {
func (m *SysPostPageReq) GetNeedSearch() interface{} {
return *m
}
// SysPostControl 增、改使用的结构体
type SysPostControl struct {
// SysPostInsertReq 增使用的结构体
type SysPostInsertReq struct {
PostId int `uri:"id" comment:"id"`
PostName string `form:"postName" comment:"名称"`
PostCode string `form:"postCode" comment:"编码"`
@@ -33,11 +33,7 @@ type SysPostControl struct {
common.ControlBy
}
// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型
func (s *SysPostControl) Generate(model *models.SysPost) {
if s.PostId != 0 {
model.PostId = s.PostId
}
func (s *SysPostInsertReq) Generate(model *models.SysPost) {
model.PostName = s.PostName
model.PostCode = s.PostCode
model.Sort = s.Sort
@@ -52,18 +48,28 @@ func (s *SysPostControl) Generate(model *models.SysPost) {
}
// GetId 获取数据对应的ID
func (s *SysPostControl) GetId() interface{} {
func (s *SysPostInsertReq) GetId() interface{} {
return s.PostId
}
// SysPostById 获取单个或者删除的结构体
type SysPostById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
// SysPostUpdateReq 改使用的结构体
type SysPostUpdateReq struct {
PostId int `uri:"id" comment:"id"`
PostName string `form:"postName" comment:"名称"`
PostCode string `form:"postCode" comment:"编码"`
Sort int `form:"sort" comment:"排序"`
Status int `form:"status" comment:"状态"`
Remark string `form:"remark" comment:"备注"`
common.ControlBy
}
func (s *SysPostById) Generate(model *models.SysPost) {
func (s *SysPostUpdateReq) Generate(model *models.SysPost) {
model.PostId = s.PostId
model.PostName = s.PostName
model.PostCode = s.PostCode
model.Sort = s.Sort
model.Status = s.Status
model.Remark = s.Remark
if s.ControlBy.UpdateBy != 0 {
model.UpdateBy = s.UpdateBy
}
@@ -72,14 +78,34 @@ func (s *SysPostById) Generate(model *models.SysPost) {
}
}
func (s *SysPostById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysPostUpdateReq) GetId() interface{} {
return s.PostId
}
// SysPostGetReq 获取单个的结构体
type SysPostGetReq struct {
Id int `uri:"id"`
}
func (s *SysPostGetReq) GetId() interface{} {
return s.Id
}
func (s *SysPostById) GenerateM() (*models.SysPost, error) {
return &models.SysPost{}, nil
// SysPostDeleteReq 删除的结构体
type SysPostDeleteReq struct {
Ids []int `json:"ids"`
common.ControlBy
}
func (s *SysPostDeleteReq) Generate(model *models.SysPost) {
if s.ControlBy.UpdateBy != 0 {
model.UpdateBy = s.UpdateBy
}
if s.ControlBy.CreateBy != 0 {
model.CreateBy = s.CreateBy
}
}
func (s *SysPostDeleteReq) GetId() interface{} {
return s.Ids
}
+52 -33
View File
@@ -7,8 +7,7 @@ import (
"go-admin/common/dto"
)
// SysRoleSearch 列表或者搜索使用结构体
type SysRoleSearch struct {
type SysRoleGetPageReq struct {
dto.Pagination `search:"-"`
RoleId int `form:"roleId" search:"type:exact;column:role_id;table:sys_role" comment:"角色编码"` // 角色编码
@@ -30,11 +29,11 @@ type SysRoleOrder struct {
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_role" form:"createdAtOrder"`
}
func (m *SysRoleSearch) GetNeedSearch() interface{} {
func (m *SysRoleGetPageReq) GetNeedSearch() interface{} {
return *m
}
type SysRoleControl struct {
type SysRoleInsertReq struct {
RoleId int `uri:"id" comment:"角色编码"` // 角色编码
RoleName string `form:"roleName" comment:"角色名称"` // 角色名称
Status string `form:"status" comment:"状态"` // 状态
@@ -51,16 +50,7 @@ type SysRoleControl struct {
common.ControlBy
}
func (s *SysRoleControl) SetCreateBy(id int) {
s.CreateBy = id
}
func (s *SysRoleControl) SetUpdateBy(id int) {
s.UpdateBy = id
}
// Generate 结构体数据转化
func (s *SysRoleControl) Generate(model *models.SysRole) {
func (s *SysRoleInsertReq) Generate(model *models.SysRole) {
if s.RoleId != 0 {
model.RoleId = s.RoleId
}
@@ -74,11 +64,46 @@ func (s *SysRoleControl) Generate(model *models.SysRole) {
model.DataScope = s.DataScope
model.SysMenu = &s.SysMenu
model.SysDept = s.SysDept
}
// GetId 获取数据对应的ID
func (s *SysRoleControl) GetId() interface{} {
func (s *SysRoleInsertReq) GetId() interface{} {
return s.RoleId
}
type SysRoleUpdateReq struct {
RoleId int `uri:"id" comment:"角色编码"` // 角色编码
RoleName string `form:"roleName" comment:"角色名称"` // 角色名称
Status string `form:"status" comment:"状态"` // 状态
RoleKey string `form:"roleKey" comment:"角色代码"` // 角色代码
RoleSort int `form:"roleSort" comment:"角色排序"` // 角色排序
Flag string `form:"flag" comment:"标记"` // 标记
Remark string `form:"remark" comment:"备注"` // 备注
Admin bool `form:"admin" comment:"是否管理员"`
DataScope string `form:"dataScope"`
SysMenu []models.SysMenu `form:"sysMenu"`
MenuIds []int `form:"menuIds"`
SysDept []models.SysDept `form:"sysDept"`
DeptIds []int `form:"deptIds"`
common.ControlBy
}
func (s *SysRoleUpdateReq) Generate(model *models.SysRole) {
if s.RoleId != 0 {
model.RoleId = s.RoleId
}
model.RoleName = s.RoleName
model.Status = s.Status
model.RoleKey = s.RoleKey
model.RoleSort = s.RoleSort
model.Flag = s.Flag
model.Remark = s.Remark
model.Admin = s.Admin
model.DataScope = s.DataScope
model.SysMenu = &s.SysMenu
model.SysDept = s.SysDept
}
func (s *SysRoleUpdateReq) GetId() interface{} {
return s.RoleId
}
@@ -103,26 +128,20 @@ type SysRoleByName struct {
RoleName string `form:"role"` // 角色编码
}
// SysRoleById 获取单个或者删除的结构体
type SysRoleById struct {
dto.ObjectById
type SysRoleGetReq struct {
Id int `uri:"id"`
}
func (s *SysRoleById) Generate() *SysRoleById {
cp := *s
return &cp
}
func (s *SysRoleById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysRoleGetReq) GetId() interface{} {
return s.Id
}
func (s *SysRoleById) GenerateM() (*models.SysRole, error) {
return &models.SysRole{}, nil
type SysRoleDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysRoleDeleteReq) GetId() interface{} {
return s.Ids
}
// RoleDataScopeReq 角色数据权限修改
@@ -142,4 +161,4 @@ func (s *RoleDataScopeReq) Generate(model *models.SysRole) {
type DeptIdList struct {
DeptId int `json:"DeptId"`
}
}
+72 -18
View File
@@ -7,7 +7,7 @@ import (
common "go-admin/common/models"
)
type SysUserSearch struct {
type SysUserGetPageReq struct {
dto.Pagination `search:"-"`
UserId int `form:"userId" search:"type:exact;column:user_id;table:sys_user" comment:"用户ID"`
Username string `form:"username" search:"type:contains;column:username;table:sys_user" comment:"用户名"`
@@ -33,13 +33,13 @@ type DeptJoin struct {
DeptId string `search:"type:contains;column:dept_path;table:sys_dept" form:"deptId"`
}
func (m *SysUserSearch) GetNeedSearch() interface{} {
func (m *SysUserGetPageReq) GetNeedSearch() interface{} {
return *m
}
type ResetSysUserPwdReq struct {
UserId int `json:"userId" comment:"用户ID" binding:"required"` // 用户ID
Password string `json:"password" comment:"密码" binding:"required"`
UserId int `json:"userId" comment:"用户ID" vd:"$>0"` // 用户ID
Password string `json:"password" comment:"密码" vd:"len($)>0"`
common.ControlBy
}
@@ -54,9 +54,26 @@ func (s *ResetSysUserPwdReq) Generate(model *models.SysUser) {
model.Password = s.Password
}
type UpdateSysUserAvatarReq struct {
UserId int `json:"userId" comment:"用户ID" vd:"len($)>0"` // 用户ID
Avatar string `json:"avatar" comment:"头像" vd:"len($)>0"`
common.ControlBy
}
func (s *UpdateSysUserAvatarReq) GetId() interface{} {
return s.UserId
}
func (s *UpdateSysUserAvatarReq) Generate(model *models.SysUser) {
if s.UserId != 0 {
model.UserId = s.UserId
}
model.Avatar = s.Avatar
}
type UpdateSysUserStatusReq struct {
UserId int `json:"userId" comment:"用户ID" binding:"required"` // 用户ID
Status string `json:"status" comment:"状态" binding:"required"`
UserId int `json:"userId" comment:"用户ID" vd:"$>0"` // 用户ID
Status string `json:"status" comment:"状态" vd:"len($)>0"`
common.ControlBy
}
@@ -71,24 +88,24 @@ func (s *UpdateSysUserStatusReq) Generate(model *models.SysUser) {
model.Status = s.Status
}
type SysUserControl struct {
type SysUserInsertReq struct {
UserId int `json:"userId" comment:"用户ID"` // 用户ID
Username string `json:"username" comment:"用户名" binding:"required"`
Username string `json:"username" comment:"用户名" vd:"len($)>0"`
Password string `json:"password" comment:"密码"`
NickName string `json:"nickName" comment:"昵称" binding:"required"`
Phone string `json:"phone" comment:"手机号" binding:"required"`
NickName string `json:"nickName" comment:"昵称" vd:"len($)>0"`
Phone string `json:"phone" comment:"手机号" vd:"len($)>0"`
RoleId int `json:"roleId" comment:"角色ID"`
Avatar string `json:"avatar" comment:"头像"`
Sex string `json:"sex" comment:"性别"`
Email string `json:"email" comment:"邮箱" binding:"required,email"`
DeptId int `json:"deptId" comment:"部门" binding:"required"`
Email string `json:"email" comment:"邮箱" vd:"len($)>0,email"`
DeptId int `json:"deptId" comment:"部门" vd:"$>0"`
PostId int `json:"postId" comment:"岗位"`
Remark string `json:"remark" comment:"备注"`
Status string `json:"status" comment:"状态" binding:"required" default:"1"`
Status string `json:"status" comment:"状态" vd:"len($)>0" default:"1"`
common.ControlBy
}
func (s *SysUserControl) Generate(model *models.SysUser) {
func (s *SysUserInsertReq) Generate(model *models.SysUser) {
if s.UserId != 0 {
model.UserId = s.UserId
}
@@ -106,7 +123,44 @@ func (s *SysUserControl) Generate(model *models.SysUser) {
model.Status = s.Status
}
func (s *SysUserControl) GetId() interface{} {
func (s *SysUserInsertReq) GetId() interface{} {
return s.UserId
}
type SysUserUpdateReq struct {
UserId int `json:"userId" comment:"用户ID"` // 用户ID
Username string `json:"username" comment:"用户名" vd:"len($)>0"`
NickName string `json:"nickName" comment:"昵称" vd:"len($)>0"`
Phone string `json:"phone" comment:"手机号" vd:"len($)>0"`
RoleId int `json:"roleId" comment:"角色ID"`
Avatar string `json:"avatar" comment:"头像"`
Sex string `json:"sex" comment:"性别"`
Email string `json:"email" comment:"邮箱" vd:"len($)>0,email"`
DeptId int `json:"deptId" comment:"部门" vd:"$>0"`
PostId int `json:"postId" comment:"岗位"`
Remark string `json:"remark" comment:"备注"`
Status string `json:"status" comment:"状态" default:"1"`
common.ControlBy
}
func (s *SysUserUpdateReq) Generate(model *models.SysUser) {
if s.UserId != 0 {
model.UserId = s.UserId
}
model.Username = s.Username
model.NickName = s.NickName
model.Phone = s.Phone
model.RoleId = s.RoleId
model.Avatar = s.Avatar
model.Sex = s.Sex
model.Email = s.Email
model.DeptId = s.DeptId
model.PostId = s.PostId
model.Remark = s.Remark
model.Status = s.Status
}
func (s *SysUserUpdateReq) GetId() interface{} {
return s.UserId
}
@@ -129,6 +183,6 @@ func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
// PassWord 密码
type PassWord struct {
NewPassword string `json:"newPassword" binding:"required"`
OldPassword string `json:"oldPassword" binding:"required"`
}
NewPassword string `json:"newPassword" vd:"len($)>0"`
OldPassword string `json:"oldPassword" vd:"len($)>0"`
}
+4 -4
View File
@@ -19,7 +19,7 @@ type SysApi struct {
}
// GetPage 获取SysApi列表
func (e *SysApi) GetPage(c *dto.SysApiSearch, p *actions.DataPermission, list *[]models.SysApi, count *int64) error {
func (e *SysApi) GetPage(c *dto.SysApiGetPageReq, p *actions.DataPermission, list *[]models.SysApi, count *int64) error {
var err error
var data models.SysApi
@@ -39,7 +39,7 @@ func (e *SysApi) GetPage(c *dto.SysApiSearch, p *actions.DataPermission, list *[
}
// Get 获取SysApi对象with id
func (e *SysApi) Get(d *dto.SysApiById, p *actions.DataPermission, model *models.SysApi) *SysApi {
func (e *SysApi) Get(d *dto.SysApiGetReq, p *actions.DataPermission, model *models.SysApi) *SysApi {
var data models.SysApi
err := e.Orm.Model(&data).
Scopes(
@@ -61,7 +61,7 @@ func (e *SysApi) Get(d *dto.SysApiById, p *actions.DataPermission, model *models
}
// Update 修改SysApi对象
func (e *SysApi) Update(c *dto.SysApiControl, p *actions.DataPermission) error {
func (e *SysApi) Update(c *dto.SysApiUpdateReq, p *actions.DataPermission) error {
var model = models.SysApi{}
db := e.Orm.Debug().First(&model, c.GetId())
if db.RowsAffected == 0 {
@@ -78,7 +78,7 @@ func (e *SysApi) Update(c *dto.SysApiControl, p *actions.DataPermission) error {
}
// Remove 删除SysApi
func (e *SysApi) Remove(d *dto.SysApiById, p *actions.DataPermission) error {
func (e *SysApi) Remove(d *dto.SysApiDeleteReq, p *actions.DataPermission) error {
var data models.SysApi
db := e.Orm.Model(&data).
+4 -4
View File
@@ -16,7 +16,7 @@ type SysConfig struct {
}
// GetPage 获取SysConfig列表
func (e *SysConfig) GetPage(c *dto.SysConfigSearch, list *[]models.SysConfig, count *int64) error {
func (e *SysConfig) GetPage(c *dto.SysConfigGetPageReq, list *[]models.SysConfig, count *int64) error {
err := e.Orm.
Scopes(
cDto.MakeCondition(c.GetNeedSearch()),
@@ -32,7 +32,7 @@ func (e *SysConfig) GetPage(c *dto.SysConfigSearch, list *[]models.SysConfig, co
}
// Get 获取SysConfig对象
func (e *SysConfig) Get(d *dto.SysConfigById, model *models.SysConfig) error {
func (e *SysConfig) Get(d *dto.SysConfigGetReq, model *models.SysConfig) error {
err := e.Orm.First(model, d.GetId()).Error
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
err = errors.New("查看对象不存在或无权查看")
@@ -137,7 +137,7 @@ func (e *SysConfig) UpdateForSet(c *[]dto.GetSetSysConfigReq) error {
}
// Remove 删除SysConfig
func (e *SysConfig) Remove(d *dto.SysConfigById) error {
func (e *SysConfig) Remove(d *dto.SysConfigDeleteReq) error {
var err error
var data models.SysConfig
@@ -167,7 +167,7 @@ func (e *SysConfig) GetWithKey(c *dto.SysConfigByKeyReq, resp *dto.GetSysConfigB
return nil
}
func (e *SysConfig) GetWithKeyList(c *dto.SysConfigSearch, list *[]models.SysConfig) error {
func (e *SysConfig) GetWithKeyList(c *dto.SysConfigGetToSysAppReq, list *[]models.SysConfig) error {
var err error
err = e.Orm.
Scopes(
+22 -22
View File
@@ -20,24 +20,24 @@ type SysDept struct {
}
// GetPage 获取SysDept列表
func (e *SysDept) GetPage(c *dto.SysDeptSearch, list *[]models.SysDept) error {
var err error
var data models.SysDept
err = e.Orm.Model(&data).
Scopes(
cDto.MakeCondition(c.GetNeedSearch()),
).
Find(list).Error
if err != nil {
e.Log.Errorf("db error:%s", err)
return err
}
return nil
}
//func (e *SysDept) GetPage(c *dto.SysDeptGetPageReq, list *[]models.SysDept) error {
// var err error
// var data models.SysDept
//
// err = e.Orm.Model(&data).
// Scopes(
// cDto.MakeCondition(c.GetNeedSearch()),
// ).
// Find(list).Error
// if err != nil {
// e.Log.Errorf("db error:%s", err)
// return err
// }
// return nil
//}
// Get 获取SysDept对象
func (e *SysDept) Get(d *dto.SysDeptById, model *models.SysDept) error {
func (e *SysDept) Get(d *dto.SysDeptGetReq, model *models.SysDept) error {
var err error
var data models.SysDept
@@ -57,7 +57,7 @@ func (e *SysDept) Get(d *dto.SysDeptById, model *models.SysDept) error {
}
// Insert 创建SysDept对象
func (e *SysDept) Insert(c *dto.SysDeptControl) error {
func (e *SysDept) Insert(c *dto.SysDeptInsertReq) error {
var err error
var data models.SysDept
c.Generate(&data)
@@ -92,7 +92,7 @@ func (e *SysDept) Insert(c *dto.SysDeptControl) error {
}
// Update 修改SysDept对象
func (e *SysDept) Update(c *dto.SysDeptControl) error {
func (e *SysDept) Update(c *dto.SysDeptUpdateReq) error {
var err error
var model = models.SysDept{}
tx := e.Orm.Debug().Begin()
@@ -127,7 +127,7 @@ func (e *SysDept) Update(c *dto.SysDeptControl) error {
}
// Remove 删除SysDept
func (e *SysDept) Remove(d *dto.SysDeptById) error {
func (e *SysDept) Remove(d *dto.SysDeptDeleteReq) error {
var err error
var data models.SysDept
@@ -145,7 +145,7 @@ func (e *SysDept) Remove(d *dto.SysDeptById) error {
}
// GetSysDeptList 获取组织数据
func (e *SysDept) getList(c *dto.SysDeptSearch, list *[]models.SysDept) error {
func (e *SysDept) getList(c *dto.SysDeptGetPageReq, list *[]models.SysDept) error {
var err error
var data models.SysDept
@@ -162,7 +162,7 @@ func (e *SysDept) getList(c *dto.SysDeptSearch, list *[]models.SysDept) error {
}
// SetDeptTree 设置组织数据
func (e *SysDept) SetDeptTree(c *dto.SysDeptSearch) (m []dto.DeptLabel, err error) {
func (e *SysDept) SetDeptTree(c *dto.SysDeptGetPageReq) (m []dto.DeptLabel, err error) {
var list []models.SysDept
err = e.getList(c, &list)
@@ -198,7 +198,7 @@ func deptTreeCall(deptList *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel
}
// SetDeptPage 设置dept页面数据
func (e *SysDept) SetDeptPage(c *dto.SysDeptSearch) (m []models.SysDept, err error) {
func (e *SysDept) SetDeptPage(c *dto.SysDeptGetPageReq) (m []models.SysDept, err error) {
var list []models.SysDept
err = e.getList(c, &list)
for i := 0; i < len(list); i++ {
+6 -6
View File
@@ -16,7 +16,7 @@ type SysDictData struct {
}
// GetPage 获取列表
func (e *SysDictData) GetPage(c *dto.SysDictDataSearch, list *[]models.SysDictData, count *int64) error {
func (e *SysDictData) GetPage(c *dto.SysDictDataGetPageReq, list *[]models.SysDictData, count *int64) error {
var err error
var data models.SysDictData
@@ -35,7 +35,7 @@ func (e *SysDictData) GetPage(c *dto.SysDictDataSearch, list *[]models.SysDictDa
}
// Get 获取对象
func (e *SysDictData) Get(d *dto.SysDictDataById, model *models.SysDictData) error {
func (e *SysDictData) Get(d *dto.SysDictDataGetReq, model *models.SysDictData) error {
var err error
var data models.SysDictData
@@ -55,7 +55,7 @@ func (e *SysDictData) Get(d *dto.SysDictDataById, model *models.SysDictData) err
}
// Insert 创建对象
func (e *SysDictData) Insert(c *dto.SysDictDataControl) error {
func (e *SysDictData) Insert(c *dto.SysDictDataInsertReq) error {
var err error
var data = new(models.SysDictData)
c.Generate(data)
@@ -68,7 +68,7 @@ func (e *SysDictData) Insert(c *dto.SysDictDataControl) error {
}
// Update 修改对象
func (e *SysDictData) Update(c *dto.SysDictDataControl) error {
func (e *SysDictData) Update(c *dto.SysDictDataUpdateReq) error {
var err error
var model = models.SysDictData{}
e.Orm.First(&model, c.GetId())
@@ -86,7 +86,7 @@ func (e *SysDictData) Update(c *dto.SysDictDataControl) error {
}
// Remove 删除
func (e *SysDictData) Remove(c *dto.SysDictDataById) error {
func (e *SysDictData) Remove(c *dto.SysDictDataDeleteReq) error {
var err error
var data models.SysDictData
@@ -104,7 +104,7 @@ func (e *SysDictData) Remove(c *dto.SysDictDataById) error {
}
// GetAll 获取所有
func (e *SysDictData) GetAll(c *dto.SysDictDataSearch, list *[]models.SysDictData) error {
func (e *SysDictData) GetAll(c *dto.SysDictDataGetPageReq, list *[]models.SysDictData) error {
var err error
var data models.SysDictData
+6 -6
View File
@@ -16,7 +16,7 @@ type SysDictType struct {
}
// GetPage 获取列表
func (e *SysDictType) GetPage(c *dto.SysDictTypeSearch, list *[]models.SysDictType, count *int64) error {
func (e *SysDictType) GetPage(c *dto.SysDictTypeGetPageReq, list *[]models.SysDictType, count *int64) error {
var err error
var data models.SysDictType
@@ -35,7 +35,7 @@ func (e *SysDictType) GetPage(c *dto.SysDictTypeSearch, list *[]models.SysDictTy
}
// Get 获取对象
func (e *SysDictType) Get(d *dto.SysDictTypeById, model *models.SysDictType) error {
func (e *SysDictType) Get(d *dto.SysDictTypeGetReq, model *models.SysDictType) error {
var err error
db := e.Orm.First(model, d.GetId())
@@ -53,7 +53,7 @@ func (e *SysDictType) Get(d *dto.SysDictTypeById, model *models.SysDictType) err
}
// Insert 创建对象
func (e *SysDictType) Insert(c *dto.SysDictTypeControl) error {
func (e *SysDictType) Insert(c *dto.SysDictTypeInsertReq) error {
var err error
var data models.SysDictType
c.Generate(&data)
@@ -71,7 +71,7 @@ func (e *SysDictType) Insert(c *dto.SysDictTypeControl) error {
}
// Update 修改对象
func (e *SysDictType) Update(c *dto.SysDictTypeControl) error {
func (e *SysDictType) Update(c *dto.SysDictTypeUpdateReq) error {
var err error
var model = models.SysDictType{}
e.Orm.First(&model, c.GetId())
@@ -89,7 +89,7 @@ func (e *SysDictType) Update(c *dto.SysDictTypeControl) error {
}
// Remove 删除
func (e *SysDictType) Remove(d *dto.SysDictTypeById) error {
func (e *SysDictType) Remove(d *dto.SysDictTypeDeleteReq) error {
var err error
var data models.SysDictType
@@ -107,7 +107,7 @@ func (e *SysDictType) Remove(d *dto.SysDictTypeById) error {
}
// GetAll 获取所有
func (e *SysDictType) GetAll(c *dto.SysDictTypeSearch, list *[]models.SysDictType) error {
func (e *SysDictType) GetAll(c *dto.SysDictTypeGetPageReq, list *[]models.SysDictType) error {
var err error
var data models.SysDictType
+5 -5
View File
@@ -15,8 +15,8 @@ type SysLoginLog struct {
service.Service
}
// GetSysLoginLogPage 获取SysLoginLog列表
func (e *SysLoginLog) GetPage(c *dto.SysLoginLogSearch, list *[]models.SysLoginLog, count *int64) error {
// GetPage 获取SysLoginLog列表
func (e *SysLoginLog) GetPage(c *dto.SysLoginLogGetPageReq, list *[]models.SysLoginLog, count *int64) error {
var err error
var data models.SysLoginLog
@@ -34,8 +34,8 @@ func (e *SysLoginLog) GetPage(c *dto.SysLoginLogSearch, list *[]models.SysLoginL
return nil
}
// GetSysLoginLog 获取SysLoginLog对象
func (e *SysLoginLog) Get(d *dto.SysLoginLogById, model *models.SysLoginLog) error {
// Get 获取SysLoginLog对象
func (e *SysLoginLog) Get(d *dto.SysLoginLogGetReq, model *models.SysLoginLog) error {
var err error
db := e.Orm.First(model, d.GetId())
err = db.Error
@@ -52,7 +52,7 @@ func (e *SysLoginLog) Get(d *dto.SysLoginLogById, model *models.SysLoginLog) err
}
// Remove 删除SysLoginLog
func (e *SysLoginLog) Remove(c *dto.SysLoginLogById) error {
func (e *SysLoginLog) Remove(c *dto.SysLoginLogDeleteReq) error {
var err error
var data models.SysLoginLog
+55 -23
View File
@@ -1,10 +1,10 @@
package service
import (
"errors"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"github.com/pkg/errors"
"gorm.io/gorm"
"strings"
"go-admin/app/admin/models"
"go-admin/app/admin/service/dto"
@@ -19,7 +19,7 @@ type SysMenu struct {
}
// GetPage 获取SysMenu列表
func (e *SysMenu) GetPage(c *dto.SysMenuSearch, menus *[]models.SysMenu) *SysMenu {
func (e *SysMenu) GetPage(c *dto.SysMenuGetPageReq, menus *[]models.SysMenu) *SysMenu {
var menu = make([]models.SysMenu, 0)
err := e.getPage(c, &menu).Error
if err != nil {
@@ -37,7 +37,7 @@ func (e *SysMenu) GetPage(c *dto.SysMenuSearch, menus *[]models.SysMenu) *SysMen
}
// getPage 菜单分页列表
func (e *SysMenu) getPage(c *dto.SysMenuSearch, list *[]models.SysMenu) *SysMenu {
func (e *SysMenu) getPage(c *dto.SysMenuGetPageReq, list *[]models.SysMenu) *SysMenu {
var err error
var data models.SysMenu
@@ -56,7 +56,7 @@ func (e *SysMenu) getPage(c *dto.SysMenuSearch, list *[]models.SysMenu) *SysMenu
}
// Get 获取SysMenu对象
func (e *SysMenu) Get(d *dto.SysMenuById, model *models.SysMenu) *SysMenu {
func (e *SysMenu) Get(d *dto.SysMenuGetReq, model *models.SysMenu) *SysMenu {
var err error
var data models.SysMenu
@@ -83,7 +83,7 @@ func (e *SysMenu) Get(d *dto.SysMenuById, model *models.SysMenu) *SysMenu {
}
// Insert 创建SysMenu对象
func (e *SysMenu) Insert(c *dto.SysMenuControl) *SysMenu {
func (e *SysMenu) Insert(c *dto.SysMenuInsertReq) *SysMenu {
var err error
var data models.SysMenu
c.Generate(&data)
@@ -93,6 +93,11 @@ func (e *SysMenu) Insert(c *dto.SysMenuControl) *SysMenu {
_ = e.AddError(err)
}
c.MenuId = data.MenuId
err = e.initPaths(&data)
if err != nil {
e.Log.Errorf("db error:%s", err)
_ = e.AddError(err)
}
return e
}
@@ -115,7 +120,7 @@ func (e *SysMenu) initPaths(menu *models.SysMenu) error {
}
// Update 修改SysMenu对象
func (e *SysMenu) Update(c *dto.SysMenuControl) *SysMenu {
func (e *SysMenu) Update(c *dto.SysMenuUpdateReq) *SysMenu {
var err error
tx := e.Orm.Debug().Begin()
defer func() {
@@ -128,6 +133,7 @@ func (e *SysMenu) Update(c *dto.SysMenuControl) *SysMenu {
var alist = make([]models.SysApi, 0)
var model = models.SysMenu{}
tx.Preload("SysApi").First(&model, c.GetId())
oldPath := model.Paths
tx.Where("id in ?", c.Apis).Find(&alist)
err = tx.Model(&model).Association("SysApi").Delete(model.SysApi)
if err != nil {
@@ -147,11 +153,17 @@ func (e *SysMenu) Update(c *dto.SysMenuControl) *SysMenu {
_ = e.AddError(errors.New("无权更新该数据"))
return e
}
var menuList []models.SysMenu
tx.Where("paths like ?", oldPath+"%").Find(&menuList)
for _, v := range menuList {
v.Paths = strings.Replace(v.Paths, oldPath, model.Paths, 1)
tx.Model(&v).Update("paths", v.Paths)
}
return e
}
// Remove 删除SysMenu
func (e *SysMenu) Remove(d *dto.SysMenuById) *SysMenu {
func (e *SysMenu) Remove(d *dto.SysMenuDeleteReq) *SysMenu {
var err error
var data models.SysMenu
@@ -169,7 +181,7 @@ func (e *SysMenu) Remove(d *dto.SysMenuById) *SysMenu {
}
// GetList 获取菜单数据
func (e *SysMenu) GetList(c *dto.SysMenuSearch, list *[]models.SysMenu) error {
func (e *SysMenu) GetList(c *dto.SysMenuGetPageReq, list *[]models.SysMenu) error {
var err error
var data models.SysMenu
@@ -188,7 +200,7 @@ func (e *SysMenu) GetList(c *dto.SysMenuSearch, list *[]models.SysMenu) error {
// SetLabel 修改角色中 设置菜单基础数据
func (e *SysMenu) SetLabel() (m []dto.MenuLabel, err error) {
var list []models.SysMenu
err = e.GetList(&dto.SysMenuSearch{}, &list)
err = e.GetList(&dto.SysMenuGetPageReq{}, &list)
m = make([]dto.MenuLabel, 0)
for i := 0; i < len(list); i++ {
@@ -322,26 +334,46 @@ func (e *SysMenu) SetMenuRole(roleName string) (m []models.SysMenu, err error) {
}
func (e *SysMenu) getByRoleName(roleName string) ([]models.SysMenu, error) {
var MenuList []models.SysMenu
var role models.SysRole
var err error
if roleName == "admin" {
var data []models.SysMenu
err = e.Orm.Where(" menu_type in ('M','C')").Order("sort").Find(&data).Error
MenuList = data
err = e.Orm.Where(" menu_type in ('M','C') and deleted_at is null and created_at>'2021-08-13'").
Order("sort").
Find(&data).
Error
err = errors.WithStack(err)
return data, err
} else {
role.RoleKey = roleName
err = e.Orm.Debug().Model(&role).Where("role_key = ? ", roleName).Preload("SysMenu", func(db *gorm.DB) *gorm.DB {
return db.Where(" menu_type in ('M','C')").Order("sort")
}).Find(&role).Error
if role.SysMenu != nil {
MenuList = *role.SysMenu
err = e.Orm.
Model(&role).
Where("role_key = ? ", roleName).
Preload("SysMenu", func(db *gorm.DB) *gorm.DB {
return db.Where(" menu_type in ('F','C')").Order("sort")
}).
Find(&role).Error
MenuList := *role.SysMenu
mIds := make([]string, 0)
mp := make(map[string]string, 0)
for _, menu := range MenuList {
ids := strings.Split(menu.Paths, "/")
for _, id := range ids {
if mp[id] == "" {
mp[id] = id
mIds = append(mIds, id)
}
}
}
var data []models.SysMenu
err = e.Orm.Where(" menu_id in ? and menu_type in ('M','C')", mIds).
Order("sort").
Find(&data).
Error
if err != nil {
return nil, err
}
return data, err
}
if err != nil {
e.Log.Errorf("db error:%s", err)
}
return MenuList, err
}
+3 -3
View File
@@ -16,7 +16,7 @@ type SysOperaLog struct {
}
// GetPage 获取SysOperaLog列表
func (e *SysOperaLog) GetPage(c *dto.SysOperaLogSearch, list *[]models.SysOperaLog, count *int64) error {
func (e *SysOperaLog) GetPage(c *dto.SysOperaLogGetPageReq, list *[]models.SysOperaLog, count *int64) error {
var err error
var data models.SysOperaLog
@@ -35,7 +35,7 @@ func (e *SysOperaLog) GetPage(c *dto.SysOperaLogSearch, list *[]models.SysOperaL
}
// Get 获取SysOperaLog对象
func (e *SysOperaLog) Get(d *dto.SysOperaLogById, model *models.SysOperaLog) error {
func (e *SysOperaLog) Get(d *dto.SysOperaLogGetReq, model *models.SysOperaLog) error {
var data models.SysOperaLog
err := e.Orm.Model(&data).
@@ -67,7 +67,7 @@ func (e *SysOperaLog) Insert(model *models.SysOperaLog) error {
}
// Remove 删除SysOperaLog
func (e *SysOperaLog) Remove(d *dto.SysOperaLogById) error {
func (e *SysOperaLog) Remove(d *dto.SysOperaLogDeleteReq) error {
var err error
var data models.SysOperaLog
+12 -12
View File
@@ -15,8 +15,8 @@ type SysPost struct {
service.Service
}
// GetSysPostPage 获取SysPost列表
func (e *SysPost) GetSysPostPage(c *dto.SysPostSearch, list *[]models.SysPost, count *int64) error {
// GetPage 获取SysPost列表
func (e *SysPost) GetPage(c *dto.SysPostPageReq, list *[]models.SysPost, count *int64) error {
var err error
var data models.SysPost
@@ -28,14 +28,14 @@ func (e *SysPost) GetSysPostPage(c *dto.SysPostSearch, list *[]models.SysPost, c
Find(list).Limit(-1).Offset(-1).
Count(count).Error
if err != nil {
e.Log.Errorf("db error:%s", err)
e.Log.Errorf("db error:%s \r", err)
return err
}
return nil
}
// GetSysPost 获取SysPost对象
func (e *SysPost) GetSysPost(d *dto.SysPostById, model *models.SysPost) error {
// Get 获取SysPost对象
func (e *SysPost) Get(d *dto.SysPostGetReq, model *models.SysPost) error {
var err error
var data models.SysPost
@@ -54,8 +54,8 @@ func (e *SysPost) GetSysPost(d *dto.SysPostById, model *models.SysPost) error {
return nil
}
// InsertSysPost 创建SysPost对象
func (e *SysPost) InsertSysPost(c *dto.SysPostControl) error {
// Insert 创建SysPost对象
func (e *SysPost) Insert(c *dto.SysPostInsertReq) error {
var err error
var data models.SysPost
c.Generate(&data)
@@ -67,8 +67,8 @@ func (e *SysPost) InsertSysPost(c *dto.SysPostControl) error {
return nil
}
// UpdateSysPost 修改SysPost对象
func (e *SysPost) UpdateSysPost(c *dto.SysPostControl) error {
// Update 修改SysPost对象
func (e *SysPost) Update(c *dto.SysPostUpdateReq) error {
var err error
var model = models.SysPost{}
e.Orm.First(&model, c.GetId())
@@ -86,8 +86,8 @@ func (e *SysPost) UpdateSysPost(c *dto.SysPostControl) error {
return nil
}
// RemoveSysPost 删除SysPost
func (e *SysPost) RemoveSysPost(d *dto.SysPostById) error {
// Remove 删除SysPost
func (e *SysPost) Remove(d *dto.SysPostDeleteReq) error {
var err error
var data models.SysPost
@@ -102,4 +102,4 @@ func (e *SysPost) RemoveSysPost(d *dto.SysPostById) error {
return err
}
return nil
}
}
+102 -52
View File
@@ -2,6 +2,8 @@ package service
import (
"errors"
"github.com/go-admin-team/go-admin-core/sdk/config"
"gorm.io/gorm/clause"
"github.com/casbin/casbin/v2"
@@ -19,7 +21,7 @@ type SysRole struct {
}
// GetPage 获取SysRole列表
func (e *SysRole) GetPage(c *dto.SysRoleSearch, list *[]models.SysRole, count *int64) error {
func (e *SysRole) GetPage(c *dto.SysRoleGetPageReq, list *[]models.SysRole, count *int64) error {
var err error
var data models.SysRole
@@ -38,7 +40,7 @@ func (e *SysRole) GetPage(c *dto.SysRoleSearch, list *[]models.SysRole, count *i
}
// Get 获取SysRole对象
func (e *SysRole) Get(d *dto.SysRoleById, model *models.SysRole) error {
func (e *SysRole) Get(d *dto.SysRoleGetReq, model *models.SysRole) error {
var err error
db := e.Orm.First(model, d.GetId())
err = db.Error
@@ -60,7 +62,7 @@ func (e *SysRole) Get(d *dto.SysRoleById, model *models.SysRole) error {
}
// Insert 创建SysRole对象
func (e *SysRole) Insert(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error {
func (e *SysRole) Insert(c *dto.SysRoleInsertReq, cb *casbin.SyncedEnforcer) error {
var err error
var data models.SysRole
var dataMenu []models.SysMenu
@@ -71,14 +73,29 @@ func (e *SysRole) Insert(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error
}
c.SysMenu = dataMenu
c.Generate(&data)
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
tx := e.Orm
if config.DatabaseConfig.Driver != "sqlite3" {
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
}
var count int64
err = tx.Model(&data).Where("role_key = ?", c.RoleKey).Count(&count).Error
if err != nil {
e.Log.Errorf("db error:%s", err)
return err
}
if count > 0 {
err = errors.New("roleKey已存在,需更换在提交!")
e.Log.Errorf("db error:%s", err)
return err
}
err = tx.Create(&data).Error
if err != nil {
@@ -86,12 +103,21 @@ func (e *SysRole) Insert(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error
return err
}
mp := make(map[string]interface{}, 0)
polices := make([][]string, 0)
for _, menu := range dataMenu {
for _, api := range menu.SysApi {
_, err = cb.AddNamedPolicy("p", data.RoleKey, api.Path, api.Action)
if mp[data.RoleKey+"-"+api.Path+"-"+api.Action] != "" {
mp[data.RoleKey+"-"+api.Path+"-"+api.Action] = ""
polices = append(polices, []string{data.RoleKey, api.Path, api.Action})
}
}
}
_ = cb.SavePolicy()
_, err = cb.AddNamedPolicies("p", polices)
if err != nil {
return err
}
//if len(c.MenuIds) > 0 {
// s := SysRoleMenu{}
// s.Orm = e.Orm
@@ -106,16 +132,19 @@ func (e *SysRole) Insert(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error
}
// Update 修改SysRole对象
func (e *SysRole) Update(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error {
func (e *SysRole) Update(c *dto.SysRoleUpdateReq, cb *casbin.SyncedEnforcer) error {
var err error
tx := e.Orm.Debug().Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
tx := e.Orm
if config.DatabaseConfig.Driver != "sqlite3" {
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
}
var model = models.SysRole{}
var mlist = make([]models.SysMenu, 0)
tx.Preload("SysMenu").First(&model, c.GetId())
@@ -142,27 +171,39 @@ func (e *SysRole) Update(c *dto.SysRoleControl, cb *casbin.SyncedEnforcer) error
e.Log.Errorf("delete policy error:%s", err)
return err
}
mp := make(map[string]interface{}, 0)
polices := make([][]string, 0)
for _, menu := range mlist {
for _, api := range menu.SysApi {
_, err = cb.AddNamedPolicy("p", model.RoleKey, api.Path, api.Action)
if mp[model.RoleKey+"-"+api.Path+"-"+api.Action] != "" {
mp[model.RoleKey+"-"+api.Path+"-"+api.Action] = ""
//_, err = cb.AddNamedPolicy("p", model.RoleKey, api.Path, api.Action)
polices = append(polices, []string{model.RoleKey, api.Path, api.Action})
}
}
}
_ = cb.SavePolicy()
_, err = cb.AddNamedPolicies("p", polices)
if err != nil {
return err
}
return nil
}
// Remove 删除SysRole
func (e *SysRole) Remove(c *dto.SysRoleById) error {
func (e *SysRole) Remove(c *dto.SysRoleDeleteReq, cb *casbin.SyncedEnforcer) error {
var err error
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
tx := e.Orm
if config.DatabaseConfig.Driver != "sqlite3" {
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
}
var model = models.SysRole{}
tx.Preload("SysMenu").Preload("SysDept").First(&model, c.GetId())
db := tx.Select(clause.Associations).Delete(&model)
@@ -174,6 +215,9 @@ func (e *SysRole) Remove(c *dto.SysRoleById) error {
if db.RowsAffected == 0 {
return errors.New("无权更新该数据")
}
_, _ = cb.RemoveFilteredPolicy(0, model.RoleKey)
return nil
}
@@ -194,18 +238,21 @@ func (e *SysRole) GetRoleMenuId(roleId int) ([]int, error) {
func (e *SysRole) UpdateDataScope(c *dto.RoleDataScopeReq) *SysRole {
var err error
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
tx := e.Orm
if config.DatabaseConfig.Driver != "sqlite3" {
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
}
var dlist = make([]models.SysDept, 0)
var model = models.SysRole{}
tx.Preload("SysDept").First(&model, c.RoleId)
tx.Where("id in ?", c.DeptIds).Find(&dlist)
tx.Where("dept_id in ?", c.DeptIds).Find(&dlist)
err = tx.Model(&model).Association("SysDept").Delete(model.SysDept)
if err != nil {
e.Log.Errorf("delete SysDept error:%s", err)
@@ -230,14 +277,17 @@ func (e *SysRole) UpdateDataScope(c *dto.RoleDataScopeReq) *SysRole {
// UpdateStatus 修改SysRole对象status
func (e *SysRole) UpdateStatus(c *dto.UpdateStatusReq) error {
var err error
tx := e.Orm.Debug().Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
tx := e.Orm
if config.DatabaseConfig.Driver != "sqlite3" {
tx := e.Orm.Begin()
defer func() {
if err != nil {
tx.Rollback()
} else {
tx.Commit()
}
}()
}
var model = models.SysRole{}
tx.First(&model, c.GetId())
c.Generate(&model)
@@ -290,4 +340,4 @@ func (e *SysRole) GetById(roleId int) ([]string, error) {
permissions = append(permissions, l[i].Permission)
}
return permissions, nil
}
}
+46 -17
View File
@@ -19,7 +19,7 @@ type SysUser struct {
}
// GetPage 获取SysUser列表
func (e *SysUser) GetPage(c *dto.SysUserSearch, p *actions.DataPermission, list *[]models.SysUser, count *int64) error {
func (e *SysUser) GetPage(c *dto.SysUserGetPageReq, p *actions.DataPermission, list *[]models.SysUser, count *int64) error {
var err error
var data models.SysUser
@@ -60,7 +60,7 @@ func (e *SysUser) Get(d *dto.SysUserById, p *actions.DataPermission, model *mode
}
// Insert 创建SysUser对象
func (e *SysUser) Insert(c *dto.SysUserControl) error {
func (e *SysUser) Insert(c *dto.SysUserInsertReq) error {
var err error
var data models.SysUser
var i int64
@@ -84,7 +84,7 @@ func (e *SysUser) Insert(c *dto.SysUserControl) error {
}
// Update 修改SysUser对象
func (e *SysUser) Update(c *dto.SysUserControl, p *actions.DataPermission) error {
func (e *SysUser) Update(c *dto.SysUserUpdateReq, p *actions.DataPermission) error {
var err error
var model models.SysUser
db := e.Orm.Scopes(
@@ -99,16 +99,21 @@ func (e *SysUser) Update(c *dto.SysUserControl, p *actions.DataPermission) error
}
c.Generate(&model)
err = e.Orm.Save(&model).Error
if err != nil {
e.Log.Errorf("Service UpdateSysUser error: %s", err)
update := e.Orm.Model(&model).Where("user_id = ?", &model.UserId).Omit("password", "salt").Updates(&model)
if err = update.Error; err != nil {
e.Log.Errorf("db error: %s", err)
return err
}
if update.RowsAffected == 0 {
err = errors.New("update userinfo error")
log.Warnf("db update error")
return err
}
return nil
}
// UpdateSysUserStatus 更新用户状态
func (e *SysUser) UpdateSysUserStatus(c *dto.UpdateSysUserStatusReq, p *actions.DataPermission) error {
// UpdateAvatar 更新用户头像
func (e *SysUser) UpdateAvatar(c *dto.UpdateSysUserAvatarReq, p *actions.DataPermission) error {
var err error
var model models.SysUser
db := e.Orm.Scopes(
@@ -122,8 +127,7 @@ func (e *SysUser) UpdateSysUserStatus(c *dto.UpdateSysUserStatusReq, p *actions.
return errors.New("无权更新该数据")
}
c.Generate(&model)
err = e.Orm.Save(&model).Error
err = e.Orm.Table(model.TableName()).Where("user_id =? ", c.UserId).Updates(c).Error
if err != nil {
e.Log.Errorf("Service UpdateSysUser error: %s", err)
return err
@@ -131,8 +135,31 @@ func (e *SysUser) UpdateSysUserStatus(c *dto.UpdateSysUserStatusReq, p *actions.
return nil
}
// ResetSysUserPwd 重置用户密码
func (e *SysUser) ResetSysUserPwd(c *dto.ResetSysUserPwdReq, p *actions.DataPermission) error {
// UpdateStatus 更新用户状态
func (e *SysUser) UpdateStatus(c *dto.UpdateSysUserStatusReq, p *actions.DataPermission) error {
var err error
var model models.SysUser
db := e.Orm.Scopes(
actions.Permission(model.TableName(), p),
).First(&model, c.GetId())
if err = db.Error; err != nil {
e.Log.Errorf("Service UpdateSysUser error: %s", err)
return err
}
if db.RowsAffected == 0 {
return errors.New("无权更新该数据")
}
err = e.Orm.Table(model.TableName()).Where("user_id =? ", c.UserId).Updates(c).Error
if err != nil {
e.Log.Errorf("Service UpdateSysUser error: %s", err)
return err
}
return nil
}
// ResetPwd 重置用户密码
func (e *SysUser) ResetPwd(c *dto.ResetSysUserPwdReq, p *actions.DataPermission) error {
var err error
var model models.SysUser
db := e.Orm.Scopes(
@@ -146,7 +173,7 @@ func (e *SysUser) ResetSysUserPwd(c *dto.ResetSysUserPwdReq, p *actions.DataPerm
return errors.New("无权更新该数据")
}
c.Generate(&model)
err = e.Orm.Save(&model).Error
err = e.Orm.Omit("username", "nick_name", "phone", "role_id", "avatar", "sex").Save(&model).Error
if err != nil {
e.Log.Errorf("At Service ResetSysUserPwd error: %s", err)
return err
@@ -173,8 +200,8 @@ func (e *SysUser) Remove(c *dto.SysUserById, p *actions.DataPermission) error {
return nil
}
// UpdateSysUserPwd 修改SysUser对象密码
func (e *SysUser) UpdateSysUserPwd(id int, oldPassword, newPassword string, p *actions.DataPermission) error {
// UpdatePwd 修改SysUser对象密码
func (e *SysUser) UpdatePwd(id int, oldPassword, newPassword string, p *actions.DataPermission) error {
var err error
if newPassword == "" {
@@ -206,7 +233,9 @@ func (e *SysUser) UpdateSysUserPwd(id int, oldPassword, newPassword string, p *a
return err
}
c.Password = newPassword
db := e.Orm.Model(c).Where("user_id = ?", id).Select("Password", "Salt").Updates(c)
db := e.Orm.Model(c).Where("user_id = ?", id).
Select("Password", "Salt").
Updates(c)
if err = db.Error; err != nil {
e.Log.Errorf("db error: %s", err)
return err
@@ -219,7 +248,7 @@ func (e *SysUser) UpdateSysUserPwd(id int, oldPassword, newPassword string, p *a
return nil
}
func (e *SysUser) GetSysUserProfile(c *dto.SysUserById, user *models.SysUser, roles *[]models.SysRole, posts *[]models.SysPost) error {
func (e *SysUser) GetProfile(c *dto.SysUserById, user *models.SysUser, roles *[]models.SysRole, posts *[]models.SysPost) error {
err := e.Orm.Preload("Dept").First(user, c.GetId()).Error
if err != nil {
return err
+2 -2
View File
@@ -33,7 +33,7 @@ func (e SysJob) RemoveJobForService(c *gin.Context) {
err = s.RemoveJob(&v)
if err != nil {
e.Logger.Errorf("RemoveJob error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "")
e.Error(500, err, "")
return
}
e.OK(nil, s.Msg)
@@ -62,7 +62,7 @@ func (e SysJob) StartJobForService(c *gin.Context) {
err = s.StartJob(&v)
if err != nil {
log.Errorf("GetCrontabKey error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "")
e.Error(500, err, err.Error())
return
}
e.OK(nil, s.Msg)
+7
View File
@@ -1,6 +1,7 @@
package service
import (
"errors"
"time"
"github.com/go-admin-team/go-admin-core/sdk/service"
@@ -52,6 +53,12 @@ func (e *SysJob) StartJob(c *dto.GeneralGetDto) error {
e.Log.Errorf("db error: %s", err)
return err
}
if data.Status == 1 {
err = errors.New("当前Job是关闭状态不能被启动,请先启用。")
return err
}
if data.JobType == 1 {
var j = &jobs.HttpJob{}
j.InvokeTarget = data.InvokeTarget
+1
View File
@@ -40,6 +40,7 @@ type File struct {
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/public/uploadFile [post]
// @Security Bearer
func (e File) UploadFile(c *gin.Context) {
e.MakeContext(c)
tag, _ := c.GetPostForm("type")
+135 -24
View File
@@ -1,15 +1,22 @@
package apis
import (
"fmt"
"github.com/shirou/gopsutil/v3/net"
"regexp"
"runtime"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/host"
"github.com/shirou/gopsutil/v3/mem"
)
const (
@@ -19,19 +26,52 @@ const (
GB = 1024 * MB
)
var (
Version string
expectDiskFsTypes = []string{
"apfs", "ext4", "ext3", "ext2", "f2fs", "reiserfs", "jfs", "btrfs",
"fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs", "fuse.rclone",
}
excludeNetInterfaces = []string{
"lo", "tun", "docker", "veth", "br-", "vmbr", "vnet", "kube",
}
getMacDiskNo = regexp.MustCompile(`\/dev\/disk(\d)s.*`)
)
var (
netInSpeed, netOutSpeed, netInTransfer, netOutTransfer, lastUpdateNetStats uint64
cachedBootTime time.Time
)
type ServerMonitor struct {
api.Api
}
// GetHourDiffer 获取相差时间
func GetHourDiffer(startTime, endTime string) int64 {
var hour int64
t1, err := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
t2, err := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
if err == nil && t1.Before(t2) {
diff := t2.Unix() - t1.Unix() //
hour = diff / 3600
return hour
} else {
return hour
}
}
// ServerInfo 获取系统信息
// @Summary 系统信息
// @Description 获取JSON
// @Tags 系统信息
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/server-monitor [get]
// @Security Bearer
func (e ServerMonitor) ServerInfo(c *gin.Context) {
e.Context = c
sysInfo, err := host.Info()
osDic := make(map[string]interface{}, 0)
osDic["goOs"] = runtime.GOOS
osDic["arch"] = runtime.GOARCH
@@ -41,36 +81,107 @@ func (e ServerMonitor) ServerInfo(c *gin.Context) {
osDic["numGoroutine"] = runtime.NumGoroutine()
osDic["ip"] = pkg.GetLocaHonst()
osDic["projectDir"] = pkg.GetCurrentPath()
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
osDic["hostName"] = sysInfo.Hostname
osDic["time"] = time.Now().Format("2006-01-02 15:04:05")
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
memDic["used"] = mem.Used / MB
memDic["total"] = mem.Total / MB
fmt.Println("mem", int(mem.Total/mem.Used*100))
memDic["percent"] = pkg.Round(mem.UsedPercent, 2)
swapDic := make(map[string]interface{}, 0)
swapDic["used"] = mem.SwapTotal - mem.SwapFree
swapDic["total"] = mem.SwapTotal
cpuDic := make(map[string]interface{}, 0)
cpuDic["cpuInfo"], _ = cpu.Info()
percent, _ := cpu.Percent(0, false)
cpuDic["Percent"] = pkg.Round(percent[0], 2)
cpuDic["percent"] = pkg.Round(percent[0], 2)
cpuDic["cpuNum"], _ = cpu.Counts(false)
//服务器磁盘信息
disklist := make([]disk.UsageStat, 0)
//所有分区
var diskTotal, diskUsed, diskUsedPercent float64
diskInfo, err := disk.Partitions(true)
if err == nil {
for _, p := range diskInfo {
diskDetail, err := disk.Usage(p.Mountpoint)
if err == nil {
diskDetail.UsedPercent, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", diskDetail.UsedPercent), 64)
diskDetail.Total = diskDetail.Total / 1024 / 1024
diskDetail.Used = diskDetail.Used / 1024 / 1024
diskDetail.Free = diskDetail.Free / 1024 / 1024
disklist = append(disklist, *diskDetail)
}
}
}
d, _ := disk.Usage("/")
diskTotal = float64(d.Total / GB)
diskUsed = float64(d.Used / GB)
diskUsedPercent, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", d.UsedPercent), 64)
diskDic := make(map[string]interface{}, 0)
diskDic["total"] = diskTotal
diskDic["used"] = diskUsed
diskDic["percent"] = diskUsedPercent
bootTime, _ := host.BootTime()
cachedBootTime = time.Unix(int64(bootTime), 0)
TrackNetworkSpeed()
netDic := make(map[string]interface{}, 0)
netDic["in"] = pkg.Round(float64(netInSpeed/KB), 2)
netDic["out"] = pkg.Round(float64(netOutSpeed/KB), 2)
e.Custom(gin.H{
"code": 200,
"os": osDic,
"mem": memDic,
"cpu": cpuDic,
"disk": diskDic,
"code": 200,
"os": osDic,
"mem": memDic,
"cpu": cpuDic,
"disk": diskDic,
"net": netDic,
"swap": swapDic,
"location": "Aliyun",
"bootTime": GetHourDiffer(cachedBootTime.Format("2006-01-02 15:04:05"), time.Now().Format("2006-01-02 15:04:05")),
})
}
func TrackNetworkSpeed() {
var innerNetInTransfer, innerNetOutTransfer uint64
nc, err := net.IOCounters(true)
if err == nil {
for _, v := range nc {
if isListContainsStr(excludeNetInterfaces, v.Name) {
continue
}
innerNetInTransfer += v.BytesRecv
innerNetOutTransfer += v.BytesSent
}
now := uint64(time.Now().Unix())
diff := now - lastUpdateNetStats
if diff > 0 {
netInSpeed = (innerNetInTransfer - netInTransfer) / diff
fmt.Println("netInSpeed", netInSpeed)
netOutSpeed = (innerNetOutTransfer - netOutTransfer) / diff
fmt.Println("netOutSpeed", netOutSpeed)
}
netInTransfer = innerNetInTransfer
netOutTransfer = innerNetOutTransfer
lastUpdateNetStats = now
}
}
func isListContainsStr(list []string, str string) bool {
for i := 0; i < len(list); i++ {
if strings.Contains(str, list[i]) {
return true
}
}
return false
}
@@ -1,19 +1,17 @@
package tools
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/tools"
"go-admin/app/other/models/tools"
)
// GetDBColumnList 分页列表数据
// @Summary 分页列表数据 / page list data
// @Description 数据库表列分页列表 / database table column page list
// @Tags 工具 / Tools
// @Tags 工具 / 生成工具
// @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码"
@@ -38,7 +36,7 @@ func (e *Gen) GetDBColumnList(c *gin.Context) {
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -2,20 +2,18 @@ package tools
import (
"errors"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/config"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/tools"
"go-admin/app/other/models/tools"
)
// GetDBTableList 分页列表数据
// @Summary 分页列表数据 / page list data
// @Description 数据库表分页列表 / database table page list
// @Tags 工具 / Tools
// @Tags 工具 / 生成工具
// @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码"
@@ -47,7 +45,7 @@ func (e *Gen) GetDBTableList(c *gin.Context) {
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -2,9 +2,9 @@ package tools
import (
"bytes"
"fmt"
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
"net/http"
"strconv"
"strings"
"text/template"
@@ -15,7 +15,7 @@ import (
"github.com/go-admin-team/go-admin-core/sdk/config"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"go-admin/app/admin/models/tools"
"go-admin/app/other/models/tools"
)
type Gen struct {
@@ -29,61 +29,61 @@ func (e Gen) Preview(c *gin.Context) {
id, err := pkg.StringToInt(c.Param("tableId"))
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("tableId接收失败!错误详情:%s", err.Error()))
return
}
table.TableId = id
t1, err := template.ParseFiles("template/v4/model.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("model模版读取失败!错误详情:%s", err.Error()))
return
}
t2, err := template.ParseFiles("template/v4/no_actions/apis.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("api模版读取失败!错误详情:%s", err.Error()))
return
}
t3, err := template.ParseFiles("template/v4/js.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("js模版读取失败!错误详情:%s", err.Error()))
return
}
t4, err := template.ParseFiles("template/v4/vue.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("vue模版读取失败!错误详情:%s", err.Error()))
return
}
t5, err := template.ParseFiles("template/v4/no_actions/router_check_role.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("路由模版读取失败!错误详情:%s", err.Error()))
return
}
t6, err := template.ParseFiles("template/v4/dto.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("dto模版读取失败!错误详情:%s", err.Error()))
return
}
t7, err := template.ParseFiles("template/v4/no_actions/service.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("service模版读取失败!错误详情:%s", err.Error()))
return
}
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, fmt.Sprintf("数据库链接获取失败!错误详情:%s", err.Error()))
return
}
tab, _ := table.Get(db)
tab, _ := table.Get(db,false)
var b1 bytes.Buffer
err = t1.Execute(&b1, tab)
var b2 bytes.Buffer
@@ -117,25 +117,21 @@ func (e Gen) GenCode(c *gin.Context) {
id, err := pkg.StringToInt(c.Param("tableId"))
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("tableId参数接收失败!错误详情:%s", err.Error()))
return
}
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, fmt.Sprintf("数据库链接获取失败!错误详情:%s", err.Error()))
return
}
table.TableId = id
tab, _ := table.Get(db)
tab, _ := table.Get(db,false)
if tab.IsActions == 1 {
e.ActionsGen(c, tab)
} else {
e.NOActionsGen(c, tab)
}
e.NOActionsGen(c, tab)
e.OK("", "Code generated successfully!")
}
@@ -147,19 +143,19 @@ func (e Gen) GenApiToFile(c *gin.Context) {
id, err := pkg.StringToInt(c.Param("tableId"))
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("tableId参数获取失败!错误详情:%s", err.Error()))
return
}
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, fmt.Sprintf("数据库链接获取失败!错误详情:%s", err.Error()))
return
}
table.TableId = id
tab, _ := table.Get(db)
tab, _ := table.Get(db,false)
e.genApiToFile(c, tab)
e.OK("", "Code generated successfully!")
@@ -168,6 +164,7 @@ func (e Gen) GenApiToFile(c *gin.Context) {
func (e Gen) NOActionsGen(c *gin.Context, tab tools.SysTables) {
e.Context = c
log := e.GetLogger()
tab.MLTBName = strings.Replace(tab.TBName, "_", "-", -1)
basePath := "template/v4/"
routerFile := basePath + "no_actions/router_check_role.go.template"
@@ -179,43 +176,43 @@ func (e Gen) NOActionsGen(c *gin.Context, tab tools.SysTables) {
t1, err := template.ParseFiles(basePath + "model.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("model模版读取失败!错误详情:%s", err.Error()))
return
}
t2, err := template.ParseFiles(basePath + "no_actions/apis.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("api模版读取失败!错误详情:%s", err.Error()))
return
}
t3, err := template.ParseFiles(routerFile)
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("路由模版失败!错误详情:%s", err.Error()))
return
}
t4, err := template.ParseFiles(basePath + "js.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("js模版解析失败!错误详情:%s", err.Error()))
return
}
t5, err := template.ParseFiles(basePath + "vue.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("vue模版解析失败!错误详情:%s", err.Error()))
return
}
t6, err := template.ParseFiles(basePath + "dto.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("dto模版解析失败失败!错误详情:%s", err.Error()))
return
}
t7, err := template.ParseFiles(basePath + "no_actions/service.go.template")
if err != nil {
log.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("service模版失败!错误详情:%s", err.Error()))
return
}
@@ -223,8 +220,13 @@ func (e Gen) NOActionsGen(c *gin.Context, tab tools.SysTables) {
_ = pkg.PathCreate("./app/" + tab.PackageName + "/models/")
_ = pkg.PathCreate("./app/" + tab.PackageName + "/router/")
_ = pkg.PathCreate("./app/" + tab.PackageName + "/service/dto/")
_ = pkg.PathCreate(config.GenConfig.FrontPath + "/api/")
_ = pkg.PathCreate(config.GenConfig.FrontPath + "/views/" + tab.ModuleFrontName)
_ = pkg.PathCreate(config.GenConfig.FrontPath + "/api/" + tab.PackageName + "/")
err = pkg.PathCreate(config.GenConfig.FrontPath + "/views/" + tab.PackageName + "/" + tab.MLTBName + "/")
if err != nil {
log.Error(err)
e.Error(500, err, fmt.Sprintf("views目录创建失败!错误详情:%s", err.Error()))
return
}
var b1 bytes.Buffer
err = t1.Execute(&b1, tab)
@@ -240,13 +242,13 @@ func (e Gen) NOActionsGen(c *gin.Context, tab tools.SysTables) {
err = t6.Execute(&b6, tab)
var b7 bytes.Buffer
err = t7.Execute(&b7, tab)
pkg.FileCreate(b1, "./app/"+tab.PackageName+"/models/"+tab.ModuleName+".go")
pkg.FileCreate(b2, "./app/"+tab.PackageName+"/apis/"+tab.ModuleName+".go")
pkg.FileCreate(b3, "./app/"+tab.PackageName+"/router/"+tab.ModuleName+".go")
pkg.FileCreate(b4, config.GenConfig.FrontPath+"/api/"+tab.ModuleFrontName+".js")
pkg.FileCreate(b5, config.GenConfig.FrontPath+"/views/"+tab.ModuleFrontName+"/index.vue")
pkg.FileCreate(b6, "./app/"+tab.PackageName+"/service/dto/"+tab.ModuleName+".go")
pkg.FileCreate(b7, "./app/"+tab.PackageName+"/service/"+tab.ModuleName+".go")
pkg.FileCreate(b1, "./app/"+tab.PackageName+"/models/"+tab.TBName+".go")
pkg.FileCreate(b2, "./app/"+tab.PackageName+"/apis/"+tab.TBName+".go")
pkg.FileCreate(b3, "./app/"+tab.PackageName+"/router/"+tab.TBName+".go")
pkg.FileCreate(b4, config.GenConfig.FrontPath+"/api/"+tab.PackageName+"/"+tab.MLTBName+".js")
pkg.FileCreate(b5, config.GenConfig.FrontPath+"/views/"+tab.PackageName+"/"+tab.MLTBName+"/index.vue")
pkg.FileCreate(b6, "./app/"+tab.PackageName+"/service/dto/"+tab.TBName+".go")
pkg.FileCreate(b7, "./app/"+tab.PackageName+"/service/"+tab.TBName+".go")
}
@@ -265,7 +267,7 @@ func (e Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
t1, err := template.ParseFiles(basePath + "api_migrate.template")
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
e.Error(500, err, fmt.Sprintf("数据迁移模版解析失败!错误详情:%s", err.Error()))
return
}
i := strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
@@ -279,80 +281,8 @@ func (e Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
}
func (e Gen) ActionsGen(c *gin.Context, tab tools.SysTables) {
err := e.MakeContext(c).
MakeOrm().
Errors
if err != nil {
e.Logger.Error(err)
e.Error(500, err, err.Error())
return
}
basePath := "template/v4/"
routerFile := basePath + "actions/router_check_role.go.template"
if tab.IsAuth == 2 {
routerFile = basePath + "actions/router_no_check_role.go.template"
}
t1, err := template.ParseFiles(basePath + "model.go.template")
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
t3, err := template.ParseFiles(routerFile)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
t4, err := template.ParseFiles(basePath + "js.go.template")
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
t5, err := template.ParseFiles(basePath + "vue.go.template")
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
t6, err := template.ParseFiles(basePath + "dto.go.template")
if err != nil {
e.Logger.Error(err)
e.Error(500, err, "")
return
}
_ = pkg.PathCreate("./app/" + tab.PackageName + "/models/")
_ = pkg.PathCreate("./app/" + tab.PackageName + "/router/")
_ = pkg.PathCreate("./app/" + tab.PackageName + "/service/dto/")
_ = pkg.PathCreate(config.GenConfig.FrontPath + "/api/")
_ = pkg.PathCreate(config.GenConfig.FrontPath + "/views/" + tab.ModuleFrontName)
var b1 bytes.Buffer
err = t1.Execute(&b1, 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)
var b6 bytes.Buffer
err = t6.Execute(&b6, tab)
pkg.FileCreate(b1, "./app/"+tab.PackageName+"/models/"+tab.ModuleName+".go")
pkg.FileCreate(b3, "./app/"+tab.PackageName+"/router/"+tab.ModuleName+".go")
pkg.FileCreate(b4, config.GenConfig.FrontPath+"/api/"+tab.ModuleFrontName+".js")
pkg.FileCreate(b5, config.GenConfig.FrontPath+"/views/"+tab.ModuleFrontName+"/index.vue")
pkg.FileCreate(b6, "./app/"+tab.PackageName+"/service/dto/"+tab.ModuleName+".go")
}
func (e Gen) GenMenuAndApi(c *gin.Context) {
s:=service.SysMenu{}
s := service.SysMenu{}
err := e.MakeContext(c).
MakeOrm().
MakeService(&s.Service).
@@ -365,16 +295,20 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
table := tools.SysTables{}
id, err := pkg.StringToInt(c.Param("tableId"))
pkg.HasError(err, "", -1)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, fmt.Sprintf("tableId参数解析失败!错误详情:%s", err.Error()))
return
}
table.TableId = id
tab, _ := table.Get(e.Orm)
tab, _ := table.Get(e.Orm,true)
tab.MLTBName = strings.Replace(tab.TBName, "_", "-", -1)
Mmenu := dto.SysMenuControl{}
Mmenu := dto.SysMenuInsertReq{}
Mmenu.Title = tab.TableComment
Mmenu.Icon = "pass"
Mmenu.Path = "/" + strings.Replace(tab.TBName, "_", "-", -1)
Mmenu.Path = "/" + tab.MLTBName
Mmenu.MenuType = "M"
Mmenu.Action = "无"
Mmenu.ParentId = 0
@@ -386,17 +320,17 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
Mmenu.CreateBy = 1
s.Insert(&Mmenu)
Cmenu := dto.SysMenuControl{}
Cmenu := dto.SysMenuInsertReq{}
Cmenu.MenuName = tab.ClassName + "Manage"
Cmenu.Title = tab.TableComment
Cmenu.Icon = "pass"
Cmenu.Path = tab.TBName
Cmenu.Path = "/" + tab.PackageName + "/" + tab.MLTBName
Cmenu.MenuType = "C"
Cmenu.Action = "无"
Cmenu.Permission = tab.PackageName + ":" + tab.ModuleFrontName + ":list"
Cmenu.Permission = tab.PackageName + ":" + tab.BusinessName + ":list"
Cmenu.ParentId = Mmenu.MenuId
Cmenu.NoCache = false
Cmenu.Component = "/" + tab.ModuleFrontName + "/index"
Cmenu.Component = "/" + tab.PackageName + "/" + tab.MLTBName + "/index"
Cmenu.Sort = 0
Cmenu.Visible = "0"
Cmenu.IsFrame = "0"
@@ -404,14 +338,14 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
Cmenu.UpdateBy = 1
s.Insert(&Cmenu)
MList := dto.SysMenuControl{}
MList := dto.SysMenuInsertReq{}
MList.MenuName = ""
MList.Title = "分页获取" + tab.TableComment
MList.Icon = ""
MList.Path = tab.TBName
MList.MenuType = "F"
MList.Action = "无"
MList.Permission = tab.PackageName + ":" + tab.ModuleFrontName + ":query"
MList.Permission = tab.PackageName + ":" + tab.BusinessName + ":query"
MList.ParentId = Cmenu.MenuId
MList.NoCache = false
MList.Sort = 0
@@ -421,14 +355,14 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
MList.UpdateBy = 1
s.Insert(&MList)
MCreate := dto.SysMenuControl{}
MCreate := dto.SysMenuInsertReq{}
MCreate.MenuName = ""
MCreate.Title = "创建" + tab.TableComment
MCreate.Icon = ""
MCreate.Path = tab.TBName
MCreate.MenuType = "F"
MCreate.Action = "无"
MCreate.Permission = tab.PackageName + ":" + tab.ModuleFrontName + ":add"
MCreate.Permission = tab.PackageName + ":" + tab.BusinessName + ":add"
MCreate.ParentId = Cmenu.MenuId
MCreate.NoCache = false
MCreate.Sort = 0
@@ -438,14 +372,14 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
MCreate.UpdateBy = 1
s.Insert(&MCreate)
MUpdate := dto.SysMenuControl{}
MUpdate := dto.SysMenuInsertReq{}
MUpdate.MenuName = ""
MUpdate.Title = "修改" + tab.TableComment
MUpdate.Icon = ""
MUpdate.Path = tab.TBName
MUpdate.MenuType = "F"
MUpdate.Action = "无"
MUpdate.Permission = tab.PackageName + ":" + tab.ModuleFrontName + ":edit"
MUpdate.Permission = tab.PackageName + ":" + tab.BusinessName + ":edit"
MUpdate.ParentId = Cmenu.MenuId
MUpdate.NoCache = false
MUpdate.Sort = 0
@@ -455,14 +389,14 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
MUpdate.UpdateBy = 1
s.Insert(&MUpdate)
MDelete := dto.SysMenuControl{}
MDelete := dto.SysMenuInsertReq{}
MDelete.MenuName = ""
MDelete.Title = "删除" + tab.TableComment
MDelete.Icon = ""
MDelete.Path = tab.TBName
MDelete.MenuType = "F"
MDelete.Action = "无"
MDelete.Permission = tab.PackageName + ":" + tab.ModuleFrontName + ":remove"
MDelete.Permission = tab.PackageName + ":" + tab.BusinessName + ":remove"
MDelete.ParentId = Cmenu.MenuId
MDelete.NoCache = false
MDelete.Sort = 0
@@ -472,6 +406,5 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
MDelete.UpdateBy = 1
s.Insert(&MDelete)
e.OK("", "数据生成成功!")
}
@@ -1,7 +1,6 @@
package tools
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
@@ -10,23 +9,23 @@ import (
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"gorm.io/gorm"
"go-admin/app/admin/models/tools"
"go-admin/app/other/models/tools"
)
type SysTable struct {
api.Api
}
// GetSysTableList 分页列表数据
// GetPage 分页列表数据
// @Summary 分页列表数据
// @Description 生成表分页列表
// @Tags 工具 - 生成表
// @Tags 工具 / 生成工具
// @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/page [get]
func (e SysTable) GetSysTableList(c *gin.Context) {
func (e SysTable) GetPage(c *gin.Context) {
e.Context = c
log := e.GetLogger()
var data tools.SysTables
@@ -45,7 +44,7 @@ func (e SysTable) GetSysTableList(c *gin.Context) {
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -60,26 +59,27 @@ func (e SysTable) GetSysTableList(c *gin.Context) {
e.PageOK(result, count, pageIndex, pageSize, "查询成功")
}
// Get
// @Summary 获取配置
// @Description 获取JSON
// @Tags 工具 - 生成表
// @Tags 工具 / 生成工具
// @Param configKey path int true "configKey"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/info/{tableId} [get]
// @Security Bearer
func (e SysTable) GetSysTables(c *gin.Context) {
func (e SysTable) Get(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
var data tools.SysTables
data.TableId, _ = pkg.StringToInt(c.Param("tableId"))
result, err := data.Get(db)
result, err := data.Get(db,true)
if err != nil {
log.Errorf("Get error, %s", err.Error())
e.Error(500, err, "")
@@ -98,7 +98,7 @@ func (e SysTable) GetSysTablesInfo(c *gin.Context) {
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -106,7 +106,7 @@ func (e SysTable) GetSysTablesInfo(c *gin.Context) {
if c.Request.FormValue("tableName") != "" {
data.TBName = c.Request.FormValue("tableName")
}
result, err := data.Get(db)
result, err := data.Get(db,true)
if err != nil {
log.Errorf("Get error, %s", err.Error())
e.Error(500, err, "抱歉未找到相关信息")
@@ -127,7 +127,7 @@ func (e SysTable) GetSysTablesTree(c *gin.Context) {
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -142,9 +142,10 @@ func (e SysTable) GetSysTablesTree(c *gin.Context) {
e.OK(result, "")
}
// Insert
// @Summary 添加表结构
// @Description 添加表结构
// @Tags 工具 - 生成表
// @Tags 工具 / 生成工具
// @Accept application/json
// @Product application/json
// @Param tables query string false "tableName / 数据表名称"
@@ -152,13 +153,13 @@ func (e SysTable) GetSysTablesTree(c *gin.Context) {
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/sys/tables/info [post]
// @Security Bearer
func (e SysTable) InsertSysTable(c *gin.Context) {
func (e SysTable) Insert(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -201,15 +202,23 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
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
// 小驼峰表名 js函数名和权限标识使用
if i == 0 {
data.BusinessName += strings.ToLower(strStart) + strend
} else {
data.BusinessName += strings.ToUpper(strStart) + strend
}
//data.PackageName += strings.ToLower(strStart) + strings.ToLower(strend)
data.ModuleName += strings.ToLower(strStart) + strings.ToLower(strend)
//data.ModuleName += strings.ToLower(strStart) + strings.ToLower(strend)
}
data.ModuleFrontName = strings.ReplaceAll(data.ModuleName, "_", "-")
//data.ModuleFrontName = strings.ReplaceAll(data.ModuleName, "_", "-")
data.PackageName = "admin"
data.TplCategory = "crud"
data.Crud = true
// 中横线表名称,接口路径、前端文件夹名称和js名称使用
data.ModuleName = strings.Replace(data.TBName, "_", "-", -1)
dbcolumn, err := dbColumn.GetList(tx)
data.CreateBy = 0
data.TableComment = dbtable.TableComment
@@ -218,11 +227,11 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
}
data.FunctionName = data.TableComment
data.BusinessName = data.ModuleName
//data.BusinessName = data.ModuleName
data.IsLogicalDelete = "1"
data.LogicalDelete = true
data.LogicalDeleteColumn = "is_del"
data.IsActions = 1
data.IsActions = 2
data.IsDataScope = 1
data.IsAuth = 1
@@ -287,9 +296,10 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
return data, err
}
// Update
// @Summary 修改表结构
// @Description 修改表结构
// @Tags 工具 - 生成表
// @Tags 工具 / 生成工具
// @Accept application/json
// @Product application/json
// @Param data body tools.SysTables true "body"
@@ -297,7 +307,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/sys/tables/info [put]
// @Security Bearer
func (e SysTable) UpdateSysTable(c *gin.Context) {
func (e SysTable) Update(c *gin.Context) {
var data tools.SysTables
err := c.Bind(&data)
pkg.HasError(err, "数据解析失败", 500)
@@ -307,7 +317,7 @@ func (e SysTable) UpdateSysTable(c *gin.Context) {
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -321,20 +331,21 @@ func (e SysTable) UpdateSysTable(c *gin.Context) {
e.OK(result, "修改成功")
}
// Delete
// @Summary 删除表结构
// @Description 删除表结构
// @Tags 工具 - 生成表
// @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 (e SysTable) DeleteSysTables(c *gin.Context) {
func (e SysTable) Delete(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
if err != nil {
log.Errorf("get db connection error, %s", err.Error())
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return
}
@@ -51,12 +51,20 @@ func (SysColumns) TableName() string {
return "sys_columns"
}
func (e *SysColumns) GetList(tx *gorm.DB) ([]SysColumns, error) {
func (e *SysColumns) GetList(tx *gorm.DB, exclude bool) ([]SysColumns, error) {
var doc []SysColumns
table := tx.Table("sys_columns")
table = table.Where("table_id = ?", e.TableId)
table = table.Where("table_id = ? ", e.TableId)
if exclude {
notIn := make([]string, 0, 6)
notIn = append(notIn, "id")
notIn = append(notIn, "create_by")
notIn = append(notIn, "update_by")
notIn = append(notIn, "created_at")
notIn = append(notIn, "updated_at")
notIn = append(notIn, "deleted_at")
table = table.Where(" column_name not in(?)", notIn)
}
if err := table.Find(&doc).Error; err != nil {
return nil, err
@@ -12,6 +12,7 @@ import (
type SysTables struct {
TableId int `gorm:"primaryKey;autoIncrement" json:"tableId"` //表编码
TBName string `gorm:"column:table_name;size:255;" json:"tableName"` //表名称
MLTBName string `gorm:"-" json:"-"` //表名称
TableComment string `gorm:"size:255;" json:"tableComment"` //表备注
ClassName string `gorm:"size:255;" json:"className"` //类名
TplCategory string `gorm:"size:255;" json:"tplCategory"` //
@@ -77,7 +78,7 @@ func (e *SysTables) GetPage(tx *gorm.DB, pageSize int, pageIndex int) ([]SysTabl
return doc, int(count), nil
}
func (e *SysTables) Get(tx *gorm.DB) (SysTables, error) {
func (e *SysTables) Get(tx *gorm.DB, exclude bool) (SysTables, error) {
var doc SysTables
var err error
table := tx.Table("sys_tables")
@@ -97,7 +98,7 @@ func (e *SysTables) Get(tx *gorm.DB) (SysTables, error) {
}
var col SysColumns
col.TableId = doc.TableId
if doc.Columns, err = col.GetList(tx); err != nil {
if doc.Columns, err = col.GetList(tx, exclude); err != nil {
return doc, err
}
@@ -126,7 +127,7 @@ func (e *SysTables) GetTree(tx *gorm.DB) ([]SysTables, error) {
var col SysColumns
//col.FkCol = append(col.FkCol, SysColumns{ColumnId: 0, ColumnName: "请选择"})
col.TableId = doc[i].TableId
if doc[i].Columns, err = col.GetList(tx); err != nil {
if doc[i].Columns, err = col.GetList(tx, false); err != nil {
return doc, err
}
@@ -188,16 +189,17 @@ func (e *SysTables) Update(tx *gorm.DB) (update SysTables, err error) {
t, ok := tableMap[e.Columns[i].FkTableName]
if ok {
e.Columns[i].FkTableNameClass = t.ClassName
e.Columns[i].FkTableNamePackage = t.ModuleName
t.MLTBName = strings.Replace(t.TBName, "_", "-", -1)
e.Columns[i].FkTableNamePackage = t.MLTBName
} else {
tableNameList := strings.Split(e.Columns[i].FkTableName, "_")
e.Columns[i].FkTableNameClass = ""
e.Columns[i].FkTableNamePackage = ""
//e.Columns[i].FkTableNamePackage = ""
for a := 0; a < len(tableNameList); a++ {
strStart := string([]byte(tableNameList[a])[:1])
strEnd := string([]byte(tableNameList[a])[1:])
e.Columns[i].FkTableNameClass += strings.ToUpper(strStart) + strEnd
e.Columns[i].FkTableNamePackage += strings.ToLower(strStart) + strings.ToLower(strEnd)
//e.Columns[i].FkTableNamePackage += strings.ToLower(strStart) + strings.ToLower(strEnd)
}
}
}
+7 -3
View File
@@ -2,15 +2,19 @@ package router
import (
"github.com/gin-gonic/gin"
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
"go-admin/app/other/apis"
)
func init() {
routerNoCheckRole = append(routerNoCheckRole, registerFileRouter)
routerCheckRole = append(routerCheckRole, registerFileRouter)
}
// 需认证的路由代码
func registerFileRouter(v1 *gin.RouterGroup) {
func registerFileRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
var api = apis.File{}
v1.POST("/public/uploadFile", api.UploadFile)
r := v1.Group("").Use(authMiddleware.MiddlewareFunc())
{
r.POST("/public/uploadFile", api.UploadFile)
}
}
@@ -4,7 +4,7 @@ import (
"github.com/gin-gonic/gin"
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
"go-admin/app/admin/apis"
"go-admin/app/admin/apis/tools"
"go-admin/app/other/apis/tools"
)
func init() {
@@ -15,7 +15,7 @@ func sysNoCheckRoleRouter(v1 *gin.RouterGroup ,authMiddleware *jwt.GinJWTMiddlew
r1 := v1.Group("")
{
sys := apis.System{}
r1.GET("/getCaptcha", sys.GenerateCaptchaHandler)
r1.GET("/captcha", sys.GenerateCaptchaHandler)
}
r := v1.Group("").Use(authMiddleware.MiddlewareFunc())
@@ -43,13 +43,13 @@ func registerSysTableRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl
tables := v1.Group("/sys/tables")
{
sysTable := tools.SysTable{}
tables.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/page", sysTable.GetSysTableList)
tables.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/page", sysTable.GetPage)
tablesInfo := tables.Group("/info").Use(authMiddleware.MiddlewareFunc())
{
tablesInfo.POST("", sysTable.InsertSysTable)
tablesInfo.PUT("", sysTable.UpdateSysTable)
tablesInfo.DELETE("/:tableId", sysTable.DeleteSysTables)
tablesInfo.GET("/:tableId", sysTable.GetSysTables)
tablesInfo.POST("", sysTable.Insert)
tablesInfo.PUT("", sysTable.Update)
tablesInfo.DELETE("/:tableId", sysTable.Delete)
tablesInfo.GET("/:tableId", sysTable.Get)
tablesInfo.GET("", sysTable.GetSysTablesInfo)
}
}
+90
View File
@@ -0,0 +1,90 @@
package app
import (
"bytes"
"errors"
"fmt"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"github.com/go-admin-team/go-admin-core/sdk/pkg/utils"
"github.com/spf13/cobra"
"text/template"
)
var (
appName string
StartCmd = &cobra.Command{
Use: "createapp",
Short: "Create a new app",
Long: "Use when you need to create a new app",
Example: "go-admin createapp -n admin",
Run: func(cmd *cobra.Command, args []string) {
run()
},
}
)
func init() {
StartCmd.PersistentFlags().StringVarP(&appName, "name", "n", "", "Start server with provided configuration file")
}
func run() {
fmt.Println(`start init`)
//1. 读取配置
fmt.Println(`generate migration file`)
_ = genFile()
}
func genFile() error {
if appName == "" {
return errors.New("arg `name` invalid :name is empty")
}
path := "app/"
appPath := path + appName
err := utils.IsNotExistMkDir(appPath)
if err != nil {
return err
}
apiPath := appPath + "/apis/"
err = utils.IsNotExistMkDir(apiPath)
if err != nil {
return err
}
modelsPath := appPath + "/models/"
err = utils.IsNotExistMkDir(modelsPath)
if err != nil {
return err
}
routerPath := appPath + "/router/"
err = utils.IsNotExistMkDir(routerPath)
if err != nil {
return err
}
servicePath := appPath + "/service/"
err = utils.IsNotExistMkDir(servicePath)
if err != nil {
return err
}
dtoPath := appPath + "/service/dto/"
err = utils.IsNotExistMkDir(dtoPath)
if err != nil {
return err
}
t1, err := template.ParseFiles("template/cmd_api.template")
if err != nil {
return err
}
m := map[string]string{}
m["appName"] = appName
var b1 bytes.Buffer
err = t1.Execute(&b1, m)
pkg.FileCreate(b1, "./cmd/api/"+appName+".go")
t2, err := template.ParseFiles("template/router.template")
var b2 bytes.Buffer
err = t2.Execute(&b2, nil)
pkg.FileCreate(b2, appPath+"/router/router.go")
return nil
}
+2
View File
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"go-admin/cmd/app"
"go-admin/common/global"
"os"
@@ -45,6 +46,7 @@ func init() {
rootCmd.AddCommand(migrate.StartCmd)
rootCmd.AddCommand(version.StartCmd)
rootCmd.AddCommand(config.StartCmd)
rootCmd.AddCommand(app.StartCmd)
}
//Execute : apply commands
+10 -12
View File
@@ -4,20 +4,18 @@ import (
"log"
"path/filepath"
"sort"
"strconv"
"sync"
"github.com/spf13/cast"
"gorm.io/gorm"
)
var Migrate = &Migration{
version: make(map[int]func(db *gorm.DB, version string) error),
version: make(map[string]func(db *gorm.DB, version string) error),
}
type Migration struct {
db *gorm.DB
version map[int]func(db *gorm.DB, version string) error
version map[string]func(db *gorm.DB, version string) error
mutex sync.Mutex
}
@@ -29,24 +27,24 @@ func (e *Migration) SetDb(db *gorm.DB) {
e.db = db
}
func (e *Migration) SetVersion(k int, f func(db *gorm.DB, version string) error) {
func (e *Migration) SetVersion(k string, f func(db *gorm.DB, version string) error) {
e.mutex.Lock()
defer e.mutex.Unlock()
e.version[k] = f
}
func (e *Migration) Migrate() {
versions := make([]int, 0)
versions := make([]string, 0)
for k := range e.version {
versions = append(versions, k)
}
if !sort.IntsAreSorted(versions) {
sort.Ints(versions)
if !sort.StringsAreSorted(versions) {
sort.Strings(versions)
}
var err error
var count int64
for _, v := range versions {
err = e.db.Debug().Table("sys_migration").Where("version = ?", v).Count(&count).Error
err = e.db.Table("sys_migration").Where("version = ?", v).Count(&count).Error
if err != nil {
log.Fatalln(err)
}
@@ -55,14 +53,14 @@ func (e *Migration) Migrate() {
count = 0
continue
}
err = (e.version[v])(e.db.Debug(), strconv.Itoa(v))
err = (e.version[v])(e.db.Debug(), v)
if err != nil {
log.Fatalln(err)
}
}
}
func GetFilename(s string) int {
func GetFilename(s string) string {
s = filepath.Base(s)
return cast.ToInt(s[:13])
return s[:13]
}
+16 -3
View File
@@ -3,18 +3,31 @@ package models
import (
"fmt"
"go-admin/common/global"
"gorm.io/gorm"
"io/ioutil"
"log"
"strings"
"gorm.io/gorm"
)
func InitDb(db *gorm.DB) (err error) {
filePath := "config/db.sql"
err = ExecSql(db, filePath)
if global.Driver == "postgres" {
filePath = "config/pg.sql"
err = ExecSql(db, filePath)
} else if global.Driver == "mysql" {
filePath = "config/db-begin-mysql.sql"
if err = ExecSql(db, filePath); err != nil {
return err
}
filePath = "config/db.sql"
if err = ExecSql(db, filePath); err != nil {
return err
}
filePath = "config/db-end-mysql.sql"
err = ExecSql(db, filePath)
} else {
err = ExecSql(db, filePath)
}
return err
}
@@ -31,7 +44,7 @@ func ExecSql(db *gorm.DB, filePath string) error {
fmt.Println(sqlList[i])
continue
}
sql := strings.Replace(sqlList[i]+";", "\n", "", 0)
sql := strings.Replace(sqlList[i]+";", "\n", "", -1)
sql = strings.TrimSpace(sql)
if err = db.Exec(sql).Error; err != nil {
log.Printf("error sql: %s", sql)
+4 -4
View File
@@ -11,13 +11,13 @@ type SysUser struct {
Password string `json:"-" gorm:"type:varchar(128);comment:密码"`
NickName string `json:"nickName" gorm:"type:varchar(128);comment:昵称"`
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机号"`
RoleId int `json:"roleId" gorm:"type:bigint(20);comment:角色ID"`
RoleId int `json:"roleId" gorm:"type:bigint;comment:角色ID"`
Salt string `json:"-" gorm:"type:varchar(255);comment:加盐"`
Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"`
Sex string `json:"sex" gorm:"type:varchar(255);comment:性别"`
Email string `json:"email" gorm:"type:varchar(128);comment:邮箱"`
DeptId int `json:"deptId" gorm:"type:bigint(20);comment:部门"`
PostId int `json:"postId" gorm:"type:bigint(20);comment:岗位"`
DeptId int `json:"deptId" gorm:"type:bigint;comment:部门"`
PostId int `json:"postId" gorm:"type:bigint;comment:岗位"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
Status string `json:"status" gorm:"type:varchar(4);comment:状态"`
ControlBy
@@ -45,4 +45,4 @@ func (e *SysUser) Encrypt() (err error) {
func (e *SysUser) BeforeCreate(_ *gorm.DB) error {
return e.Encrypt()
}
}
+12
View File
@@ -0,0 +1,12 @@
package models
type TbDemo struct {
Model
Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
ModelTime
ControlBy
}
func (TbDemo) TableName() string {
return "tb_demo"
}
@@ -3,11 +3,11 @@ package version
import (
"runtime"
"gorm.io/gorm"
"go-admin/cmd/migrate/migration"
"go-admin/cmd/migrate/migration/models"
common "go-admin/common/models"
"gorm.io/gorm"
)
func init() {
@@ -35,15 +35,16 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
new(models.SysJob),
new(models.SysConfig),
new(models.SysApi),
new(models.TbDemo),
)
if err != nil {
return err
}
if err := models.InitDb(tx); err != nil {
return err
}
return db.Create(&common.Migration{
return tx.Create(&common.Migration{
Version: version,
}).Error
})
}
}
+2 -2
View File
@@ -33,14 +33,14 @@ func CreateAction(control dto.Control) gin.HandlerFunc {
var object models.ActiveRecord
object, err = req.GenerateM()
if err != nil {
response.Error(c, http.StatusInternalServerError, err, "模型生成失败")
response.Error(c, 500, err, "模型生成失败")
return
}
object.SetCreateBy(user.GetUserId(c))
err = db.WithContext(c).Create(object).Error
if err != nil {
log.Errorf("Create error: %s", err)
response.Error(c, http.StatusInternalServerError, err, "创建失败")
response.Error(c, 500, err, "创建失败")
return
}
response.OK(c, object.GetId(), "创建成功")
+2 -2
View File
@@ -34,7 +34,7 @@ func DeleteAction(control dto.Control) gin.HandlerFunc {
var object models.ActiveRecord
object, err = req.GenerateM()
if err != nil {
response.Error(c, http.StatusInternalServerError, err, "模型生成失败")
response.Error(c, 500, err, "模型生成失败")
return
}
@@ -48,7 +48,7 @@ func DeleteAction(control dto.Control) gin.HandlerFunc {
).Where(req.GetId()).Delete(object)
if db.Error != nil {
log.Errorf("MsgID[%s] Delete error: %s", msgID, err)
response.Error(c, http.StatusInternalServerError, err, "删除失败")
response.Error(c, 500, err, "删除失败")
return
}
if db.RowsAffected == 0 {
+1 -1
View File
@@ -49,7 +49,7 @@ func IndexAction(m models.ActiveRecord, d dto.Index, f func() interface{}) gin.H
Count(&count).Error
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
log.Errorf("MsgID[%s] Index error: %s", msgID, err)
response.Error(c, http.StatusInternalServerError, err, "查询失败")
response.Error(c, 500, err, "查询失败")
return
}
response.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
+1 -2
View File
@@ -2,7 +2,6 @@ package actions
import (
"errors"
"net/http"
"github.com/gin-gonic/gin"
log "github.com/go-admin-team/go-admin-core/logger"
@@ -34,7 +33,7 @@ func PermissionAction() gin.HandlerFunc {
p, err = newDataPermission(db, userId)
if err != nil {
log.Errorf("MsgID[%s] PermissionAction error: %s", msgID, err)
response.Error(c, http.StatusInternalServerError, err, "权限范围鉴定错误")
response.Error(c, 500, err, "权限范围鉴定错误")
c.Abort()
return
}
+2 -2
View File
@@ -33,7 +33,7 @@ func UpdateAction(control dto.Control) gin.HandlerFunc {
var object models.ActiveRecord
object, err = req.GenerateM()
if err != nil {
response.Error(c, http.StatusInternalServerError, err, "模型生成失败")
response.Error(c, 500, err, "模型生成失败")
return
}
object.SetUpdateBy(user.GetUserId(c))
@@ -46,7 +46,7 @@ func UpdateAction(control dto.Control) gin.HandlerFunc {
).Where(req.GetId()).Updates(object)
if db.Error != nil {
log.Errorf("MsgID[%s] Update error: %s", msgID, err)
response.Error(c, http.StatusInternalServerError, err, "更新失败")
response.Error(c, 500, err, "更新失败")
return
}
if db.RowsAffected == 0 {
+2 -2
View File
@@ -34,7 +34,7 @@ func ViewAction(control dto.Control, f func() interface{}) gin.HandlerFunc {
var object models.ActiveRecord
object, err = req.GenerateM()
if err != nil {
response.Error(c, http.StatusInternalServerError, err, "模型生成失败")
response.Error(c, 500, err, "模型生成失败")
return
}
@@ -58,7 +58,7 @@ func ViewAction(control dto.Control, f func() interface{}) gin.HandlerFunc {
}
if err != nil {
log.Errorf("MsgID[%s] View error: %s", msgID, err)
response.Error(c, http.StatusInternalServerError, err, "查看失败")
response.Error(c, 500, err, "查看失败")
return
}
response.OK(c, rsp, "查询成功")
+3 -4
View File
@@ -3,7 +3,6 @@ package apis
import (
"errors"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
@@ -85,7 +84,7 @@ func (e *Api) Bind(d interface{}, bindings ...binding.Binding) *Api {
func (e Api) GetOrm() (*gorm.DB, error) {
db, err := pkg.GetOrm(e.Context)
if err != nil {
e.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Error(500, err, "数据库连接获取失败")
return nil, err
}
return db, nil
@@ -96,13 +95,13 @@ func (e *Api) MakeOrm() *Api {
var err error
if e.Logger == nil {
err = errors.New("at MakeOrm logger is nil")
//e.Logger.Error(http.StatusInternalServerError, err, "at MakeOrm logger is nil")
//e.Logger.Error(500, err, "at MakeOrm logger is nil")
e.AddError(err)
return e
}
db, err := pkg.GetOrm(e.Context)
if err != nil {
e.Logger.Error(http.StatusInternalServerError, err, "数据库连接获取失败")
e.Logger.Error(500, err, "数据库连接获取失败")
e.AddError(err)
}
e.Orm = db
+5 -2
View File
@@ -1,3 +1,4 @@
//go:build !sqlite3
// +build !sqlite3
package database
@@ -5,10 +6,12 @@ package database
import (
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/driver/sqlserver"
"gorm.io/gorm"
)
var opens = map[string]func(string) gorm.Dialector{
"mysql": mysql.Open,
"postgres": postgres.Open,
"mysql": mysql.Open,
"postgres": postgres.Open,
"sqlserver": sqlserver.Open,
}
+6 -3
View File
@@ -1,3 +1,4 @@
//go:build sqlite3
// +build sqlite3
package database
@@ -6,11 +7,13 @@ import (
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/driver/sqlite"
"gorm.io/driver/sqlserver"
"gorm.io/gorm"
)
var opens = map[string]func(string) gorm.Dialector{
"mysql": mysql.Open,
"postgres": postgres.Open,
"sqlite3": sqlite.Open,
"mysql": mysql.Open,
"postgres": postgres.Open,
"sqlite3": sqlite.Open,
"sqlserver": sqlserver.Open,
}
+53
View File
@@ -51,3 +51,56 @@ func (s *ObjectById) GetId() interface{} {
}
return s.Id
}
type ObjectGetReq struct {
Id int `uri:"id"`
}
func (s *ObjectGetReq) Bind(ctx *gin.Context) error {
var err error
log := api.GetRequestLogger(ctx)
err = ctx.ShouldBindUri(s)
if err != nil {
log.Warnf("ShouldBindUri error: %s", err.Error())
return err
}
if err = vd.Validate(s); err != nil {
log.Errorf("Validate error: %s", err.Error())
return err
}
return err
}
func (s *ObjectGetReq) GetId() interface{} {
return s.Id
}
type ObjectDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *ObjectDeleteReq) Bind(ctx *gin.Context) error {
var err error
log := api.GetRequestLogger(ctx)
err = ctx.ShouldBind(&s)
if err != nil {
log.Warnf("ShouldBind error: %s", err.Error())
return err
}
if len(s.Ids) > 0 {
return nil
}
if s.Ids == nil {
s.Ids = make([]int, 0)
}
if err = vd.Validate(s); err != nil {
log.Errorf("Validate error: %s", err.Error())
return err
}
return err
}
func (s *ObjectDeleteReq) GetId() interface{} {
return s.Ids
}
+40 -8
View File
@@ -1,13 +1,45 @@
package file_store
type FileStore struct {
import "fmt"
type OXS struct {
// Endpoint 访问域名
Endpoint string
// AccessKeyID AK
AccessKeyID string
// AccessKeySecret AKS
AccessKeySecret string
// BucketName 桶名称
BucketName string
}
// Setup 配置数据库
func (e *FileStore) Setup(driver string) {
//fileStoreType := driver
//if fileStoreType == "ALiYunOSS" {
// var store = new(ALiYunOSS)
// store.Setup()
//}
// Setup 配置文件存储driver
func (e *OXS) Setup(driver DriverType, options ...ClientOption) FileStoreType {
fileStoreType := driver
var fileStore FileStoreType
switch fileStoreType {
case AliYunOSS:
fileStore = new(ALiYunOSS)
err := fileStore.Setup(e.Endpoint, e.AccessKeyID, e.AccessKeySecret, e.BucketName)
if err != nil {
fmt.Println(err)
}
return fileStore
case HuaweiOBS:
fileStore = new(HuaWeiOBS)
err := fileStore.Setup(e.Endpoint, e.AccessKeyID, e.AccessKeySecret, e.BucketName)
if err != nil {
fmt.Println(err)
}
return fileStore
case QiNiuKodo:
fileStore = new(QiNiuKODO)
err := fileStore.Setup(e.Endpoint, e.AccessKeyID, e.AccessKeySecret, e.BucketName)
if err != nil {
fmt.Println(err)
}
return fileStore
}
return nil
}
+23 -2
View File
@@ -1,6 +1,27 @@
package file_store
// DriverType 驱动类型
type DriverType string
const (
// HuaweiOBS 华为云OBS
HuaweiOBS DriverType = "HuaweiOBS"
// AliYunOSS 阿里云OSS
AliYunOSS DriverType = "AliYunOSS"
// QiNiuKodo 七牛云kodo
QiNiuKodo DriverType = "QiNiuKodo"
)
type ClientOption map[string]interface{}
// TODO: FileStoreType名称待定
// FileStoreType OXS
type FileStoreType interface {
Setup() error
UpLoad(yourObjectName string, localFile string) error
// Setup 装载 endpoint sss
Setup(endpoint, accessKeyID, accessKeySecret, BucketName string, options ...ClientOption) error
// UpLoad 上传
UpLoad(yourObjectName string, localFile interface{}) error
// GetTempToken 获取临时Token
GetTempToken() (string, error)
}
+111
View File
@@ -0,0 +1,111 @@
package file_store
import (
"context"
"fmt"
"github.com/qiniu/go-sdk/v7/auth/qbox"
"github.com/qiniu/go-sdk/v7/storage"
)
type Zone string
const (
// HuaDong 华东
HuaDong Zone = "HuaDong"
// HuaBei 华北
HuaBei Zone = "HuaBei"
// HuaNan 华南
HuaNan Zone = "HuaNan"
// BeiMei 北美
BeiMei Zone = "BeiMei"
// XinJiaPo 新加坡
XinJiaPo Zone = "XinJiaPo"
)
type QiNiuKODO struct {
Client interface{}
BucketName string
cfg storage.Config
options []ClientOption
}
func (e *QiNiuKODO) getToken() string {
putPolicy := storage.PutPolicy{
Scope: e.BucketName,
}
if len(e.options) > 0 && e.options[0]["Expires"] != nil {
putPolicy.Expires = e.options[0]["Expires"].(uint64)
}
upToken := putPolicy.UploadToken(e.Client.(*qbox.Mac))
return upToken
}
//Setup 装载
//endpoint sss
func (e *QiNiuKODO) Setup(endpoint, accessKeyID, accessKeySecret, BucketName string, options ...ClientOption) error {
mac := qbox.NewMac(accessKeyID, accessKeySecret)
// 获取存储空间。
cfg := storage.Config{}
// 空间对应的机房
e.setZoneORDefault(cfg, options...)
// 是否使用https域名
cfg.UseHTTPS = true
// 上传是否使用CDN上传加速
cfg.UseCdnDomains = false
e.Client = mac
e.BucketName = BucketName
e.cfg = cfg
e.options = options
return nil
}
// setZoneORDefault 设置Zone或者默认华东
func (e *QiNiuKODO) setZoneORDefault(cfg storage.Config, options ...ClientOption) {
if len(options) > 0 && options[0]["Zone"] != nil {
if _, ok := options[0]["Zone"].(Zone); !ok {
cfg.Zone = &storage.ZoneHuadong
}
switch options[0]["Zone"].(Zone) {
case HuaDong:
cfg.Zone = &storage.ZoneHuadong
case HuaBei:
cfg.Zone = &storage.ZoneHuabei
case HuaNan:
cfg.Zone = &storage.ZoneHuanan
case BeiMei:
cfg.Zone = &storage.ZoneBeimei
case XinJiaPo:
cfg.Zone = &storage.ZoneXinjiapo
default:
cfg.Zone = &storage.ZoneHuadong
}
}
}
// UpLoad 文件上传
func (e *QiNiuKODO) UpLoad(yourObjectName string, localFile interface{}) error {
// 构建表单上传的对象
formUploader := storage.NewFormUploader(&e.cfg)
ret := storage.PutRet{}
// 可选配置
putExtra := storage.PutExtra{
Params: map[string]string{
"x:name": "github logo",
},
}
err := formUploader.PutFile(context.Background(), &ret, e.getToken(), yourObjectName, localFile.(string), &putExtra)
if err != nil {
fmt.Println(err)
return err
}
fmt.Println(ret.Key, ret.Hash)
return nil
}
func (e *QiNiuKODO) GetTempToken() (string, error) {
token := e.getToken()
return token, nil
}
+23
View File
@@ -0,0 +1,23 @@
package file_store
import (
"testing"
)
func TestKODOUpload(t *testing.T) {
e := OXS{"", "", "", ""}
var oxs = e.Setup(QiNiuKodo, map[string]interface{}{"Zone": "华东"})
err := oxs.UpLoad("test.png", "./test.png")
if err != nil {
t.Error(err)
}
t.Log("ok")
}
func TestKODOGetTempToken(t *testing.T) {
e := OXS{"", "", "", ""}
var oxs = e.Setup(QiNiuKodo, map[string]interface{}{"Zone": "华东"})
token, _ := oxs.GetTempToken()
t.Log(token)
t.Log("ok")
}
+52
View File
@@ -0,0 +1,52 @@
package file_store
import (
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go-obs/obs"
"log"
)
type HuaWeiOBS struct {
Client interface{}
BucketName string
}
func (e *HuaWeiOBS) Setup(endpoint, accessKeyID, accessKeySecret, BucketName string, options ...ClientOption) error {
// 创建ObsClient结构体
client, err := obs.New(accessKeyID, accessKeySecret, endpoint)
if err != nil {
log.Println("Error:", err)
return err
}
e.Client = client
e.BucketName = BucketName
return nil
}
// UpLoad 文件上传
// yourObjectName 文件路径名称,与objectKey是同一概念,表示断点续传上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg
func (e *HuaWeiOBS) UpLoad(yourObjectName string, localFile interface{}) error {
// 获取存储空间。
input := &obs.PutFileInput{}
input.Bucket = e.BucketName
input.Key = yourObjectName
input.SourceFile = localFile.(string)
output, err := e.Client.(*obs.ObsClient).PutFile(input)
if err == nil {
fmt.Printf("RequestId:%s\n", output.RequestId)
fmt.Printf("ETag:%s, StorageClass:%s\n", output.ETag, output.StorageClass)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
return nil
}
func (e *HuaWeiOBS) GetTempToken() (string, error) {
return "", nil
}
+15
View File
@@ -0,0 +1,15 @@
package file_store
import (
"testing"
)
func TestOBSUpload(t *testing.T) {
e := OXS{"", "", "", ""}
var oxs = e.Setup(HuaweiOBS)
err := oxs.UpLoad("test.png", "./test.png")
if err != nil {
t.Error(err)
}
t.Log("ok")
}
+14 -21
View File
@@ -6,50 +6,43 @@ import (
)
type ALiYunOSS struct {
Client interface{}
Endpoint string
AccessKeyId string
AccessKeySecret string
BucketName string
Client interface{}
BucketName string
}
func (e *ALiYunOSS) Setup() error {
// TODO: 如果需要使用阿里云OSS请在此处填写对应信息
e.AccessKeyId = ""
e.AccessKeySecret = ""
e.Endpoint = ""
e.BucketName = ""
client, err := oss.New(e.Endpoint, e.AccessKeyId, e.AccessKeySecret)
//Setup 装载
//endpoint sss
func (e *ALiYunOSS) Setup(endpoint, accessKeyID, accessKeySecret, BucketName string, options ...ClientOption) error {
client, err := oss.New(endpoint, accessKeyID, accessKeySecret)
if err != nil {
log.Println("Error:", err)
return err
}
e.Client = client
e.BucketName = BucketName
return nil
}
// UpLoad 文件上传
func (e *ALiYunOSS) UpLoad(yourObjectName string, localFile string) error {
err := e.Setup()
if err != nil {
log.Println("Error:", err)
return err
}
func (e *ALiYunOSS) UpLoad(yourObjectName string, localFile interface{}) error {
// 获取存储空间。
bucket, err := e.Client.(*oss.Client).Bucket(e.BucketName)
if err != nil {
log.Println("Error:", err)
return err
}
// 设置分片大小为100 KB,指定分片上传并发数为3,并开启断点续传上传。
// 其中<yourObjectName>与objectKey是同一概念,表示断点续传上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。
// "LocalFile"为filePath,100*1024为partSize。
err = bucket.UploadFile(yourObjectName, localFile, 100*1024, oss.Routines(3), oss.Checkpoint(true, ""))
err = bucket.UploadFile(yourObjectName, localFile.(string), 100*1024, oss.Routines(3), oss.Checkpoint(true, ""))
if err != nil {
log.Println("Error:", err)
return err
}
return nil
}
func (e *ALiYunOSS) GetTempToken() (string, error) {
return "", nil
}
+16
View File
@@ -0,0 +1,16 @@
package file_store
import (
"testing"
)
func TestOSSUpload(t *testing.T) {
// 打括号内填写自己的测试信息即可
e := OXS{}
var oxs = e.Setup(AliYunOSS)
err := oxs.UpLoad("test.png", "./test.png")
if err != nil {
t.Error(err)
}
t.Log("ok")
}
+1 -1
View File
@@ -2,7 +2,7 @@ package global
const (
// Version go-admin version info
Version = "2.0.0-beta.6"
Version = "2.1.0"
)
var (
+2 -4
View File
@@ -1,16 +1,15 @@
package common
import (
"fmt"
"github.com/gin-gonic/gin"
"strings"
)
func GetClientIP(c *gin.Context) string {
ClientIP := c.ClientIP()
fmt.Println("ClientIP:", ClientIP)
//fmt.Println("ClientIP:", ClientIP)
RemoteIP, _ := c.RemoteIP()
fmt.Println("RemoteIP:", RemoteIP)
//fmt.Println("RemoteIP:", RemoteIP)
ip := c.Request.Header.Get("X-Forwarded-For")
if strings.Contains(ip, "127.0.0.1") || ip == "" {
ip = c.Request.Header.Get("X-real-ip")
@@ -24,6 +23,5 @@ func GetClientIP(c *gin.Context) string {
if ClientIP != "127.0.0.1" {
ip = ClientIP
}
fmt.Println("ip:", ip)
return ip
}
+2 -2
View File
@@ -20,7 +20,7 @@ func AuthInit() (*jwt.GinJWTMiddleware, error) {
}
return jwt.New(&jwt.GinJWTMiddleware{
Realm: "test zone",
Key: []byte(config.ApplicationConfig.JwtSecret),
Key: []byte(config.JwtConfig.Secret),
Timeout: timeout,
MaxRefresh: time.Hour,
PayloadFunc: handler.PayloadFunc,
@@ -33,4 +33,4 @@ func AuthInit() (*jwt.GinJWTMiddleware, error) {
TimeFunc: time.Now,
})
}
}
+6 -2
View File
@@ -2,7 +2,6 @@ package middleware
import (
"fmt"
"go-admin/common"
"net/http"
"strconv"
"strings"
@@ -34,13 +33,18 @@ func CustomError(c *gin.Context) {
c.Request.URL,
statusCode,
c.Request.RequestURI,
common.GetClientIP(c),
c.ClientIP(),
p[2],
)
c.JSON(http.StatusOK, gin.H{
"code": statusCode,
"msg": p[2],
})
} else {
c.JSON(http.StatusOK, gin.H{
"code": 500,
"msg": "未知异常,请联系管理员!",
})
}
default:
panic(err)
+2 -1
View File
@@ -57,6 +57,7 @@ func IdentityHandler(c *gin.Context) interface{} {
// @Description Reply will be of the form {"token": "TOKEN"}.
// @Description dev mode:It should be noted that all fields cannot be empty, and a value of 0 can be passed in addition to the account password
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
// @Tags 登陆
// @Accept application/json
// @Product application/json
// @Param account body Login true "account"
@@ -67,7 +68,7 @@ func Authenticator(c *gin.Context) (interface{}, error) {
db, err := pkg.GetOrm(c)
if err != nil {
log.Errorf("get db error, %s", err.Error())
response.Error(c, http.StatusInternalServerError, err, "数据库连接获取失败")
response.Error(c, 500, err, "数据库连接获取失败")
return nil, jwt.ErrFailedAuthentication
}
+10 -9
View File
@@ -3,6 +3,7 @@ package middleware
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"go-admin/common"
gaConfig "go-admin/config"
@@ -56,16 +57,16 @@ func LoggerToFile() gin.HandlerFunc {
return
}
//rt, bl := c.Get("result")
rt, bl := c.Get("result")
var result = ""
//if bl {
// rb, err := json.Marshal(rt)
// if err != nil {
// log.Warnf("json Marshal result error, %s", err.Error())
// } else {
// result = string(rb)
// }
//}
if bl {
rb, err := json.Marshal(rt)
if err != nil {
log.Warnf("json Marshal result error, %s", err.Error())
} else {
result = string(rb)
}
}
st, bl := c.Get("status")
var statusBus = 0
+105
View File
@@ -0,0 +1,105 @@
package response
import (
"fmt"
"github.com/gin-gonic/gin/binding"
"reflect"
"strings"
"sync"
)
const (
_ uint8 = iota
json
xml
yaml
form
query
)
var constructor = &bindConstructor{}
type bindConstructor struct {
cache map[string][]uint8
mux sync.Mutex
}
func (e *bindConstructor) GetBindingForGin(d interface{}) []binding.Binding {
bs := e.getBinding(reflect.TypeOf(d).String())
if bs == nil {
//重新构建
bs = e.resolve(d)
}
gbs := make([]binding.Binding, len(bs))
for i, b := range bs {
switch b {
case json:
gbs[i] = binding.JSON
case xml:
gbs[i] = binding.XML
case yaml:
gbs[i] = binding.YAML
case form:
gbs[i] = binding.Form
case query:
gbs[i] = binding.Query
default:
gbs[i] = nil
}
}
return gbs
}
func (e *bindConstructor) resolve(d interface{}) []uint8 {
bs := make([]uint8, 0)
qType := reflect.TypeOf(d).Elem()
var tag reflect.StructTag
var ok bool
fmt.Println(qType.Kind())
for i := 0; i < qType.NumField(); i++ {
tag = qType.Field(i).Tag
if _, ok = tag.Lookup("json"); ok {
bs = append(bs, json)
}
if _, ok = tag.Lookup("xml"); ok {
bs = append(bs, xml)
}
if _, ok = tag.Lookup("yaml"); ok {
bs = append(bs, yaml)
}
if _, ok = tag.Lookup("form"); ok {
bs = append(bs, form)
}
if _, ok = tag.Lookup("query"); ok {
bs = append(bs, query)
}
if _, ok = tag.Lookup("uri"); ok {
bs = append(bs, 0)
}
if t, ok := tag.Lookup("binding"); ok && strings.Index(t, "dive") > -1 {
qValue := reflect.ValueOf(d)
bs = append(bs, e.resolve(qValue.Field(i))...)
continue
}
if t, ok := tag.Lookup("validate"); ok && strings.Index(t, "dive") > -1 {
qValue := reflect.ValueOf(d)
bs = append(bs, e.resolve(qValue.Field(i))...)
}
}
return bs
}
func (e *bindConstructor) getBinding(name string) []uint8 {
e.mux.Lock()
defer e.mux.Unlock()
return e.cache[name]
}
func (e *bindConstructor) setBinding(name string, bs []uint8) {
e.mux.Lock()
defer e.mux.Unlock()
if e.cache == nil {
e.cache = make(map[string][]uint8)
}
e.cache[name] = bs
}
+2
View File
@@ -0,0 +1,2 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
+1
View File
@@ -0,0 +1 @@
SET FOREIGN_KEY_CHECKS = 1;
+342
View File
@@ -0,0 +1,342 @@
-- 开始初始化数据 ;
SET IDENTITY_INSERT sys_api ON;
INSERT INTO sys_api (id, handle, title, path, type, "action", created_at, updated_at, deleted_at, create_by, update_by)VALUES
(5, 'go-admin/app/admin/apis.SysLoginLog.Get-fm', '登录日志通过id获取', '/api/v1/sys-login-log/:id', 'BUS', 'GET', '2021-05-13 19:59:00.728', '2021-06-17 11:37:12.331', NULL, 0, 0),
(6, 'go-admin/app/admin/apis.SysOperaLog.GetPage-fm', '操作日志列表', '/api/v1/sys-opera-log', 'BUS', 'GET', '2021-05-13 19:59:00.778', '2021-06-17 11:48:40.732', NULL, 0, 0),
(7, 'go-admin/app/admin/apis.SysOperaLog.Get-fm', '操作日志通过id获取', '/api/v1/sys-opera-log/:id', 'BUS', 'GET', '2021-05-13 19:59:00.821', '2021-06-16 21:49:48.598', NULL, 0, 0),
(8, 'go-admin/common/actions.IndexAction.func1', '分类列表', '/api/v1/syscategory', 'BUS', 'GET', '2021-05-13 19:59:00.870', '2021-06-13 20:53:47.883', NULL, 0, 0),
(9, 'go-admin/common/actions.ViewAction.func1', '分类通过id获取', '/api/v1/syscategory/:id', 'BUS', 'GET', '2021-05-13 19:59:00.945', '2021-06-13 20:53:47.926', NULL, 0, 0),
(10, 'go-admin/common/actions.IndexAction.func1', '内容列表', '/api/v1/syscontent', 'BUS', 'GET', '2021-05-13 19:59:01.005', '2021-06-13 20:53:47.966', NULL, 0, 0),
(11, 'go-admin/common/actions.ViewAction.func1', '内容通过id获取', '/api/v1/syscontent/:id', 'BUS', 'GET', '2021-05-13 19:59:01.056', '2021-06-13 20:53:48.005', NULL, 0, 0),
(15, 'go-admin/common/actions.IndexAction.func1', 'job列表', '/api/v1/sysjob', 'BUS', 'GET', '2021-05-13 19:59:01.248', '2021-06-13 20:53:48.169', NULL, 0, 0),
(16, 'go-admin/common/actions.ViewAction.func1', 'job通过id获取', '/api/v1/sysjob/:id', 'BUS', 'GET', '2021-05-13 19:59:01.298', '2021-06-13 20:53:48.214', NULL, 0, 0),
(21, 'go-admin/app/admin/apis.SysDictType.GetPage-fm', '字典类型列表', '/api/v1/dict/type', 'BUS', 'GET', '2021-05-13 19:59:01.525', '2021-06-17 11:48:40.732', NULL, 0, 0),
(22, 'go-admin/app/admin/apis.SysDictType.GetAll-fm', '字典类型查询【代码生成】', '/api/v1/dict/type-option-select', 'SYS', 'GET', '2021-05-13 19:59:01.582', '2021-06-13 20:53:48.388', NULL, 0, 0),
(23, 'go-admin/app/admin/apis.SysDictType.Get-fm', '字典类型通过id获取', '/api/v1/dict/type/:id', 'BUS', 'GET', '2021-05-13 19:59:01.632', '2021-06-17 11:48:40.732', NULL, 0, 0),
(24, 'go-admin/app/admin/apis.SysDictData.GetPage-fm', '字典数据列表', '/api/v1/dict/data', 'BUS', 'GET', '2021-05-13 19:59:01.684', '2021-06-17 11:48:40.732', NULL, 0, 0),
(25, 'go-admin/app/admin/apis.SysDictData.Get-fm', '字典数据通过code获取', '/api/v1/dict/data/:dictCode', 'BUS', 'GET', '2021-05-13 19:59:01.732', '2021-06-17 11:48:40.732', NULL, 0, 0),
(26, 'go-admin/app/admin/apis.SysDictData.GetSysDictDataAll-fm', '数据字典根据key获取', '/api/v1/dict-data/option-select', 'SYS', 'GET', '2021-05-13 19:59:01.832', '2021-06-17 11:48:40.732', NULL, 0, 0),
(27, 'go-admin/app/admin/apis.SysDept.GetPage-fm', '部门列表', '/api/v1/dept', 'BUS', 'GET', '2021-05-13 19:59:01.940', '2021-06-17 11:48:40.732', NULL, 0, 0),
(28, 'go-admin/app/admin/apis.SysDept.Get-fm', '部门通过id获取', '/api/v1/dept/:id', 'BUS', 'GET', '2021-05-13 19:59:02.009', '2021-06-17 11:48:40.732', NULL, 0, 0),
(29, 'go-admin/app/admin/apis.SysDept.Get2Tree-fm', '查询部门下拉树【角色权限-自定权限】', '/api/v1/deptTree', 'SYS', 'GET', '2021-05-13 19:59:02.050', '2021-06-17 11:48:40.732', NULL, 0, 0),
(30, 'go-admin/app/admin/apis/tools.(*Gen).GetDBTableList-fm', '数据库表列表', '/api/v1/db/tables/page', 'SYS', 'GET', '2021-05-13 19:59:02.098', '2021-06-13 20:53:48.730', NULL, 0, 0),
(31, 'go-admin/app/admin/apis/tools.(*Gen).GetDBColumnList-fm', '数据表列列表', '/api/v1/db/columns/page', 'SYS', 'GET', '2021-05-13 19:59:02.140', '2021-06-13 20:53:48.771', NULL, 0, 0),
(32, 'go-admin/app/admin/apis/tools.Gen.GenCode-fm', '数据库表生成到项目', '/api/v1/gen/toproject/:tableId', 'SYS', 'GET', '2021-05-13 19:59:02.183', '2021-06-13 20:53:48.812', NULL, 0, 0),
(33, 'go-admin/app/admin/apis/tools.Gen.GenMenuAndApi-fm', '数据库表生成到DB', '/api/v1/gen/todb/:tableId', 'SYS', 'GET', '2021-05-13 19:59:02.227', '2021-06-13 20:53:48.853', NULL, 0, 0),
(34, 'go-admin/app/admin/apis/tools.(*SysTable).GetSysTablesTree-fm', '关系表数据【代码生成】', '/api/v1/gen/tabletree', 'SYS', 'GET', '2021-05-13 19:59:02.271', '2021-06-13 20:53:48.893', NULL, 0, 0),
(35, 'go-admin/app/admin/apis/tools.Gen.Preview-fm', '生成预览通过id获取', '/api/v1/gen/preview/:tableId', 'SYS', 'GET', '2021-05-13 19:59:02.315', '2021-06-13 20:53:48.935', NULL, 0, 0),
(36, 'go-admin/app/admin/apis/tools.Gen.GenApiToFile-fm', '生成api带文件', '/api/v1/gen/apitofile/:tableId', 'SYS', 'GET', '2021-05-13 19:59:02.357', '2021-06-13 20:53:48.977', NULL, 0, 0),
(37, 'go-admin/app/admin/apis.System.GenerateCaptchaHandler-fm', '验证码获取', '/api/v1/getCaptcha', 'SYS', 'GET', '2021-05-13 19:59:02.405', '2021-06-13 20:53:49.020', NULL, 0, 0),
(38, 'go-admin/app/admin/apis.SysUser.GetInfo-fm', '用户信息获取', '/api/v1/getinfo', 'SYS', 'GET', '2021-05-13 19:59:02.447', '2021-06-13 20:53:49.065', NULL, 0, 0),
(39, 'go-admin/app/admin/apis.SysMenu.GetPage-fm', '菜单列表', '/api/v1/menu', 'BUS', 'GET', '2021-05-13 19:59:02.497', '2021-06-17 11:48:40.732', NULL, 0, 0),
(40, 'go-admin/app/admin/apis.SysMenu.GetMenuTreeSelect-fm', '查询菜单下拉树结构【废弃】', '/api/v1/menuTreeselect', 'SYS', 'GET', '2021-05-13 19:59:02.542', '2021-06-03 22:37:21.857', NULL, 0, 0),
(41, 'go-admin/app/admin/apis.SysMenu.Get-fm', '菜单通过id获取', '/api/v1/menu/:id', 'BUS', 'GET', '2021-05-13 19:59:02.584', '2021-06-17 11:48:40.732', NULL, 0, 0),
(42, 'go-admin/app/admin/apis.SysMenu.GetMenuRole-fm', '角色菜单【顶部左侧菜单】', '/api/v1/menurole', 'SYS', 'GET', '2021-05-13 19:59:02.630', '2021-06-13 20:53:49.574', NULL, 0, 0),
(43, 'go-admin/app/admin/apis.SysMenu.GetMenuIDS-fm', '获取角色对应的菜单id数组【废弃】', '/api/v1/menuids', 'SYS', 'GET', '2021-05-13 19:59:02.675', '2021-06-03 22:39:52.500', NULL, 0, 0),
(44, 'go-admin/app/admin/apis.SysRole.GetPage-fm', '角色列表', '/api/v1/role', 'BUS', 'GET', '2021-05-13 19:59:02.720', '2021-06-17 11:48:40.732', NULL, 0, 0),
(45, 'go-admin/app/admin/apis.SysMenu.GetMenuTreeSelect-fm', '菜单权限列表【角色配菜单使用】', '/api/v1/roleMenuTreeselect/:roleId', 'SYS', 'GET', '2021-05-13 19:59:02.762', '2021-06-17 11:48:40.732', NULL, 0, 0),
(46, 'go-admin/app/admin/apis.SysDept.GetDeptTreeRoleSelect-fm', '角色部门结构树【自定义数据权限】', '/api/v1/roleDeptTreeselect/:roleId', 'SYS', 'GET', '2021-05-13 19:59:02.809', '2021-06-17 11:48:40.732', NULL, 0, 0),
(47, 'go-admin/app/admin/apis.SysRole.Get-fm', '角色通过id获取', '/api/v1/role/:id', 'BUS', 'GET', '2021-05-13 19:59:02.850', '2021-06-17 11:48:40.732', NULL, 0, 0),
(48, 'github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth.(*GinJWTMiddleware).RefreshHandler-fm', '刷新token', '/api/v1/refresh_token', 'SYS', 'GET', '2021-05-13 19:59:02.892', '2021-06-13 20:53:49.278', NULL, 0, 0),
(53, 'go-admin/app/admin/apis.SysConfig.GetPage-fm', '参数列表', '/api/v1/config', 'BUS', 'GET', '2021-05-13 19:59:03.116', '2021-06-17 11:48:40.732', NULL, 0, 0),
(54, 'go-admin/app/admin/apis.SysConfig.Get-fm', '参数通过id获取', '/api/v1/config/:id', 'BUS', 'GET', '2021-05-13 19:59:03.157', '2021-06-17 11:48:40.732', NULL, 0, 0),
(55, 'go-admin/app/admin/apis.SysConfig.GetSysConfigByKEYForService-fm', '参数通过键名搜索【基础默认配置】', '/api/v1/configKey/:configKey', 'SYS', 'GET', '2021-05-13 19:59:03.198', '2021-06-13 20:53:49.745', NULL, 0, 0),
(57, 'go-admin/app/jobs/apis.SysJob.RemoveJobForService-fm', 'job移除', '/api/v1/job/remove/:id', 'BUS', 'GET', '2021-05-13 19:59:03.295', '2021-06-13 20:53:49.786', NULL, 0, 0),
(58, 'go-admin/app/jobs/apis.SysJob.StartJobForService-fm', 'job启动', '/api/v1/job/start/:id', 'BUS', 'GET', '2021-05-13 19:59:03.339', '2021-06-13 20:53:49.829', NULL, 0, 0),
(59, 'go-admin/app/admin/apis.SysPost.GetPage-fm', '岗位列表', '/api/v1/post', 'BUS', 'GET', '2021-05-13 19:59:03.381', '2021-06-17 11:48:40.732', NULL, 0, 0),
(60, 'go-admin/app/admin/apis.SysPost.Get-fm', '岗位通过id获取', '/api/v1/post/:id', 'BUS', 'GET', '2021-05-13 19:59:03.433', '2021-06-17 11:48:40.732', NULL, 0, 0),
(62, 'go-admin/app/admin/apis.SysConfig.GetSysConfigBySysApp-fm', '系统前端参数', '/api/v1/app-config', 'SYS', 'GET', '2021-05-13 19:59:03.526', '2021-06-13 20:53:49.994', NULL, 0, 0),
(63, 'go-admin/app/admin/apis.SysUser.GetProfile-fm', '*用户信息获取', '/api/v1/user/profile', 'SYS', 'GET', '2021-05-13 19:59:03.567', '2021-06-13 20:53:50.038', NULL, 0, 0),
(66, 'github.com/go-admin-team/go-admin-core/sdk/pkg/ws.(*Manager).WsClient-fm', '链接ws【定时任务log】', '/ws/:id/:channel', 'BUS', 'GET', '2021-05-13 19:59:03.705', '2021-06-13 20:53:50.167', NULL, 0, 0),
(67, 'github.com/go-admin-team/go-admin-core/sdk/pkg/ws.(*Manager).UnWsClient-fm', '退出ws【定时任务log】', '/wslogout/:id/:channel', 'BUS', 'GET', '2021-05-13 19:59:03.756', '2021-06-13 20:53:50.209', NULL, 0, 0),
(68, 'go-admin/common/middleware/handler.Ping', '*用户基本信息', '/info', 'SYS', 'GET', '2021-05-13 19:59:03.800', '2021-06-13 20:53:50.251', NULL, 0, 0),
(72, 'go-admin/common/actions.CreateAction.func1', '分类创建', '/api/v1/syscategory', 'BUS', 'POST', '2021-05-13 19:59:03.982', '2021-06-13 20:53:50.336', NULL, 0, 0),
(73, 'go-admin/common/actions.CreateAction.func1', '内容创建', '/api/v1/syscontent', 'BUS', 'POST', '2021-05-13 19:59:04.027', '2021-06-13 20:53:50.375', NULL, 0, 0),
(76, 'go-admin/common/actions.CreateAction.func1', 'job创建', '/api/v1/sysjob', 'BUS', 'POST', '2021-05-13 19:59:04.164', '2021-06-13 20:53:50.500', NULL, 0, 0),
(80, 'go-admin/app/admin/apis.SysDictData.Insert-fm', '字典数据创建', '/api/v1/dict/data', 'BUS', 'POST', '2021-05-13 19:59:04.347', '2021-06-17 11:48:40.732', NULL, 0, 0),
(81, 'go-admin/app/admin/apis.SysDictType.Insert-fm', '字典类型创建', '/api/v1/dict/type', 'BUS', 'POST', '2021-05-13 19:59:04.391', '2021-06-17 11:48:40.732', NULL, 0, 0),
(82, 'go-admin/app/admin/apis.SysDept.Insert-fm', '部门创建', '/api/v1/dept', 'BUS', 'POST', '2021-05-13 19:59:04.435', '2021-06-17 11:48:40.732', NULL, 0, 0),
(85, 'github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth.(*GinJWTMiddleware).LoginHandler-fm', '*登录', '/api/v1/login', 'SYS', 'POST', '2021-05-13 19:59:04.597', '2021-06-13 20:53:50.784', NULL, 0, 0),
(86, 'go-admin/common/middleware/handler.LogOut', '*退出', '/api/v1/logout', 'SYS', 'POST', '2021-05-13 19:59:04.642', '2021-06-13 20:53:50.824', NULL, 0, 0),
(87, 'go-admin/app/admin/apis.SysConfig.Insert-fm', '参数创建', '/api/v1/config', 'BUS', 'POST', '2021-05-13 19:59:04.685', '2021-06-17 11:48:40.732', NULL, 0, 0),
(88, 'go-admin/app/admin/apis.SysMenu.Insert-fm', '菜单创建', '/api/v1/menu', 'BUS', 'POST', '2021-05-13 19:59:04.777', '2021-06-17 11:48:40.732', NULL, 0, 0),
(89, 'go-admin/app/admin/apis.SysPost.Insert-fm', '岗位创建', '/api/v1/post', 'BUS', 'POST', '2021-05-13 19:59:04.886', '2021-06-17 11:48:40.732', NULL, 0, 0),
(90, 'go-admin/app/admin/apis.SysRole.Insert-fm', '角色创建', '/api/v1/role', 'BUS', 'POST', '2021-05-13 19:59:04.975', '2021-06-17 11:48:40.732', NULL, 0, 0),
(91, 'go-admin/app/admin/apis.SysUser.InsetAvatar-fm', '*用户头像编辑', '/api/v1/user/avatar', 'SYS', 'POST', '2021-05-13 19:59:05.058', '2021-06-13 20:53:51.079', NULL, 0, 0),
(92, 'go-admin/app/admin/apis.SysApi.Update-fm', '接口编辑', '/api/v1/sys-api/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.122', '2021-06-17 11:48:40.732', NULL, 0, 0),
(95, 'go-admin/common/actions.UpdateAction.func1', '分类编辑', '/api/v1/syscategory/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.255', '2021-06-13 20:53:51.247', NULL, 0, 0),
(96, 'go-admin/common/actions.UpdateAction.func1', '内容编辑', '/api/v1/syscontent/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.299', '2021-06-13 20:53:51.289', NULL, 0, 0),
(97, 'go-admin/common/actions.UpdateAction.func1', 'job编辑', '/api/v1/sysjob', 'BUS', 'PUT', '2021-05-13 19:59:05.343', '2021-06-13 20:53:51.331', NULL, 0, 0),
(101, 'go-admin/app/admin/apis.SysDictData.Update-fm', '字典数据编辑', '/api/v1/dict/data/:dictCode', 'BUS', 'PUT', '2021-05-13 19:59:05.519', '2021-06-17 11:48:40.732', NULL, 0, 0),
(102, 'go-admin/app/admin/apis.SysDictType.Update-fm', '字典类型编辑', '/api/v1/dict/type/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.569', '2021-06-17 11:48:40.732', NULL, 0, 0),
(103, 'go-admin/app/admin/apis.SysDept.Update-fm', '部门编辑', '/api/v1/dept/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.613', '2021-06-17 11:48:40.732', NULL, 0, 0),
(104, 'go-admin/app/other/apis.SysFileDir.Update-fm', '文件夹编辑', '/api/v1/file-dir/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.662', '2021-06-13 20:53:51.847', NULL, 0, 0),
(105, 'go-admin/app/other/apis.SysFileInfo.Update-fm', '文件编辑', '/api/v1/file-info/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.709', '2021-06-13 20:53:51.892', NULL, 0, 0),
(106, 'go-admin/app/admin/apis.SysRole.Update-fm', '角色编辑', '/api/v1/role/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.752', '2021-06-17 11:48:40.732', NULL, 0, 0),
(107, 'go-admin/app/admin/apis.SysRole.Update2DataScope-fm', '角色数据权限修改', '/api/v1/roledatascope', 'BUS', 'PUT', '2021-05-13 19:59:05.803', '2021-06-17 11:48:40.732', NULL, 0, 0),
(108, 'go-admin/app/admin/apis.SysConfig.Update-fm', '参数编辑', '/api/v1/config/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.848', '2021-06-17 11:48:40.732', NULL, 0, 0),
(109, 'go-admin/app/admin/apis.SysMenu.Update-fm', '编辑菜单', '/api/v1/menu/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.891', '2021-06-17 11:48:40.732', NULL, 0, 0),
(110, 'go-admin/app/admin/apis.SysPost.Update-fm', '岗位编辑', '/api/v1/post/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.934', '2021-06-17 11:48:40.732', NULL, 0, 0),
(111, 'go-admin/app/admin/apis.SysUser.UpdatePwd-fm', '*用户修改密码', '/api/v1/user/pwd', 'SYS', 'PUT', '2021-05-13 19:59:05.987', '2021-06-13 20:53:51.724', NULL, 0, 0),
(112, 'go-admin/common/actions.DeleteAction.func1', '分类删除', '/api/v1/syscategory', 'BUS', 'DELETE', '2021-05-13 19:59:06.030', '2021-06-13 20:53:52.237', NULL, 0, 0),
(113, 'go-admin/common/actions.DeleteAction.func1', '内容删除', '/api/v1/syscontent', 'BUS', 'DELETE', '2021-05-13 19:59:06.076', '2021-06-13 20:53:52.278', NULL, 0, 0),
(114, 'go-admin/app/admin/apis.SysLoginLog.Delete-fm', '登录日志删除', '/api/v1/sys-login-log', 'BUS', 'DELETE', '2021-05-13 19:59:06.118', '2021-06-17 11:48:40.732', NULL, 0, 0),
(115, 'go-admin/app/admin/apis.SysOperaLog.Delete-fm', '操作日志删除', '/api/v1/sys-opera-log', 'BUS', 'DELETE', '2021-05-13 19:59:06.162', '2021-06-17 11:48:40.732', NULL, 0, 0),
(116, 'go-admin/common/actions.DeleteAction.func1', 'job删除', '/api/v1/sysjob', 'BUS', 'DELETE', '2021-05-13 19:59:06.206', '2021-06-13 20:53:52.323', NULL, 0, 0),
(117, 'go-admin/app/other/apis.SysChinaAreaData.Delete-fm', '行政区删除', '/api/v1/sys-area-data', 'BUS', 'DELETE', '2021-05-13 19:59:06.249', '2021-06-13 20:53:52.061', NULL, 0, 0),
(120, 'go-admin/app/admin/apis.SysDictData.Delete-fm', '字典数据删除', '/api/v1/dict/data', 'BUS', 'DELETE', '2021-05-13 19:59:06.387', '2021-06-17 11:48:40.732', NULL, 0, 0),
(121, 'go-admin/app/admin/apis.SysDictType.Delete-fm', '字典类型删除', '/api/v1/dict/type', 'BUS', 'DELETE', '2021-05-13 19:59:06.432', '2021-06-17 11:48:40.732', NULL, 0, 0),
(122, 'go-admin/app/admin/apis.SysDept.Delete-fm', '部门删除', '/api/v1/dept/:id', 'BUS', 'DELETE', '2021-05-13 19:59:06.475', '2021-06-17 11:48:40.732', NULL, 0, 0),
(123, 'go-admin/app/other/apis.SysFileDir.Delete-fm', '文件夹删除', '/api/v1/file-dir/:id', 'BUS', 'DELETE', '2021-05-13 19:59:06.520', '2021-06-13 20:53:52.539', NULL, 0, 0),
(124, 'go-admin/app/other/apis.SysFileInfo.Delete-fm', '文件删除', '/api/v1/file-info/:id', 'BUS', 'DELETE', '2021-05-13 19:59:06.566', '2021-06-13 20:53:52.580', NULL, 0, 0),
(125, 'go-admin/app/admin/apis.SysConfig.Delete-fm', '参数删除', '/api/v1/config', 'BUS', 'DELETE', '2021-05-13 19:59:06.612', '2021-06-17 11:48:40.732', NULL, 0, 0),
(126, 'go-admin/app/admin/apis.SysMenu.Delete-fm', '删除菜单', '/api/v1/menu', 'BUS', 'DELETE', '2021-05-13 19:59:06.654', '2021-06-17 11:48:40.732', NULL, 0, 0),
(127, 'go-admin/app/admin/apis.SysPost.Delete-fm', '岗位删除', '/api/v1/post/:id', 'BUS', 'DELETE', '2021-05-13 19:59:06.702', '2021-06-17 11:48:40.732', NULL, 0, 0),
(128, 'go-admin/app/admin/apis.SysRole.Delete-fm', '角色删除', '/api/v1/role', 'BUS', 'DELETE', '2021-05-13 19:59:06.746', '2021-06-17 11:48:40.732', NULL, 0, 0),
(131, 'github.com/go-admin-team/go-admin-core/tools/transfer.Handler.func1', '系统指标', '/api/v1/metrics', 'SYS', 'GET', '2021-05-17 22:13:55.933', '2021-06-13 20:53:49.614', NULL, 0, 0),
(132, 'go-admin/app/other/router.registerMonitorRouter.func1', '健康状态', '/api/v1/health', 'SYS', 'GET', '2021-05-17 22:13:56.285', '2021-06-13 20:53:49.951', NULL, 0, 0),
(133, 'go-admin/app/admin/apis.HelloWorld', '项目默认接口', '/', 'SYS', 'GET', '2021-05-24 10:30:44.553', '2021-06-13 20:53:47.406', NULL, 0, 0),
(134, 'go-admin/app/other/apis.ServerMonitor.ServerInfo-fm', '服务器基本状态', '/api/v1/server-monitor', 'SYS', 'GET', '2021-05-24 10:30:44.937', '2021-06-13 20:53:48.255', NULL, 0, 0),
(135, 'go-admin/app/admin/apis.SysApi.GetPage-fm', '接口列表', '/api/v1/sys-api', 'BUS', 'GET', '2021-05-24 11:37:53.303', '2021-06-17 11:48:40.732', NULL, 0, 0),
(136, 'go-admin/app/admin/apis.SysApi.Get-fm', '接口通过id获取', '/api/v1/sys-api/:id', 'BUS', 'GET', '2021-05-24 11:37:53.359', '2021-06-17 11:48:40.732', NULL, 0, 0),
(137, 'go-admin/app/admin/apis.SysLoginLog.GetPage-fm', '登录日志列表', '/api/v1/sys-login-log', 'BUS', 'GET', '2021-05-24 11:47:30.397', '2021-06-17 11:48:40.732', NULL, 0, 0),
(138, 'go-admin/app/other/apis.File.UploadFile-fm', '文件上传', '/api/v1/public/uploadFile', 'SYS', 'POST', '2021-05-25 19:16:18.493', '2021-06-13 20:53:50.866', NULL, 0, 0),
(139, 'go-admin/app/admin/apis.SysConfig.Update2Set-fm', '参数信息修改【参数配置】', '/api/v1/set-config', 'BUS', 'PUT', '2021-05-27 09:45:14.853', '2021-06-17 11:48:40.732', NULL, 0, 0),
(140, 'go-admin/app/admin/apis.SysConfig.Get2Set-fm', '参数获取全部【配置使用】', '/api/v1/set-config', 'BUS', 'GET', '2021-05-27 11:54:14.384', '2021-06-17 11:48:40.732', NULL, 0, 0),
(141, 'go-admin/app/admin/apis.SysUser.GetPage-fm', '管理员列表', '/api/v1/sys-user', 'BUS', 'GET', '2021-06-13 19:24:57.111', '2021-06-17 20:31:14.318', NULL, 0, 0),
(142, 'go-admin/app/admin/apis.SysUser.Get-fm', '管理员通过id获取', '/api/v1/sys-user/:id', 'BUS', 'GET', '2021-06-13 19:24:57.188', '2021-06-17 20:31:14.318', NULL, 0, 0),
(143, 'go-admin/app/admin/apis/tools.(*SysTable).GetSysTablesInfo-fm', '', '/api/v1/sys/tables/info', '', 'GET', '2021-06-13 19:24:57.437', '2021-06-13 20:53:48.047', NULL, 0, 0),
(144, 'go-admin/app/admin/apis/tools.(*SysTable).GetSysTables-fm', '', '/api/v1/sys/tables/info/:tableId', '', 'GET', '2021-06-13 19:24:57.510', '2021-06-13 20:53:48.088', NULL, 0, 0),
(145, 'go-admin/app/admin/apis/tools.(*SysTable).GetSysTableList-fm', '', '/api/v1/sys/tables/page', '', 'GET', '2021-06-13 19:24:57.582', '2021-06-13 20:53:48.128', NULL, 0, 0),
(146, 'github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1', '', '/static/*filepath', '', 'GET', '2021-06-13 19:24:59.641', '2021-06-13 20:53:50.081', NULL, 0, 0),
(147, 'github.com/swaggo/gin-swagger.CustomWrapHandler.func1', '', '/swagger/*any', '', 'GET', '2021-06-13 19:24:59.713', '2021-06-13 20:53:50.123', NULL, 0, 0),
(148, 'github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1', '', '/form-generator/*filepath', '', 'GET', '2021-06-13 19:24:59.914', '2021-06-13 20:53:50.295', NULL, 0, 0),
(149, 'go-admin/app/admin/apis/tools.(*SysTable).InsertSysTable-fm', '', '/api/v1/sys/tables/info', '', 'POST', '2021-06-13 19:25:00.163', '2021-06-13 20:53:50.539', NULL, 0, 0),
(150, 'go-admin/app/admin/apis.SysUser.Insert-fm', '管理员创建', '/api/v1/sys-user', 'BUS', 'POST', '2021-06-13 19:25:00.233', '2021-06-17 20:31:14.318', NULL, 0, 0),
(151, 'go-admin/app/admin/apis.SysUser.Update-fm', '管理员编辑', '/api/v1/sys-user', 'BUS', 'PUT', '2021-06-13 19:25:00.986', '2021-06-17 20:31:14.318', NULL, 0, 0),
(152, 'go-admin/app/admin/apis/tools.(*SysTable).UpdateSysTable-fm', '', '/api/v1/sys/tables/info', '', 'PUT', '2021-06-13 19:25:01.149', '2021-06-13 20:53:51.375', NULL, 0, 0),
(153, 'go-admin/app/admin/apis.SysRole.Update2Status-fm', '', '/api/v1/role-status', '', 'PUT', '2021-06-13 19:25:01.446', '2021-06-13 20:53:51.636', NULL, 0, 0),
(154, 'go-admin/app/admin/apis.SysUser.ResetPwd-fm', '', '/api/v1/user/pwd/reset', '', 'PUT', '2021-06-13 19:25:01.601', '2021-06-13 20:53:51.764', NULL, 0, 0),
(155, 'go-admin/app/admin/apis.SysUser.UpdateStatus-fm', '', '/api/v1/user/status', '', 'PUT', '2021-06-13 19:25:01.671', '2021-06-13 20:53:51.806', NULL, 0, 0),
(156, 'go-admin/app/admin/apis.SysUser.Delete-fm', '管理员删除', '/api/v1/sys-user', 'BUS', 'DELETE', '2021-06-13 19:25:02.043', '2021-06-17 20:31:14.318', NULL, 0, 0),
(157, 'go-admin/app/admin/apis/tools.(*SysTable).DeleteSysTables-fm', '', '/api/v1/sys/tables/info/:tableId', '', 'DELETE', '2021-06-13 19:25:02.283', '2021-06-13 20:53:52.367', NULL, 0, 0),
(158, 'github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1', '', '/static/*filepath', '', 'HEAD', '2021-06-13 19:25:02.734', '2021-06-13 20:53:52.791', NULL, 0, 0),
(159, 'github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1', '', '/form-generator/*filepath', '', 'HEAD', '2021-06-13 19:25:02.808', '2021-06-13 20:53:52.838', NULL, 0, 0);
SET IDENTITY_INSERT sys_api OFF;
INSERT INTO sys_config VALUES
(1, '皮肤样式', 'sys_index_skinName', 'skin-green', 'Y', '0', '主框架页-默认皮肤样式名称:蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow', 1, 1, '2021-05-13 19:56:37.913', '2021-06-05 13:50:13.123', NULL),
(2, '初始密码', 'sys_user_initPassword', '123456', 'Y', '0', '用户管理-账号初始密码:123456', 1, 1, '2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL),
(3, '侧栏主题', 'sys_index_sideTheme', 'theme-dark', 'Y', '0', '主框架页-侧边栏主题:深色主题theme-dark,浅色主题theme-light', 1, 1, '2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL),
(4, '系统名称', 'sys_app_name', 'go-admin管理系统', 'Y', '1', '', 1, 0, '2021-03-17 08:52:06.067', '2021-05-28 10:08:25.248', NULL),
(5, '系统logo', 'sys_app_logo', 'https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png', 'Y', '1', '', 1, 0, '2021-03-17 08:53:19.462', '2021-03-17 08:53:19.462', NULL);
SET IDENTITY_INSERT sys_dept ON;
INSERT INTO sys_dept (dept_id, parent_id, dept_path, dept_name, sort, leader, phone, email, status, create_by, update_by, created_at, updated_at, deleted_at)VALUES
(1, 0, '/0/1/', '爱拓科技', 0, 'aituo', '13782218188', 'atuo@aituo.com', '2', 1, 1, '2021-05-13 19:56:37.913', '2021-06-05 17:06:44.960', NULL),
(7, 1, '/0/1/7/', '研发部', 1, 'aituo', '13782218188', 'atuo@aituo.com', '2', 1, 1, '2021-05-13 19:56:37.913', '2021-06-16 21:35:00.109', NULL),
(8, 1, '/0/1/8/', '运维部', 0, 'aituo', '13782218188', 'atuo@aituo.com', '2', 1, 1, '2021-05-13 19:56:37.913', '2021-06-16 21:41:39.747', NULL),
(9, 1, '/0/1/9/', '客服部', 0, 'aituo', '13782218188', 'atuo@aituo.com', '2', 1, 1, '2021-05-13 19:56:37.913', '2021-06-05 17:07:05.993', NULL),
(10, 1, '/0/1/10/', '人力资源', 3, 'aituo', '13782218188', 'atuo@aituo.com', '1', 1, 1, '2021-05-13 19:56:37.913', '2021-06-05 17:07:08.503', NULL);
SET IDENTITY_INSERT sys_dept OFF;
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default,
status, "default", remark, create_by, update_by, created_at, updated_at, deleted_at)VALUES
(1, 0, '正常', '2', 'sys_normal_disable', '', '', '', '2', '', '系统正常', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:40.168', NULL);
INSERT INTO sys_dict_data VALUES (2, 0, '停用', '1', 'sys_normal_disable', '', '', '', '2', '', '系统停用', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (3, 0, '男', '0', 'sys_user_sex', '', '', '', '2', '', '性别男', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (4, 0, '女', '1', 'sys_user_sex', '', '', '', '2', '', '性别女', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (5, 0, '未知', '2', 'sys_user_sex', '', '', '', '2', '', '性别未知', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (6, 0, '显示', '0', 'sys_show_hide', '', '', '', '2', '', '显示菜单', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (7, 0, '隐藏', '1', 'sys_show_hide', '', '', '', '2', '', '隐藏菜单', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (8, 0, '是', 'Y', 'sys_yes_no', '', '', '', '2', '', '系统默认是', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (9, 0, '否', 'N', 'sys_yes_no', '', '', '', '2', '', '系统默认否', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (10, 0, '正常', '2', 'sys_job_status', '', '', '', '2', '', '正常状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (11, 0, '停用', '1', 'sys_job_status', '', '', '', '2', '', '停用状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (12, 0, '默认', 'DEFAULT', 'sys_job_group', '', '', '', '2', '', '默认分组', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (13, 0, '系统', 'SYSTEM', 'sys_job_group', '', '', '', '2', '', '系统分组', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (14, 0, '通知', '1', 'sys_notice_type', '', '', '', '2', '', '通知', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (15, 0, '公告', '2', 'sys_notice_type', '', '', '', '2', '', '公告', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (16, 0, '正常', '2', 'sys_common_status', '', '', '', '2', '', '正常状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (17, 0, '关闭', '1', 'sys_common_status', '', '', '', '2', '', '关闭状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (18, 0, '新增', '1', 'sys_oper_type', '', '', '', '2', '', '新增操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (19, 0, '修改', '2', 'sys_oper_type', '', '', '', '2', '', '修改操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (20, 0, '删除', '3', 'sys_oper_type', '', '', '', '2', '', '删除操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (21, 0, '授权', '4', 'sys_oper_type', '', '', '', '2', '', '授权操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (22, 0, '导出', '5', 'sys_oper_type', '', '', '', '2', '', '导出操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (23, 0, '导入', '6', 'sys_oper_type', '', '', '', '2', '', '导入操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (24, 0, '强退', '7', 'sys_oper_type', '', '', '', '2', '', '强退操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (25, 0, '生成代码', '8', 'sys_oper_type', '', '', '', '2', '', '生成操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (26, 0, '清空数据', '9', 'sys_oper_type', '', '', '', '2', '', '清空操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (27, 0, '成功', '0', 'sys_notice_status', '', '', '', '2', '', '成功状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (28, 0, '失败', '1', 'sys_notice_status', '', '', '', '2', '', '失败状态', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (29, 0, '登录', '10', 'sys_oper_type', '', '', '', '2', '', '登录操作', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (30, 0, '退出', '11', 'sys_oper_type', '', '', '', '2', '', '', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (31, 0, '获取验证码', '12', 'sys_oper_type', '', '', '', '2', '', '获取验证码', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_data VALUES (32, 0, '正常', '1', 'sys_content_status', '', '', '', '1', '', '', 1, 1, '2021-05-13 19:56:40.845', '2021-05-13 19:56:40.845', NULL);
INSERT INTO sys_dict_data VALUES (33, 1, '禁用', '2', 'sys_content_status', '', '', '', '1', '', '', 1, 1, '2021-05-13 19:56:40.845', '2021-05-13 19:56:40.845', NULL);
INSERT INTO sys_dict_type (dict_id, dict_name, dict_type, status, remark, create_by, update_by, created_at, updated_at,
deleted_at)VALUES (1, '系统开关', 'sys_normal_disable', '2', '系统开关列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (2, '用户性别', 'sys_user_sex', '2', '用户性别列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (3, '菜单状态', 'sys_show_hide', '2', '菜单状态列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (4, '系统是否', 'sys_yes_no', '2', '系统是否列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (5, '任务状态', 'sys_job_status', '2', '任务状态列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (6, '任务分组', 'sys_job_group', '2', '任务分组列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (7, '通知类型', 'sys_notice_type', '2', '通知类型列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (8, '系统状态', 'sys_common_status', '2', '登录状态列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (9, '操作类型', 'sys_oper_type', '2', '操作类型列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (10, '通知状态', 'sys_notice_status', '2', '通知状态列表', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:37.914', NULL);
INSERT INTO sys_dict_type VALUES (11, '内容状态', 'sys_content_status', '2', '', 1, 1, '2021-05-13 19:56:40.813', '2021-05-13 19:56:40.813', NULL);
INSERT INTO sys_job (job_id, job_name, job_group, job_type, cron_expression, invoke_target, args, misfire_policy, concurrent, status, entry_id, created_at, updated_at, deleted_at, create_by, update_by)VALUES
(1, '接口测试', 'DEFAULT', 1, '0/5 * * * * ', 'http://localhost:8000', '', 1, 1, 1, 0, '2021-05-13 19:56:37.914', '2021-06-14 20:59:55.417', NULL, 1, 1),
(2, '函数测试', 'DEFAULT', 2, '0/5 * * * * ', 'ExamplesOne', '参数', 1, 1, 1, 0, '2021-05-13 19:56:37.914', '2021-05-31 23:55:37.221', NULL, 1, 1);
SET IDENTITY_INSERT sys_menu ON;
INSERT INTO sys_menu (menu_id, menu_name, title, icon, path, paths, menu_type, "action", permission, parent_id, no_cache, breadcrumb, component, sort, visible, is_frame, create_by, update_by, created_at, updated_at, deleted_at)VALUES
(2, 'Admin', '系统管理', 'api-server', '/admin', '/0/2', 'M', '无', '', 0, 1, '', 'Layout', 10, '0', '1', 0, 1, '2021-05-20 21:58:45.679', '2021-06-17 11:48:40.703', NULL),
(3, 'SysUserManage', '用户管理', 'user', '/admin/sys-user', '/0/2/3', 'C', '无', 'admin:sysUser:list', 2, 0, '', '/admin/sys-user/index', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL),
(43, '', '新增管理员', 'app-group-fill', '', '/0/2/3/43', 'F', 'POST', 'admin:sysUser:add', 3, 0, '', '', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL),
(44, '', '查询管理员', 'app-group-fill', '', '/0/2/3/44', 'F', 'GET', 'admin:sysUser:query', 3, 0, '', '', 40, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL),
(45, '', '修改管理员', 'app-group-fill', '', '/0/2/3/45', 'F', 'PUT', 'admin:sysUser:edit', 3, 0, '', '', 30, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL),
(46, '', '删除管理员', 'app-group-fill', '', '/0/2/3/46', 'F', 'DELETE', 'admin:sysUser:remove', 3, 0, '', '', 20, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL),
(51, 'SysMenuManage', '菜单管理', 'tree-table', '/admin/sys-menu', '/0/2/51', 'C', '无', 'admin:sysMenu:list', 2, 1, '', '/admin/sys-menu/index', 30, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(52, 'SysRoleManage', '角色管理', 'peoples', '/admin/sys-role', '/0/2/52', 'C', '无', 'admin:sysRole:list', 2, 1, '', '/admin/sys-role/index', 20, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(56, 'SysDeptManage', '部门管理', 'tree', '/admin/sys-dept', '/0/2/56', 'C', '无', 'admin:sysDept:list', 2, 0, '', '/admin/sys-dept/index', 40, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(57, 'SysPostManage', '岗位管理', 'pass', '/admin/sys-post', '/0/2/57', 'C', '无', 'admin:sysPost:list', 2, 0, '', '/admin/sys-post/index', 50, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(58, 'Dict', '字典管理', 'education', '/admin/dict', '/0/2/58', 'C', '无', 'admin:sysDictType:list', 2, 0, '', '/admin/dict/index', 60, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(59, 'SysDictDataManage', '字典数据', 'education', '/admin/dict/data/:dictId', '/0/2/59', 'C', '无', 'admin:sysDictData:list', 2, 0, '', '/admin/dict/data', 100, '1', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(60, 'Tools', '开发工具', 'dev-tools', '/dev-tools', '/0/60', 'M', '无', '', 0, 0, '', 'Layout', 40, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-05 22:15:03.465', NULL),
(61, 'Swagger', '系统接口', 'guide', '/dev-tools/swagger', '/0/60/61', 'C', '无', '', 60, 0, '', '/dev-tools/swagger/index', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-05 22:15:03.465', NULL),
(62, 'SysConfigManage', '参数管理', 'swagger', '/admin/sys-config', '/0/2/62', 'C', '无', 'admin:sysConfig:list', 2, 0, '', '/admin/sys-config/index', 70, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(211, 'Log', '日志管理', 'log', '/log', '/0/2/211', 'M', '', '', 2, 0, '', '/log/index', 80, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(212, 'SysLoginLogManage', '登录日志', 'logininfor', '/admin/sys-login-log', '/0/2/211/212', 'C', '', 'admin:sysLoginLog:list', 211, 0, '', '/admin/sys-login-log/index', 1, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(216, 'OperLog', '操作日志', 'skill', '/admin/sys-oper-log', '/0/2/211/216', 'C', '', 'admin:sysOperLog:list', 211, 0, '', '/admin/sys-oper-log/index', 1, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(220, '', '新增菜单', 'app-group-fill', '', '/0/2/51/220', 'F', '', 'admin:sysMenu:add', 51, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(221, '', '修改菜单', 'app-group-fill', '', '/0/2/51/221', 'F', '', 'admin:sysMenu:edit', 51, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(222, '', '查询菜单', 'app-group-fill', '', '/0/2/51/222', 'F', '', 'admin:sysMenu:query', 51, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(223, '', '删除菜单', 'app-group-fill', '', '/0/2/51/223', 'F', '', 'admin:sysMenu:remove', 51, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(224, '', '新增角色', 'app-group-fill', '', '/0/2/52/224', 'F', '', 'admin:sysRole:add', 52, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(225, '', '查询角色', 'app-group-fill', '', '/0/2/52/225', 'F', '', 'admin:sysRole:query', 52, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(226, '', '修改角色', 'app-group-fill', '', '/0/2/52/226', 'F', '', 'admin:sysRole:update', 52, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(227, '', '删除角色', 'app-group-fill', '', '/0/2/52/227', 'F', '', 'admin:sysRole:remove', 52, 0, '', '', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(228, '', '查询部门', 'app-group-fill', '', '/0/2/56/228', 'F', '', 'admin:sysDept:query', 56, 0, '', '', 40, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(229, '', '新增部门', 'app-group-fill', '', '/0/2/56/229', 'F', '', 'admin:sysDept:add', 56, 0, '', '', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(230, '', '修改部门', 'app-group-fill', '', '/0/2/56/230', 'F', '', 'admin:sysDept:edit', 56, 0, '', '', 30, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(231, '', '删除部门', 'app-group-fill', '', '/0/2/56/231', 'F', '', 'admin:sysDept:remove', 56, 0, '', '', 20, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(232, '', '查询岗位', 'app-group-fill', '', '/0/2/57/232', 'F', '', 'admin:sysPost:query', 57, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(233, '', '新增岗位', 'app-group-fill', '', '/0/2/57/233', 'F', '', 'admin:sysPost:add', 57, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(234, '', '修改岗位', 'app-group-fill', '', '/0/2/57/234', 'F', '', 'admin:sysPost:edit', 57, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(235, '', '删除岗位', 'app-group-fill', '', '/0/2/57/235', 'F', '', 'admin:sysPost:remove', 57, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(236, '', '查询字典', 'app-group-fill', '', '/0/2/58/236', 'F', '', 'admin:sysDictType:query', 58, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(237, '', '新增类型', 'app-group-fill', '', '/0/2/58/237', 'F', '', 'admin:sysDictType:add', 58, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(238, '', '修改类型', 'app-group-fill', '', '/0/2/58/238', 'F', '', 'admin:sysDictType:edit', 58, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(239, '', '删除类型', 'app-group-fill', '', '/0/2/58/239', 'F', '', 'system:sysdicttype:remove', 58, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(240, '', '查询数据', 'app-group-fill', '', '/0/2/59/240', 'F', '', 'admin:sysDictData:query', 59, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(241, '', '新增数据', 'app-group-fill', '', '/0/2/59/241', 'F', '', 'admin:sysDictData:add', 59, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(242, '', '修改数据', 'app-group-fill', '', '/0/2/59/242', 'F', '', 'admin:sysDictData:edit', 59, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(243, '', '删除数据', 'app-group-fill', '', '/0/2/59/243', 'F', '', 'admin:sysDictData:remove', 59, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(244, '', '查询参数', 'app-group-fill', '', '/0/2/62/244', 'F', '', 'admin:sysConfig:query', 62, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(245, '', '新增参数', 'app-group-fill', '', '/0/2/62/245', 'F', '', 'admin:sysConfig:add', 62, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(246, '', '修改参数', 'app-group-fill', '', '/0/2/62/246', 'F', '', 'admin:sysConfig:edit', 62, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(247, '', '删除参数', 'app-group-fill', '', '/0/2/62/247', 'F', '', 'admin:sysConfig:remove', 62, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(248, '', '查询登录日志', 'app-group-fill', '', '/0/2/211/212/248', 'F', '', 'admin:sysLoginLog:query', 212, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(249, '', '删除登录日志', 'app-group-fill', '', '/0/2/211/212/249', 'F', '', 'admin:sysLoginLog:remove', 212, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(250, '', '查询操作日志', 'app-group-fill', '', '/0/2/211/216/250', 'F', '', 'admin:sysOperLog:query', 216, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(251, '', '删除操作日志', 'app-group-fill', '', '/0/2/211/216/251', 'F', '', 'admin:sysOperLog:remove', 216, 0, '', '', 0, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-17 11:48:40.703', NULL),
(261, 'Gen', '代码生成', 'code', '/dev-tools/gen', '/0/60/261', 'C', '', '', 60, 0, '', '/dev-tools/gen/index', 2, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-16 21:26:12.446', NULL),
(262, 'EditTable', '代码生成修改', 'build', '/dev-tools/editTable', '/0/60/262', 'C', '', '', 60, 0, '', '/dev-tools/gen/editTable', 100, '1', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-16 21:26:12.446', NULL),
(264, 'Build', '表单构建', 'build', '/dev-tools/build', '/0/60/264', 'C', '', '', 60, 0, '', '/dev-tools/build/index', 1, '0', '1', 1, 1, '2020-04-11 15:52:48.000', '2021-06-16 21:26:12.446', NULL),
(269, 'ServerMonitor', '服务监控', 'druid', '/sys-tools/monitor', '/0/60/269', 'C', '', 'sysTools:serverMonitor:list', 537, 0, '', '/sys-tools/monitor', 0, '0', '1', 1, 1, '2020-04-14 00:28:19.000', '2021-06-16 21:26:12.446', NULL),
(459, 'Schedule', '定时任务', 'time-range', '/schedule', '/0/459', 'M', '无', '', 0, 0, '', 'Layout', 20, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(460, 'ScheduleManage', 'Schedule', 'job', '/schedule/manage', '/0/459/460', 'C', '无', 'job:sysJob:list', 459, 0, '', '/schedule/index', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(461, 'sys_job', '分页获取定时任务', 'app-group-fill', '', '/0/459/460/461', 'F', '无', 'job:sysJob:query', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(462, 'sys_job', '创建定时任务', 'app-group-fill', '', '/0/459/460/462', 'F', '无', 'job:sysJob:add', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(463, 'sys_job', '修改定时任务', 'app-group-fill', '', '/0/459/460/463', 'F', '无', 'job:sysJob:edit', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(464, 'sys_job', '删除定时任务', 'app-group-fill', '', '/0/459/460/464', 'F', '无', 'job:sysJob:remove', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL),
(471, 'JobLog', '日志', 'bug', '/schedule/log', '/0/459/471', 'C', '', '', 459, 0, '', '/schedule/log', 0, '1', '1', 1, 1, '2020-08-05 21:24:46.000', '2021-06-05 22:15:03.465', NULL),
(528, 'SysApiManage', '接口管理', 'api-doc', '/admin/sys-api', '/0/527/528', 'C', '无', 'admin:sysApi:list', 2, 0, '', '/admin/sys-api/index', 0, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(529, '', '查询接口', 'app-group-fill', '', '/0/527/528/529', 'F', '无', 'admin:sysApi:query', 528, 0, '', '', 40, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(531, '', '修改接口', 'app-group-fill', '', '/0/527/528/531', 'F', '无', 'admin:sysApi:edit', 528, 0, '', '', 30, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL),
(537, 'SysTools', '系统工具', 'system-tools', '/sys-tools', '', 'M', '', '', 0, 0, '', 'Layout', 30, '0', '1', 1, 1, '2021-05-21 11:13:32.166', '2021-06-16 21:26:12.446', NULL),
(540, 'SysConfigSet', '参数设置', 'system-tools', '/admin/sys-config/set', '', 'C', '', 'admin:sysConfigSet:list', 2, 0, '', '/admin/sys-config/set', 0, '0', '1', 1, 1, '2021-05-25 16:06:52.560', '2021-06-17 11:48:40.703', NULL),
(542, '', '修改', 'upload', '', '', 'F', '', 'admin:sysConfigSet:update', 540, 0, '', '', 0, '0', '1', 1, 1, '2021-06-13 11:45:48.670', '2021-06-17 11:48:40.703', NULL);
SET IDENTITY_INSERT sys_menu OFF;
INSERT INTO sys_menu_api_rule (sys_menu_menu_id, sys_api_id)VALUES (216, 6);
(250, 6),
(58, 21),
(236, 21),
(238, 23),
(59, 24),
(240, 24),
(242, 25),
(58, 26),
(236, 26),
(56, 27),
(228, 27),
(230, 28),
(226, 29),
(51, 39),
(51, 135),
(222, 39),
(221, 41),
(52, 44),
(225, 44),
(226, 45),
(226, 46),
(226, 47),
(62, 53),
(244, 53),
(246, 54),
(57, 59),
(232, 59),
(234, 60),
(241, 80),
(237, 81),
(229, 82),
(245, 87),
(220, 88),
(233, 89),
(224, 90),
(531, 92),
(242, 101),
(238, 102),
(230, 103),
(226, 106),
(226, 107),
(246, 108),
(221, 109),
(234, 110),
(249, 114),
(251, 115),
(243, 120),
(239, 121),
(231, 122),
(247, 125),
(223, 126),
(235, 127),
(227, 128),
(528, 135),
(529, 135),
(531, 136),
(212, 137),
(248, 137),
(542, 139),
(540, 140),
(3, 141),
(44, 141),
(45, 142),
(43, 150),
(45, 151),
(46, 156);
INSERT INTO sys_post (post_id, post_name, post_code, sort, status, remark, create_by, update_by, created_at, updated_at, deleted_at)VALUES
(1, '首席执行官', 'CEO', 0, '2','首席执行官', 1, 1, '2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL),
(2, '首席技术执行官', 'CTO', 2, '2','首席技术执行官', 1, 1,'2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL),
(3, '首席运营官', 'COO', 3, '2','测试工程师', 1, 1,'2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL);
INSERT INTO sys_role (role_id, role_name, status, role_key, role_sort, flag, remark, admin, data_scope, create_by, update_by, created_at, updated_at, deleted_at)VALUES
(1, '系统管理员', '2', 'admin', 1, '', '', 1, '', 1, 1, '2021-05-13 19:56:37.913', '2021-05-13 19:56:37.913', NULL);
INSERT INTO sys_user VALUES (1, 'admin', '$2a$10$/Glr4g9Svr6O0kvjsRJCXu3f0W8/dsP3XZyVNi1019ratWpSPMyw.', 'zhangwj', '13818888888', 1, '', '', '1', '1@qq.com', 1, 1, '', '2', 1, 1, '2021-05-13 19:56:37.914', '2021-05-13 19:56:40.205', NULL);
-- 数据完成 ;

Some files were not shown because too many files have changed in this diff Show More