fix :dir insert bug
This commit is contained in:
1 parent
128e34ab04
commit
5a793b9e34
5 files changed
+543
-6
No files matched your search
+10
-1
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
func GetSysFileDirList(c *gin.Context) {
|
||||
var SysFileDir models.SysFileDir
|
||||
SysFileDir.Lable = c.Request.FormValue("lable")
|
||||
SysFileDir.Label = c.Request.FormValue("label")
|
||||
SysFileDir.PId, _ = tools.StringToInt(c.Request.FormValue("pid"))
|
||||
SysFileDir.Id, _ = tools.StringToInt(c.Request.FormValue("id"))
|
||||
SysFileDir.DataScope = tools.GetUserIdStr(c)
|
||||
@@ -29,6 +29,15 @@ func GetSysFileDir(c *gin.Context) {
|
||||
app.OK(c, result, "")
|
||||
}
|
||||
|
||||
// @Summary 添加SysFileDir
|
||||
// @Description 获取JSON
|
||||
// @Tags SysFileDir
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body models.SysFileDir true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/sysfiledir [post]
|
||||
func InsertSysFileDir(c *gin.Context) {
|
||||
var data models.SysFileDir
|
||||
err := c.ShouldBindJSON(&data)
|
||||
|
||||
+199
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag at
|
||||
// 2020-07-17 22:43:59.920467 +0800 CST m=+0.161144112
|
||||
// 2020-08-23 22:49:09.111618 +0800 CST m=+0.142306844
|
||||
|
||||
package docs
|
||||
|
||||
@@ -1647,6 +1647,42 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/public/uploadFile": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"tags": [
|
||||
"公共接口"
|
||||
],
|
||||
"summary": "上传图片",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "type",
|
||||
"name": "type",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"description": "file",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/role": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1879,6 +1915,40 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/setting": {
|
||||
"get": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "查询系统信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/settings/serverInfo": {
|
||||
"get": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "系统信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 200, \"data\": [...]}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sys/tables/info": {
|
||||
"put": {
|
||||
"security": [
|
||||
@@ -2152,6 +2222,67 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sysfiledir": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"SysFileDir"
|
||||
],
|
||||
"summary": "添加SysFileDir",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.SysFileDir"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/system/setting": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "更新或提交系统信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "body",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.SysUser"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sysuser/{userId}": {
|
||||
"put": {
|
||||
"description": "获取JSON",
|
||||
@@ -2837,6 +2968,58 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysFileDir": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SysFileDir"
|
||||
}
|
||||
},
|
||||
"createBy": {
|
||||
"description": "创建人",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"dataScope": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"label": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"pId": {
|
||||
"description": "父id",
|
||||
"type": "integer"
|
||||
},
|
||||
"params": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"sort": {
|
||||
"description": "排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"updateBy": {
|
||||
"description": "编辑人",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysOperLog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3133,6 +3316,21 @@ var doc = `{
|
||||
"edit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"fkCol": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/tools.SysColumns"
|
||||
}
|
||||
},
|
||||
"fkLableId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"fkLableName": {
|
||||
"type": "string"
|
||||
},
|
||||
"fkTableName": {
|
||||
"type": "integer"
|
||||
},
|
||||
"goField": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1629,6 +1629,42 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/public/uploadFile": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"tags": [
|
||||
"公共接口"
|
||||
],
|
||||
"summary": "上传图片",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "type",
|
||||
"name": "type",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"description": "file",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/role": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1861,6 +1897,40 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/setting": {
|
||||
"get": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "查询系统信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/settings/serverInfo": {
|
||||
"get": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "系统信息",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 200, \"data\": [...]}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sys/tables/info": {
|
||||
"put": {
|
||||
"security": [
|
||||
@@ -2134,6 +2204,67 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sysfiledir": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"SysFileDir"
|
||||
],
|
||||
"summary": "添加SysFileDir",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.SysFileDir"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/system/setting": {
|
||||
"post": {
|
||||
"description": "获取JSON",
|
||||
"tags": [
|
||||
"系统信息"
|
||||
],
|
||||
"summary": "更新或提交系统信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "body",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.SysUser"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"添加失败\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/sysuser/{userId}": {
|
||||
"put": {
|
||||
"description": "获取JSON",
|
||||
@@ -2819,6 +2950,58 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysFileDir": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SysFileDir"
|
||||
}
|
||||
},
|
||||
"createBy": {
|
||||
"description": "创建人",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"dataScope": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"label": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"pId": {
|
||||
"description": "父id",
|
||||
"type": "integer"
|
||||
},
|
||||
"params": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"sort": {
|
||||
"description": "排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"updateBy": {
|
||||
"description": "编辑人",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysOperLog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3115,6 +3298,21 @@
|
||||
"edit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"fkCol": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/tools.SysColumns"
|
||||
}
|
||||
},
|
||||
"fkLableId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"fkLableName": {
|
||||
"type": "string"
|
||||
},
|
||||
"fkTableName": {
|
||||
"type": "integer"
|
||||
},
|
||||
"goField": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -287,6 +287,42 @@ definitions:
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.SysFileDir:
|
||||
properties:
|
||||
children:
|
||||
items:
|
||||
$ref: '#/definitions/models.SysFileDir'
|
||||
type: array
|
||||
createBy:
|
||||
description: 创建人
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
dataScope:
|
||||
type: string
|
||||
deletedAt:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
label:
|
||||
description: 名称
|
||||
type: string
|
||||
pId:
|
||||
description: 父id
|
||||
type: integer
|
||||
params:
|
||||
type: string
|
||||
path:
|
||||
type: string
|
||||
sort:
|
||||
description: 排序
|
||||
type: integer
|
||||
updateBy:
|
||||
description: 编辑人
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
models.SysOperLog:
|
||||
properties:
|
||||
businessType:
|
||||
@@ -496,6 +532,16 @@ definitions:
|
||||
type: string
|
||||
edit:
|
||||
type: boolean
|
||||
fkCol:
|
||||
items:
|
||||
$ref: '#/definitions/tools.SysColumns'
|
||||
type: array
|
||||
fkLableId:
|
||||
type: integer
|
||||
fkLableName:
|
||||
type: string
|
||||
fkTableName:
|
||||
type: integer
|
||||
goField:
|
||||
type: string
|
||||
goType:
|
||||
@@ -1653,6 +1699,30 @@ paths:
|
||||
summary: 获取岗位信息
|
||||
tags:
|
||||
- 岗位
|
||||
/api/v1/public/uploadFile:
|
||||
post:
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: type
|
||||
in: query
|
||||
name: type
|
||||
required: true
|
||||
type: string
|
||||
- description: file
|
||||
in: formData
|
||||
name: file
|
||||
required: true
|
||||
type: file
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": -1, "message": "添加失败"}'
|
||||
schema:
|
||||
type: string
|
||||
summary: 上传图片
|
||||
tags:
|
||||
- 公共接口
|
||||
/api/v1/role:
|
||||
get:
|
||||
description: 获取JSON
|
||||
@@ -1801,6 +1871,28 @@ paths:
|
||||
summary: 删除用户菜单数据
|
||||
tags:
|
||||
- 角色菜单
|
||||
/api/v1/setting:
|
||||
get:
|
||||
description: 获取JSON
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": -1, "message": "添加失败"}'
|
||||
schema:
|
||||
type: string
|
||||
summary: 查询系统信息
|
||||
tags:
|
||||
- 系统信息
|
||||
/api/v1/settings/serverInfo:
|
||||
get:
|
||||
description: 获取JSON
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 200, "data": [...]}'
|
||||
schema:
|
||||
$ref: '#/definitions/app.Response'
|
||||
summary: 系统信息
|
||||
tags:
|
||||
- 系统信息
|
||||
/api/v1/sys/tables/info:
|
||||
post:
|
||||
consumes:
|
||||
@@ -1972,6 +2064,46 @@ paths:
|
||||
summary: 列表用户信息数据
|
||||
tags:
|
||||
- 用户
|
||||
/api/v1/sysfiledir:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: data
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.SysFileDir'
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": -1, "message": "添加失败"}'
|
||||
schema:
|
||||
type: string
|
||||
summary: 添加SysFileDir
|
||||
tags:
|
||||
- SysFileDir
|
||||
/api/v1/system/setting:
|
||||
post:
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: body
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.SysUser'
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": -1, "message": "添加失败"}'
|
||||
schema:
|
||||
type: string
|
||||
summary: 更新或提交系统信息
|
||||
tags:
|
||||
- 系统信息
|
||||
/api/v1/sysuser/{userId}:
|
||||
delete:
|
||||
description: 删除数据
|
||||
|
||||
+4
-4
@@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
type SysFileDir struct {
|
||||
Id int `json:"id" gorm:"type:int(11);primary_key"` //
|
||||
Lable string `json:"lable" gorm:"type:varchar(255);"` // 名称
|
||||
Id int `json:"id" gorm:"type:int(11);primary_key;AUTO_INCREMENT"` //
|
||||
Label string `json:"label" gorm:"type:varchar(255);"` // 名称
|
||||
PId int `json:"pId" gorm:"type:int(11);"` // 父id
|
||||
Sort int `json:"sort" gorm:""` //排序
|
||||
Path string `json:"path" gorm:"size:255;"` //
|
||||
@@ -42,7 +42,7 @@ func (e *SysFileDir) Create() (SysFileDir, error) {
|
||||
path = "/0" + path
|
||||
}
|
||||
var mp = map[string]string{}
|
||||
mp["deptPath"] = path
|
||||
mp["path"] = path
|
||||
if err := orm.Eloquent.Table(e.TableName()).Where("id = ?", e.Id).Update(mp).Error; err != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
@@ -164,7 +164,7 @@ func SysFileDirDigui(deptlist *[]SysFileDir, menu SysFileDir) SysFileDir {
|
||||
mi := SysFileDir{}
|
||||
mi.Id = list[j].Id
|
||||
mi.PId = list[j].PId
|
||||
mi.Lable = list[j].Lable
|
||||
mi.Label = list[j].Label
|
||||
mi.Sort = list[j].Sort
|
||||
mi.CreatedAt = list[j].CreatedAt
|
||||
mi.UpdatedAt = list[j].UpdatedAt
|
||||
|
||||
Reference in new issue
Block a user