Browse Source

Merge branch 'gin-vue-admin_v2_dev' of https://github.com/piexlmax/gin-vue-admin into gin-vue-admin_v2_dev

# Conflicts:
#	server/model/sys_authority.go
#	server/model/sys_authority_menu.go
#	server/model/sys_base_menu.go
rainyan 5 years ago
parent
commit
da9e39df2a

+ 0 - 29
docker-compose.yml

@@ -1,29 +0,0 @@
-# 关于Compose文件的具体说明,请参考以下链接:
-# https://docs.docker.com/compose/compose-file/
-
-version: "3.5"
-services:
-  # 数据库的各种配置参数,请参考以下链接:
-  # https://github.com/piexlmax/gin-vue-admin/blob/master/QMPlusServer/db/qmplus.sql#L4-L8
-  # https://github.com/piexlmax/gin-vue-admin/blob/master/QMPlusServer/static/config/config.json#L8-L14
-  database:
-    image: mysql:5.6
-    ports:
-      - 3306:3306
-    volumes:
-      - ./QMPlusServer/db:/docker-entrypoint-initdb.d
-    environment:
-      MYSQL_ROOT_PASSWORD: Aa@6447985
-      MYSQL_DATABASE: qmPlus
-    user: root
-  server:
-    build: ./QMPlusServer
-    ports:
-      - 8080:8080
-      - 8888:8888
-    environment:
-      MYSQLHOST: database
-    working_dir: /go/src/gin-vue-admin
-    restart: always
-    depends_on:
-      - database

+ 1 - 1
server/api/v1/sys_menu.go

@@ -122,7 +122,7 @@ type AuthorityIdInfo struct {
 // @Produce application/json
 // @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
-// @Router /menu/addMenuAuthority [post]
+// @Router /menu/GetMenuAuthority [post]
 func GetMenuAuthority(c *gin.Context) {
 	var authorityIdInfo AuthorityIdInfo
 	_ = c.ShouldBindJSON(&authorityIdInfo)

+ 0 - 43
server/config.json

@@ -1,43 +0,0 @@
-{
-    "casbin": {
-        "modelPath": "./resource/rbac_model.conf"
-    },
-    "jwt": {
-        "signingKey": "qmPlus"
-    },
-    "mysql": {
-        "username": "root",
-        "password": "Aa@6447985",
-        "path": "127.0.0.1:3306",
-        "dbname": "qmPlus",
-        "config": "charset=utf8\u0026parseTime=True\u0026loc=Local",
-        "maxIdleConns": 10,
-        "maxOpenConns": 100,
-        "logMode": true
-    },
-    "qiniu": {
-        "accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ",
-        "secretKey": "pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY"
-    },
-    "redis": {
-        "addr": "127.0.0.1:6379",
-        "password": "",
-        "db": 0
-    },
-    "system": {
-        "useMultipoint": false,
-        "env": "develop",
-        "addr": 8888
-    },
-    "captcha": {
-        "keyLong": 6,
-        "imgWidth": 120,
-        "imgHeight": 40
-    },
-    "log": {
-        "prefix": "[GIN-VUE-ADMIN]",
-        "logFile": false,
-        "stdout": "DEBUG",
-        "file": "WARNING"
-    }
-}

+ 50 - 0
server/config.yaml

@@ -0,0 +1,50 @@
+# Gin-Vue-Admin Global Configuration
+
+# casbin configuration
+casbin:
+    model-path: './resource/rbac_model.conf'
+
+# jwt configuration
+jwt:
+    signing-key: 'qmPlus'
+
+# mysql connect configuration
+mysql:
+    username: root
+    password: 'Aa@6447985'
+    path: '127.0.0.1:3306'
+    db-name: 'qmPlus'
+    config: 'charset=utf8&parseTime=True&loc=Local'
+    max-idle-conns: 10
+    max-open-conns: 10
+    log-mode: true
+
+# oss configuration
+qiniu:
+    access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
+    secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
+
+# redis configuration
+redis:
+    addr: '127.0.0.1:6379'
+    passwprd: ''
+    db: 0
+
+# system configuration
+system:
+    use-multipoint: false
+    env: 'develop'
+    addr: 8888
+
+# captcha configuration
+captcha:
+    key-long: 6
+    img-width: 120
+    img-height: 40
+
+# logger configuration
+log:
+    prefix: '[GIN-VUE-ADMIN]'
+    log-file: true
+    stdout: 'DEBUG'
+    file: 'WARNING'

+ 40 - 44
server/config/config.go

@@ -1,64 +1,60 @@
 package config
 
 type Server struct {
-	Mysql   Mysql   `json:"mysql"`
-	Qiniu   Qiniu   `json:"qiniu"`
-	Casbin  Casbin  `json:"casbin"`
-	Redis   Redis   `json:"redis"`
-	System  System  `json:"system"`
-	JWT     JWT     `json:"jwt"`
-	Captcha Captcha `json:"captcha"`
-	Log     Log     `json:"log"`
+	Mysql   `mapstructure:"mysql"`
+	Qiniu   `mapstructure:"qiniu"`
+	Casbin  `mapstructure:"casbin"`
+	Redis   `mapstructure:"redis"`
+	System  `mapstructure:"system"`
+	JWT     `mapstructure:"jwt"`
+	Captcha `mapstructure:"captcha"`
+	Log     `mapstructure:"log"`
 }
 
-type System struct { // 系统配置
-	UseMultipoint bool   `json:"useMultipoint"`
-	Env           string `json:"env"`
-	Addr          int    `json:"addr"`
+type System struct {
+	UseMultipoint bool   `mapstructure:"use-multipoint"`
+	Env           string `mapstructure:"env"`
+	Addr          int    `mapstructure:"addr"`
 }
 
-type JWT struct { // jwt签名
-	SigningKey string `json:"signingKey"`
+type JWT struct {
+	SigningKey string `mapstructure:"signing-key"`
 }
 
-type Casbin struct { //casbin配置
-	ModelPath string `json:"modelPath"` // casbin model地址配置
+type Casbin struct {
+	ModelPath string `mapstructure:"model-path"`
 }
 
-type Mysql struct { // mysql admin 数据库配置
-	Username     string `json:"username"`
-	Password     string `json:"password"`
-	Path         string `json:"path"`
-	Dbname       string `json:"dbname"`
-	Config       string `json:"config"`
-	MaxIdleConns int    `json:"maxIdleConns"`
-	MaxOpenConns int    `json:"maxOpenConns"`
-	LogMode      bool   `json:"maxOpenConns"`
+type Mysql struct {
+	Username     string `mapstructure:"username"`
+	Password     string `mapstructure:"password"`
+	Path         string `mapstructure:"path"`
+	Dbname       string `mapstructure:"db-name"`
+	Config       string `mapstructure:"config"`
+	MaxIdleConns int    `mapstructure:"max-idle-conns"`
+	MaxOpenConns int    `mapstructure:"max-open-conns"`
+	LogMode      bool   `mapstructure:"log-mode"`
 }
 
-type Redis struct { // Redis admin 数据库配置
-	Addr     string `json:"addr"`
-	Password string `json:"password"`
-	DB       int    `json:"db"`
+type Redis struct {
+	Addr     string `mapstructure:"addr"`
+	Password string `mapstructure:"password"`
+	DB       int    `mapstructure:"db"`
 }
-type Qiniu struct { // 七牛 密钥配置
-	AccessKey string `json:"accessKey"`
-	SecretKey string `json:"secretKey"`
+type Qiniu struct {
+	AccessKey string `mapstructure:"access-key"`
+	SecretKey string `mapstructure:"secret-key"`
 }
 
-type Captcha struct { // 验证码配置
-	KeyLong   int `json:"keyLong"`
-	ImgWidth  int `json:"imgWidth"`
-	ImgHeight int `json:"imgHeight"`
+type Captcha struct {
+	KeyLong   int `mapstructure:"key-long"`
+	ImgWidth  int `mapstructure:"img-width"`
+	ImgHeight int `mapstructure:"img-height"`
 }
 
 type Log struct {
-	// log 打印的前缀
-	Prefix string `json:"prefix"`
-	// 是否显示打印log的文件具体路径
-	LogFile bool `json:"logFile"`
-	// 在控制台打印log的级别, "" 默认不打印
-	Stdout string `json:"stdout"`
-	// 在文件中打印log的级别   "" 默认不打印
-	File string `json:"file"`
+	Prefix  string `mapstructure:"prefix"`
+	LogFile bool   `mapstructure:"log-file"`
+	Stdout  string `mapstructure:"stdout"`
+	File    string `mapstructure:"file"`
 }

+ 5 - 4
server/core/config.go

@@ -7,16 +7,17 @@ import (
 	"github.com/spf13/viper"
 )
 
+const defaultConfigFile = "config.yaml"
+
 func init() {
 	v := viper.New()
-	v.SetConfigName("config") //  设置配置文件名 (不带后缀)
-	v.AddConfigPath("./")     // 第一个搜索路径
-	v.SetConfigType("json")
-	err := v.ReadInConfig() // 搜索路径,并读取配置数据
+	v.SetConfigFile(defaultConfigFile)
+	err := v.ReadInConfig()
 	if err != nil {
 		panic(fmt.Errorf("Fatal error config file: %s \n", err))
 	}
 	v.WatchConfig()
+
 	v.OnConfigChange(func(e fsnotify.Event) {
 		fmt.Println("config file changed:", e.Name)
 		if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {

+ 81 - 45
server/db/qmplus.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50640
  File Encoding         : 65001
 
- Date: 02/04/2020 22:37:06
+ Date: 05/04/2020 16:24:43
 */
 
 SET NAMES utf8mb4;
@@ -3923,7 +3923,7 @@ CREATE TABLE `sys_apis`  (
   `authority_id` int(10) UNSIGNED NULL DEFAULT NULL,
   `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `api_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'POST',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE,
@@ -3980,25 +3980,58 @@ INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28',
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_authorities`;
 CREATE TABLE `sys_authorities`  (
-  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-  `created_at` timestamp(0) NULL DEFAULT NULL,
-  `updated_at` timestamp(0) NULL DEFAULT NULL,
-  `deleted_at` timestamp(0) NULL DEFAULT NULL,
   `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
   `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
   `parent_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  PRIMARY KEY (`id`) USING BTREE,
+  `created_at` datetime(0) NULL DEFAULT NULL,
+  `updated_at` datetime(0) NULL DEFAULT NULL,
+  `deleted_at` datetime(0) NULL DEFAULT NULL,
+  PRIMARY KEY (`authority_id`) USING BTREE,
   UNIQUE INDEX `authority_id`(`authority_id`) USING BTREE,
-  INDEX `idx_authorities_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_authorities_deleted_at`(`deleted_at`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of sys_authorities
 -- ----------------------------
-INSERT INTO `sys_authorities` VALUES (2, '2019-09-08 16:18:45', '2019-09-08 16:18:45', NULL, '888', '普通用户', '0');
-INSERT INTO `sys_authorities` VALUES (6, '2019-09-18 22:23:33', '2019-09-18 22:23:33', NULL, '9528', '测试角色', '0');
-INSERT INTO `sys_authorities` VALUES (8, '2019-12-28 18:19:13', '2019-12-28 18:19:13', NULL, '8881', '普通用户子角色', '888');
+INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', NULL, NULL);
+INSERT INTO `sys_authorities` VALUES ('8881', '普通用户子角色', '888', '2020-04-04 11:44:56', NULL, NULL);
+INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 11:44:56', NULL, NULL);
+
+-- ----------------------------
+-- Table structure for sys_authority_menus
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_authority_menus`;
+CREATE TABLE `sys_authority_menus`  (
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  `sys_base_menu_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
+  PRIMARY KEY (`sys_authority_authority_id`, `sys_base_menu_id`) USING BTREE,
+  INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
+
+-- ----------------------------
+-- Records of sys_authority_menus
+-- ----------------------------
+INSERT INTO `sys_authority_menus` VALUES ('888', 1);
+INSERT INTO `sys_authority_menus` VALUES ('888', 2);
+INSERT INTO `sys_authority_menus` VALUES ('888', 3);
+INSERT INTO `sys_authority_menus` VALUES ('888', 4);
+INSERT INTO `sys_authority_menus` VALUES ('888', 5);
+INSERT INTO `sys_authority_menus` VALUES ('888', 6);
+INSERT INTO `sys_authority_menus` VALUES ('888', 17);
+INSERT INTO `sys_authority_menus` VALUES ('888', 18);
+INSERT INTO `sys_authority_menus` VALUES ('888', 19);
+INSERT INTO `sys_authority_menus` VALUES ('888', 20);
+INSERT INTO `sys_authority_menus` VALUES ('888', 21);
+INSERT INTO `sys_authority_menus` VALUES ('888', 22);
+INSERT INTO `sys_authority_menus` VALUES ('888', 23);
+INSERT INTO `sys_authority_menus` VALUES ('888', 26);
+INSERT INTO `sys_authority_menus` VALUES ('888', 33);
+INSERT INTO `sys_authority_menus` VALUES ('888', 34);
+INSERT INTO `sys_authority_menus` VALUES ('888', 38);
+INSERT INTO `sys_authority_menus` VALUES ('888', 40);
+INSERT INTO `sys_authority_menus` VALUES ('888', 41);
+INSERT INTO `sys_authority_menus` VALUES ('888', 42);
 
 -- ----------------------------
 -- Table structure for sys_base_menus
@@ -4061,22 +4094,19 @@ INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:2
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_data_authority_id`;
 CREATE TABLE `sys_data_authority_id`  (
-  `sys_authority_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
-  `data_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
-  PRIMARY KEY (`sys_authority_id`, `data_id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  `data_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  PRIMARY KEY (`sys_authority_authority_id`, `data_authority_id`) USING BTREE,
+  INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE,
+  INDEX `data_authority_id`(`data_authority_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of sys_data_authority_id
 -- ----------------------------
-INSERT INTO `sys_data_authority_id` VALUES (2, 2);
-INSERT INTO `sys_data_authority_id` VALUES (2, 6);
-INSERT INTO `sys_data_authority_id` VALUES (2, 8);
-INSERT INTO `sys_data_authority_id` VALUES (6, 2);
-INSERT INTO `sys_data_authority_id` VALUES (6, 6);
-INSERT INTO `sys_data_authority_id` VALUES (8, 2);
-INSERT INTO `sys_data_authority_id` VALUES (8, 6);
-INSERT INTO `sys_data_authority_id` VALUES (8, 8);
+INSERT INTO `sys_data_authority_id` VALUES ('888', '888');
+INSERT INTO `sys_data_authority_id` VALUES ('888', '8881');
+INSERT INTO `sys_data_authority_id` VALUES ('888', '9528');
 
 -- ----------------------------
 -- Table structure for sys_menus
@@ -4102,7 +4132,7 @@ CREATE TABLE `sys_menus`  (
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_menus_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_menus_deleted_at`(`deleted_at`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 580 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 668 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of sys_menus
@@ -4140,26 +4170,26 @@ INSERT INTO `sys_menus` VALUES (517, '2019-10-20 11:23:39', '2019-12-12 16:58:23
 INSERT INTO `sys_menus` VALUES (518, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 9528, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
 INSERT INTO `sys_menus` VALUES (519, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 9528, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
 INSERT INTO `sys_menus` VALUES (520, '2020-02-24 19:48:37', '2020-03-27 20:05:38', NULL, 0, 9528, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
-INSERT INTO `sys_menus` VALUES (560, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 888, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
-INSERT INTO `sys_menus` VALUES (561, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 888, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
-INSERT INTO `sys_menus` VALUES (562, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 888, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
-INSERT INTO `sys_menus` VALUES (563, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 888, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
-INSERT INTO `sys_menus` VALUES (564, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 888, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
-INSERT INTO `sys_menus` VALUES (565, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 888, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
-INSERT INTO `sys_menus` VALUES (566, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 888, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
-INSERT INTO `sys_menus` VALUES (567, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 888, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
-INSERT INTO `sys_menus` VALUES (568, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 888, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', 0, '38', '系统工具', '5');
-INSERT INTO `sys_menus` VALUES (569, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 888, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', 38, '40', '代码生成器', '1');
-INSERT INTO `sys_menus` VALUES (570, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 888, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', 38, '41', '表单生成器', '2');
-INSERT INTO `sys_menus` VALUES (571, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 888, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', 38, '42', '系统配置', '3');
-INSERT INTO `sys_menus` VALUES (572, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 888, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
-INSERT INTO `sys_menus` VALUES (573, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 888, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
-INSERT INTO `sys_menus` VALUES (574, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 888, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
-INSERT INTO `sys_menus` VALUES (575, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 888, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
-INSERT INTO `sys_menus` VALUES (576, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 888, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
-INSERT INTO `sys_menus` VALUES (577, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 888, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
-INSERT INTO `sys_menus` VALUES (578, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 888, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
-INSERT INTO `sys_menus` VALUES (579, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 888, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
+INSERT INTO `sys_menus` VALUES (648, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 888, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
+INSERT INTO `sys_menus` VALUES (649, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 888, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
+INSERT INTO `sys_menus` VALUES (650, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 888, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
+INSERT INTO `sys_menus` VALUES (651, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 888, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
+INSERT INTO `sys_menus` VALUES (652, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 888, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
+INSERT INTO `sys_menus` VALUES (653, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 888, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
+INSERT INTO `sys_menus` VALUES (654, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 888, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
+INSERT INTO `sys_menus` VALUES (655, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 888, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
+INSERT INTO `sys_menus` VALUES (656, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 888, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', 0, '38', '系统工具', '5');
+INSERT INTO `sys_menus` VALUES (657, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 888, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', 38, '40', '代码生成器', '1');
+INSERT INTO `sys_menus` VALUES (658, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 888, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', 38, '41', '表单生成器', '2');
+INSERT INTO `sys_menus` VALUES (659, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 888, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', 38, '42', '系统配置', '3');
+INSERT INTO `sys_menus` VALUES (660, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 888, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
+INSERT INTO `sys_menus` VALUES (661, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 888, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
+INSERT INTO `sys_menus` VALUES (662, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 888, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
+INSERT INTO `sys_menus` VALUES (663, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 888, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
+INSERT INTO `sys_menus` VALUES (664, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 888, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
+INSERT INTO `sys_menus` VALUES (665, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 888, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
+INSERT INTO `sys_menus` VALUES (666, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 888, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
+INSERT INTO `sys_menus` VALUES (667, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 888, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
 
 -- ----------------------------
 -- Table structure for sys_users
@@ -4235,4 +4265,10 @@ CREATE TABLE `sys_workflows`  (
 -- ----------------------------
 INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20:21', NULL, '测试改版1', 'test', '123123');
 
+-- ----------------------------
+-- View structure for 111
+-- ----------------------------
+DROP VIEW IF EXISTS `111`;
+CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `111` AS select `sys_base_menus`.`id` AS `id`,`sys_menus`.`menu_id` AS `menu_id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort` from (`sys_menus` join `sys_base_menus` on((`sys_menus`.`menu_id` = `sys_base_menus`.`id`))) where (`sys_menus`.`authority_id` = 888);
+
 SET FOREIGN_KEY_CHECKS = 1;

+ 0 - 1
server/initialize/db_table.go

@@ -10,7 +10,6 @@ func DBTables() {
 	db := global.GVA_DB
 	db.AutoMigrate(model.SysUser{},
 		model.SysAuthority{},
-		model.SysMenu{},
 		model.SysApi{},
 		model.SysBaseMenu{},
 		model.JwtBlacklist{},

+ 2 - 13
server/model/exa_customer.go

@@ -17,7 +17,6 @@ type ExaCustomer struct {
 // @title    CreateExaCustomer
 // @description   create a customer, 创建用户
 // @auth                     (2020/04/05  20:22 )
-// @param     newPassword     string
 // @return    err             error
 func (e *ExaCustomer) CreateExaCustomer() (err error) {
 	err = global.GVA_DB.Create(e).Error
@@ -27,9 +26,6 @@ func (e *ExaCustomer) CreateExaCustomer() (err error) {
 // @title    DeleteFileChunk
 // @description   delete a customer, 删除用户
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (e *ExaCustomer) DeleteExaCustomer() (err error) {
 	err = global.GVA_DB.Delete(e).Error
@@ -39,9 +35,6 @@ func (e *ExaCustomer) DeleteExaCustomer() (err error) {
 // @title    UpdateExaCustomer
 // @description   update a customer, 更新用户
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (e *ExaCustomer) UpdateExaCustomer() (err error) {
 	err = global.GVA_DB.Save(e).Error
@@ -51,10 +44,8 @@ func (e *ExaCustomer) UpdateExaCustomer() (err error) {
 // @title    GetExaCustomer
 // @description   get the info of a costumer , 获取用户信息
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
+// @return    customer        ExaCustomer
 func (e *ExaCustomer) GetExaCustomer() (err error, customer ExaCustomer) {
 	err = global.GVA_DB.Where("id = ?", e.ID).First(&customer).Error
 	return
@@ -63,9 +54,7 @@ func (e *ExaCustomer) GetExaCustomer() (err error, customer ExaCustomer) {
 // @title    GetInfoList
 // @description   get customer list by pagination, 分页获取用户列表
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
+// @param     info            PageInfo
 // @return                    error
 func (e *ExaCustomer) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize

+ 4 - 13
server/model/exa_file_upload_download.go

@@ -16,9 +16,6 @@ type ExaFileUploadAndDownload struct {
 // @title    Upload
 // @description   删除文件切片记录
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (f *ExaFileUploadAndDownload) Upload() error {
 	err := global.GVA_DB.Create(f).Error
@@ -28,9 +25,6 @@ func (f *ExaFileUploadAndDownload) Upload() error {
 // @title    DeleteFile
 // @description   删除文件切片记录
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (f *ExaFileUploadAndDownload) DeleteFile() error {
 	err := global.GVA_DB.Where("id = ?", f.ID).Unscoped().Delete(f).Error
@@ -40,9 +34,6 @@ func (f *ExaFileUploadAndDownload) DeleteFile() error {
 // @title    FindFile
 // @description   删除文件切片记录
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (f *ExaFileUploadAndDownload) FindFile() (error, ExaFileUploadAndDownload) {
 	var file ExaFileUploadAndDownload
@@ -53,10 +44,10 @@ func (f *ExaFileUploadAndDownload) FindFile() (error, ExaFileUploadAndDownload)
 // @title    GetInfoList
 // @description   分页获取数据
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
-// @return                    error
+// @param     info            PageInfo
+// @return    err             error
+// @return    list            error
+// @return    total           error
 func (f *ExaFileUploadAndDownload) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)

+ 7 - 17
server/model/sys_api.go

@@ -43,9 +43,6 @@ func (a *SysApi) CreateApi() (err error) {
 // @title    DeleteApi
 // @description   delete base apis, 删除基础api
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (a *SysApi) DeleteApi() (err error) {
 	err = global.GVA_DB.Delete(a).Error
@@ -56,9 +53,6 @@ func (a *SysApi) DeleteApi() (err error) {
 // @title    UpdateApi
 // @description   update a base api, update api
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
 // @return                    error
 func (a *SysApi) UpdateApi() (err error) {
 	var oldA SysApi
@@ -83,9 +77,7 @@ func (a *SysApi) UpdateApi() (err error) {
 // @title    GetApiById
 // @description   get the apis of the selected user, 获取选中角色所拥有的api
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
+// @param     id              float64
 // @return                    error
 func (a *SysApi) GetApiById(id float64) (err error, api SysApi) {
 	err = global.GVA_DB.Where("id = ?", id).First(&api).Error
@@ -95,10 +87,8 @@ func (a *SysApi) GetApiById(id float64) (err error, api SysApi) {
 // @title    GetAllApis
 // @description   get all apis, 获取所有的api
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
-// @return                    error
+// @return       err          error
+// @return       apis         []SysApi
 func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
 	err = global.GVA_DB.Find(&apis).Error
 	return
@@ -107,10 +97,10 @@ func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
 // @title    GetInfoList
 // @description   get apis by pagination, 分页获取数据
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
-// @return                    error
+// @param     info            PageInfo
+// @return    err             error
+// @return    list            interface{}
+// @return    total           int
 func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)

+ 1 - 1
server/model/sys_authority.go

@@ -43,7 +43,7 @@ func (a *SysAuthority) DeleteAuthority() (err error) {
 	if err != nil {
 		err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error
 		if err != nil {
-			err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error
+			err = global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Association("SysBaseMenus").Delete(a.SysBaseMenus).Error
 			new(CasbinModel).ClearCasbin(0, a.AuthorityId)
 		} else {
 			err = errors.New("此角色存在子角色不允许删除")

+ 23 - 33
server/model/sys_authority_menu.go

@@ -1,13 +1,12 @@
 package model
 
 import (
-	"fmt"
 	"gin-vue-admin/global"
 )
 
 type SysMenu struct {
 	SysBaseMenu
-	MenuId      string    `json:"menuId"`
+	MenuId      string    `json:"MenuId"`
 	AuthorityId string    `json:"-"`
 	Children    []SysMenu `json:"children"`
 }
@@ -15,51 +14,41 @@ type SysMenu struct {
 // @title    AddMenuAuthority
 // @description   为角色增加menu树
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
+// @param     menus           []SysBaseMenu
+// @param     authorityId     string
 // @return                    error
 func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
-	var menu SysMenu
-	global.GVA_DB.Where("authority_id = ? ", authorityId).Unscoped().Delete(&SysMenu{})
-	for _, v := range menus {
-		menu.SysBaseMenu = v
-		menu.AuthorityId = authorityId
-		menu.MenuId = fmt.Sprintf("%v", v.ID)
-		menu.ID = 0
-		err = global.GVA_DB.Create(&menu).Error
-		if err != nil {
-			return err
-		}
-	}
 	var auth SysAuthority
 	auth.AuthorityId = authorityId
 	auth.SysBaseMenus = menus
-	auth.SetMuneAuthority()
-	return nil
+	err = auth.SetMuneAuthority()
+	return err
 }
 
 // @title    GetMenuAuthority
 // @description   查看当前角色树
 // @auth                     (2020/04/05  20:22 )
-// @param     FileMd5         string
-// @param     FileName        string
-// @param     FilePath        string
-// @return                    error
-func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysMenu) {
-	err = global.GVA_DB.Where("authority_id = ?", authorityId).Find(&menus).Error
-	return err, menus
+// @param     authorityId     string
+// @return    err             error
+// @return    menus           []SysBaseMenu
+func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysBaseMenu) {
+	var a SysAuthority
+	err = global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", authorityId).First(&a).Error
+	return err, a.SysBaseMenus
 }
 
 // @title    GetMenuTree
 // @description   获取动态菜单树
 // @auth                     (2020/04/05  20:22 )
-// @param     newPassword     string
+// @param     authorityId     string
 // @return    err             error
+// @return    menus           []SysMenu
 func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
-	err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Order("sort", true).Find(&menus).Error
+	SQLstatement := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?"
+
+	err = global.GVA_DB.Raw(SQLstatement, authorityId, 0).Scan(&menus).Error
 	for i := 0; i < len(menus); i++ {
-		err = getChildrenList(&menus[i])
+		err = getChildrenList(&menus[i], SQLstatement)
 	}
 	return err, menus
 }
@@ -67,12 +56,13 @@ func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
 // @title    getChildrenList
 // @description   获取子菜单
 // @auth                     (2020/04/05  20:22 )
-// @param     newPassword     string
+// @param     menu            *SysMenu
+// @param     SQLstatement    string
 // @return    err             error
-func getChildrenList(menu *SysMenu) (err error) {
-	err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Order("sort", true).Find(&menu.Children).Error
+func getChildrenList(menu *SysMenu, SQLstatement string) (err error) {
+	err = global.GVA_DB.Raw(SQLstatement, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error
 	for i := 0; i < len(menu.Children); i++ {
-		err = getChildrenList(&menu.Children[i])
+		err = getChildrenList(&menu.Children[i], SQLstatement)
 	}
 	return err
 }

+ 1 - 2
server/model/sys_auto_code.go

@@ -24,7 +24,6 @@ type Field struct {
 // @title    CreateTemp
 // @description   函数的详细描述
 // @auth                     (2020/04/05  20:22 )
-// @param     newPassword     string
 // @return    err             error
 func (a *AutoCodeStruct) CreateTemp() (err error) {
 	basePath := "./template"
@@ -133,7 +132,7 @@ func (a *AutoCodeStruct) CreateTemp() (err error) {
 // @title    createDir
 // @description   批量创建文件夹
 // @auth                     (2020/04/05  20:22 )
-// @param     newPassword     string
+// @param     dirs            string
 // @return    err             error
 func createDir(dirs ...string) (err error) {
 	for _, v := range dirs {

+ 2 - 6
server/model/sys_base_menu.go

@@ -17,7 +17,6 @@ type SysBaseMenu struct {
 	Component     string `json:"component"`
 	Sort          string `json:"sort"`
 	Meta          `json:"meta"`
-	NickName      string         `json:"nickName"`
 	SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
 	Children      []SysBaseMenu  `json:"children"`
 }
@@ -36,7 +35,6 @@ type Meta struct {
 func (b *SysBaseMenu) AddBaseMenu() (err error) {
 	findOne := global.GVA_DB.Where("name = ?", b.Name).Find(&SysBaseMenu{}).Error
 	if findOne != nil {
-		b.NickName = b.Title
 		err = global.GVA_DB.Create(b).Error
 	} else {
 		err = errors.New("存在重复name,请修改name")
@@ -52,8 +50,7 @@ func (b *SysBaseMenu) AddBaseMenu() (err error) {
 func (b *SysBaseMenu) DeleteBaseMenu(id float64) (err error) {
 	err = global.GVA_DB.Where("parent_id = ?", id).First(&SysBaseMenu{}).Error
 	if err != nil {
-		err = global.GVA_DB.Where("id = ?", id).Delete(&b).Error
-		err = global.GVA_DB.Where("menu_id = ?", id).Unscoped().Delete(&SysMenu{}).Error
+		err = global.GVA_DB.Preload("SysAuthoritys").Where("id = ?", id).Delete(&b).Association("SysAuthoritys").Delete(b.SysAuthoritys).Error
 	} else {
 		return errors.New("此菜单存在子菜单不可删除")
 	}
@@ -75,7 +72,6 @@ func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 	upDateMap["title"] = b.Title
 	upDateMap["icon"] = b.Icon
 	upDateMap["sort"] = b.Sort
-	upDateMap["nick_name"] = b.Title
 	err = global.GVA_DB.Where("id = ?", b.ID).Find(&SysBaseMenu{}).Updates(upDateMap).Error
 	err1 := global.GVA_DB.Where("menu_id = ?", b.ID).Find(&[]SysMenu{}).Updates(upDateMap).Error
 	fmt.Printf("菜单修改时候,关联菜单err1:%v,err:%v", err1, err)
@@ -83,7 +79,7 @@ func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
 }
 
 // @title    GetBaseMenuById
-// @description   当前选中角色所拥有的路由
+// @description   get current menus, 返回当前选中menu
 // @auth                     (2020/04/05  20:22 )
 // @param     newPassword     string
 // @return    err             error

+ 14 - 14
server/model/sys_casbin.go

@@ -68,8 +68,8 @@ func (c *CasbinModel) UpdateCasbinApi(oldPath string, newPath string) error {
 // @title    AddCasbin
 // @description   add casbin authority, 添加权限
 // @auth                     (2020/04/05  20:22 )
-// @param     cm               CasbinModel
-// @return                     bool
+// @param     cm              CasbinModel
+// @return                    bool
 func (c *CasbinModel) AddCasbin(cm CasbinModel) bool {
 	e := Casbin()
 	return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method)
@@ -78,8 +78,8 @@ func (c *CasbinModel) AddCasbin(cm CasbinModel) bool {
 // @title    GetPolicyPathByAuthorityId
 // @description   get policy path by authorityId, 获取权限列表
 // @auth                     (2020/04/05  20:22 )
-// @param     authorityId      string
-// @return                     []string
+// @param     authorityId     string
+// @return                    []string
 func (c *CasbinModel) GetPolicyPathByAuthorityId(authorityId string) []string {
 	e := Casbin()
 	var pathList []string
@@ -93,9 +93,9 @@ func (c *CasbinModel) GetPolicyPathByAuthorityId(authorityId string) []string {
 // @title    ClearCasbin
 // @description   清除匹配的权限
 // @auth                     (2020/04/05  20:22 )
-// @param     v                int
-// @param     p                string
-// @return                     bool
+// @param     v               int
+// @param     p               string
+// @return                    bool
 func (c *CasbinModel) ClearCasbin(v int, p string) bool {
 	e := Casbin()
 	return e.RemoveFilteredPolicy(v, p)
@@ -105,9 +105,9 @@ func (c *CasbinModel) ClearCasbin(v int, p string) bool {
 // @title    ParamsMatch
 // @description   customized rule, 自定义规则函数
 // @auth                     (2020/04/05  20:22 )
-// @param     fullNameKey1     string
-// @param     key2             string
-// @return                     bool
+// @param     fullNameKey1    string
+// @param     key2            string
+// @return                    bool
 func ParamsMatch(fullNameKey1 string, key2 string) bool {
 	key1 := strings.Split(fullNameKey1, "?")[0]
 	//剥离路径后再使用casbin的keyMatch2
@@ -117,9 +117,9 @@ func ParamsMatch(fullNameKey1 string, key2 string) bool {
 // @title    ParamsMatchFunc
 // @description   customized function, 自定义规则函数
 // @auth                     (2020/04/05  20:22 )
-// @param     args             ...interface{}
-// @return                     interface{}
-// @return                     error
+// @param     args            ...interface{}
+// @return                    interface{}
+// @return                    error
 func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 	name1 := args[0].(string)
 	name2 := args[1].(string)
@@ -128,7 +128,7 @@ func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
 }
 
 // @title    Casbin
-// @description   持久化到数据库  引入自定义规则
+// @description   store to DB, 持久化到数据库  引入自定义规则
 // @auth                     (2020/04/05  20:22 )
 func Casbin() *casbin.Enforcer {
 	a := gormadapter.NewAdapterByDB(global.GVA_DB)

+ 3 - 3
server/model/sys_jwt_blacklist.go

@@ -13,7 +13,7 @@ type JwtBlacklist struct {
 // @title    JsonInBlacklist
 // @description   create jwt blacklist
 // @auth                     (2020/04/05  20:22 )
-// @return    err              error
+// @return    err             error
 func (j *JwtBlacklist) JsonInBlacklist() (err error) {
 	err = global.GVA_DB.Create(j).Error
 	return
@@ -42,8 +42,8 @@ func (j *JwtBlacklist) GetRedisJWT(userName string) (err error, RedisJWT string)
 // @title    SetRedisJWT
 // @description   set jwt into the Redis
 // @auth                     (2020/04/05  20:22 )
-// @param     userName         string
-// @return    err              error
+// @param     userName        string
+// @return    err             error
 func (j *JwtBlacklist) SetRedisJWT(userName string) (err error) {
 	err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err()
 	return err

+ 4 - 4
server/model/sys_system.go

@@ -14,16 +14,16 @@ type System struct {
 // @title    GetSystemConfig
 // @description   读取配置文件
 // @auth                     (2020/04/05  20:22 )
-// @return    err              error
-// @return    conf             Server
+// @return    err             error
+// @return    conf            Server
 func (s *System) GetSystemConfig() (err error, conf config.Server) {
 	return nil, global.GVA_CONFIG
 }
 
 // @title    SetSystemConfig
 // @description   set system config, 设置配置文件
-// @auth                     (2020/04/05  20:22 )
-// @return    err              error
+// @auth                    (2020/04/05  20:22 )
+// @return    err            error
 func (s *System) SetSystemConfig() (err error) {
 	confs := utils.StructToMap(s.Config)
 	for k, v := range confs {

+ 3 - 3
server/model/sys_user.go

@@ -72,9 +72,9 @@ func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysU
 // @title    SetUserAuthority
 // @description   set the authority of a certain user, 设置一个用户的权限
 // @auth                     (2020/04/05  20:22 )
-// @param     uuid             UUID
-// @param     authorityId      string
-// @return    err              error
+// @param     uuid            UUID
+// @param     authorityId     string
+// @return    err             error
 func (u *SysUser) SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) {
 	err = global.GVA_DB.Where("uuid = ?", uuid).First(&SysUser{}).Update("authority_id", authorityId).Error
 	return err

+ 1 - 1
server/model/sys_workflow.go

@@ -28,7 +28,7 @@ type SysWorkflowStepInfo struct {
 // @title    Create
 // @description   create a workflow, 创建工作流
 // @auth                     (2020/04/05  20:22 )
-// @return                     error
+// @return                    error
 func (wk *SysWorkflow) Create() error {
 	err := global.GVA_DB.Create(&wk).Error
 	return err

+ 1 - 1
web/src/view/layout/index.vue

@@ -22,7 +22,7 @@
             <el-dropdown>
               <span class="el-dropdown-link">
                 <img :src="userInfo.headerImg" height="30" width="30" />
-                {{userInfo.nickName}}
+                {{userInfo.title}}
                 <i class="el-icon-arrow-down"></i>
               </span>
               <el-dropdown-menu class="dropdown-group" slot="dropdown">

+ 1 - 6
web/src/view/superAdmin/api/api.vue

@@ -167,12 +167,7 @@ export default {
       this.getTableData()
     },
     initForm() {
-      this.form = {
-        path: '',
-        apiGroup: '',
-        description: '',
-        method: ''
-      }
+      this.$refs.apiForm.resetFields()
     },
     closeDialog() {
       this.initForm()

+ 1 - 3
web/src/view/superAdmin/authority/authority.vue

@@ -136,9 +136,7 @@ export default {
     },
     // 初始化表单
     initForm() {
-      for (const key in this.form) {
-        this.form[key] = ''
-      }
+      this.$refs.authorityForm.resetFields()
     },
     // 关闭窗口
     closeDialog() {

+ 3 - 3
web/src/view/superAdmin/authority/components/apis.vue

@@ -44,10 +44,10 @@ export default {
       const apiObj = new Object()
       apis &&
         apis.map(item => {
-          if (apiObj.hasOwnProperty(item.group)) {
-            apiObj[item.group].push(item)
+          if (apiObj.hasOwnProperty(item.apiGroup)) {
+            apiObj[item.apiGroup].push(item)
           } else {
-            Object.assign(apiObj, { [item.group]: [item] })
+            Object.assign(apiObj, { [item.apiGroup]: [item] })
           }
         })
       const apiTree = []

+ 5 - 3
web/src/view/superAdmin/authority/components/menus.vue

@@ -34,7 +34,9 @@ export default {
       menuTreeIds: [],
       menuDefaultProps: {
         children: 'children',
-        label: 'nickName'
+        label: function(data){
+          return data.meta.title
+        }
       }
     }
   },
@@ -64,8 +66,8 @@ export default {
     const arr = []
     menus.map(item => {
       // 防止直接选中父级造成全选
-      if (!menus.some(same => same.parentId === item.menuId)) {
-        arr.push(Number(item.menuId))
+      if (!menus.some(same => same.parentId === item.ID)) {
+        arr.push(Number(item.ID))
       }
     })
     this.menuTreeIds = arr

+ 1 - 11
web/src/view/superAdmin/menu/menu.vue

@@ -162,17 +162,7 @@ export default {
     },
     // 初始化弹窗内表格方法
     initForm() {
-      this.form = {
-        path: '',
-        name: '',
-        hidden: '',
-        parentId: '',
-        component: '',
-        meta: {
-          title: '',
-          icon: ''
-        }
-      }
+      this.$refs.menuForm.resetFields()
     },
     // 关闭弹窗
     closeDialog() {

+ 1 - 7
web/src/view/superAdmin/user/user.vue

@@ -141,13 +141,7 @@ export default {
       })
     },
     closeAddUserDialog() {
-      this.userInfo = {
-        username: '',
-        password: '',
-        nickName: '',
-        headerImg: '',
-        authorityId: ''
-      }
+      this.$refs.userForm.resetFields()
       this.addUserDialog = false
     },
     handleAvatarSuccess(res) {

+ 4 - 4
web/vue.config.js

@@ -1,7 +1,7 @@
 'use strict'
 
 const path = require('path')
-  
+
 function resolve(dir) {
     return path.join(__dirname, dir)
 }
@@ -51,10 +51,10 @@ module.exports = {
             })
             .end()
         config
-        // https://webpack.js.org/configuration/devtool/#development
+            // https://webpack.js.org/configuration/devtool/#development
             .when(process.env.NODE_ENV === 'development',
-            config => config.devtool('cheap-source-map')
-        )
+                config => config.devtool('cheap-source-map')
+            )
 
         config
             .when(process.env.NODE_ENV !== 'development',