diff --git a/app/cms/models/sys_category.go b/app/cms/models/sys_category.go deleted file mode 100644 index 76f3c9b8..00000000 --- a/app/cms/models/sys_category.go +++ /dev/null @@ -1,29 +0,0 @@ -package models - -import ( - "go-admin/common/models" -) - -type SysCategory struct { - models.Model - Name string `json:"name" gorm:"size:255;comment:名称"` // - Img string `json:"img" gorm:"size:255;comment:图标"` // - Sort int `json:"sort" gorm:"size:4;comment:排序"` // - Status int `json:"status" gorm:"size:1;comment:状态"` // - Remark string `json:"remark" gorm:"size:255;comment:备注"` // - models.ControlBy - models.ModelTime -} - -func (SysCategory) TableName() string { - return "sys_category" -} - -func (e *SysCategory) Generate() models.ActiveRecord { - o := *e - return &o -} - -func (e *SysCategory) GetId() interface{} { - return e.Id -} diff --git a/app/cms/models/sys_content.go b/app/cms/models/sys_content.go deleted file mode 100644 index 99922cb2..00000000 --- a/app/cms/models/sys_content.go +++ /dev/null @@ -1,33 +0,0 @@ -package models - -import ( - "go-admin/common/models" -) - -type SysContent struct { - models.Model - CateId int `json:"cateId" gorm:"size:11;comment:分类id"` - Name string `json:"name" gorm:"size:255;comment:名称"` - Status int `json:"status" gorm:"size:1;comment:状态"` - Img string `json:"img" gorm:"size:255;comment:图片"` - Content string `json:"content" gorm:"type:text;comment:内容"` - Remark string `json:"remark" gorm:"size:255;comment:备注"` - Sort int `json:"sort" gorm:"size:4;comment:排序"` - models.ControlBy - models.ModelTime -} - -// TableName -func (SysContent) TableName() string { - return "sys_content" -} - -// Generate -func (e *SysContent) Generate() models.ActiveRecord { - o := *e - return &o -} - -func (e *SysContent) GetId() interface{} { - return e.Id -} diff --git a/app/cms/router/init_router.go b/app/cms/router/init_router.go deleted file mode 100644 index 783669a3..00000000 --- a/app/cms/router/init_router.go +++ /dev/null @@ -1,36 +0,0 @@ -package router - -import ( - _ "github.com/go-admin-team/go-admin-core/sdk/pkg" - "os" - - "github.com/gin-gonic/gin" - log "github.com/go-admin-team/go-admin-core/logger" - "github.com/go-admin-team/go-admin-core/sdk" - common "go-admin/common/middleware" -) - -// InitRouter 路由初始化,不要怀疑,这里用到了 -func InitRouter() { - var r *gin.Engine - h := sdk.Runtime.GetEngine() - if h == nil { - log.Fatal("not found engine...") - os.Exit(-1) - } - switch h.(type) { - case *gin.Engine: - r = h.(*gin.Engine) - default: - log.Fatal("not support other engine") - os.Exit(-1) - } - // the jwt middleware - authMiddleware, err := common.AuthInit() - if err != nil { - log.Fatalf("JWT Init Error, %s", err.Error()) - } - - // 注册业务路由 - initRouter(r, authMiddleware) -} diff --git a/app/cms/router/router.go b/app/cms/router/router.go deleted file mode 100644 index 8c893a27..00000000 --- a/app/cms/router/router.go +++ /dev/null @@ -1,42 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" -) - -var ( - routerNoCheckRole = make([]func(*gin.RouterGroup), 0) - routerCheckRole = make([]func(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware), 0) -) - -// initRouter 路由示例 -func initRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine { - - // 无需认证的路由 - noCheckRoleRouter(r) - // 需要认证的路由 - checkRoleRouter(r, authMiddleware) - - return r -} - -// noCheckRoleRouter 无需认证的路由示例 -func noCheckRoleRouter(r *gin.Engine) { - // 可根据业务需求来设置接口版本 - v1 := r.Group("/api/v1") - - for _, f := range routerNoCheckRole { - f(v1) - } -} - -// checkRoleRouter 需要认证的路由示例 -func checkRoleRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) { - // 可根据业务需求来设置接口版本 - v1 := r.Group("/api/v1") - - for _, f := range routerCheckRole { - f(v1, authMiddleware) - } -} diff --git a/app/cms/router/sys_category.go b/app/cms/router/sys_category.go deleted file mode 100644 index 7cb4280f..00000000 --- a/app/cms/router/sys_category.go +++ /dev/null @@ -1,31 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - "go-admin/app/cms/models" - "go-admin/app/cms/service/dto" - "go-admin/common/middleware" - - jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" - "go-admin/common/actions" -) - -func init() { - routerCheckRole = append(routerCheckRole, registerSysCategoryRouter) -} - -// 需认证的路由代码 -func registerSysCategoryRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - r := v1.Group("/syscategory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - model := &models.SysCategory{} - r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysCategorySearch), func() interface{} { - list := make([]models.SysCategory, 0) - return &list - })) - r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysCategoryById), nil)) - r.POST("", actions.CreateAction(new(dto.SysCategoryControl))) - r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysCategoryControl))) - r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysCategoryById))) - } -} diff --git a/app/cms/router/sys_content.go b/app/cms/router/sys_content.go deleted file mode 100644 index aac6da29..00000000 --- a/app/cms/router/sys_content.go +++ /dev/null @@ -1,31 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" - "go-admin/app/cms/models" - "go-admin/app/cms/service/dto" - "go-admin/common/actions" - "go-admin/common/middleware" -) - -func init() { - routerCheckRole = append(routerCheckRole, registerSysContentRouter) -} - -// 需认证的路由代码 -func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - - r := v1.Group("/syscontent").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - model := &models.SysContent{} - r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysContentSearch), func() interface{} { - list := make([]models.SysContent, 0) - return &list - })) - r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysContentById), nil)) - r.POST("", actions.CreateAction(new(dto.SysContentControl))) - r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysContentControl))) - r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysContentById))) - } -} diff --git a/app/cms/service/dto/sys_category.go b/app/cms/service/dto/sys_category.go deleted file mode 100644 index aad12559..00000000 --- a/app/cms/service/dto/sys_category.go +++ /dev/null @@ -1,96 +0,0 @@ -package dto - -import ( - "errors" - "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/sdk/api" - "go-admin/app/cms/models" - - "go-admin/common/dto" - common "go-admin/common/models" -) - -type SysCategorySearch struct { - dto.Pagination `search:"-"` - Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"` - Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"` - CateId int `form:"cateId" search:"type:exact;column:cate_id;table:sys_category" comment:"分类id"` -} - -func (m *SysCategorySearch) GetNeedSearch() interface{} { - return *m -} - -func (m *SysCategorySearch) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - - return err -} - -func (m *SysCategorySearch) Generate() dto.Index { - o := *m - return &o -} - -type SysCategoryControl struct { - Id int `uri:"Id" comment:"标识"` - Name string `json:"name" comment:"名称"` - Img string `json:"img" comment:"图标"` - Sort int `json:"sort" comment:"排序"` - Status int `json:"status" comment:"状态"` - Remark string `json:"remark" comment:"备注"` -} - -func (s *SysCategoryControl) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Errorf("ShouldBindUri error: %s", err.Error()) - return errors.New("数据绑定出错") - } - err = ctx.ShouldBind(s) - if err != nil { - log.Errorf("ShouldBind error: %s", err.Error()) - err = errors.New("数据绑定出错") - } - - return err -} - -func (s *SysCategoryControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) { - return &models.SysCategory{ - Model: common.Model{Id: s.Id}, - Name: s.Name, - Img: s.Img, - Sort: s.Sort, - Status: s.Status, - Remark: s.Remark, - }, nil -} - -func (s *SysCategoryControl) GetId() interface{} { - return s.Id -} - -type SysCategoryById struct { - dto.ObjectById -} - -func (s *SysCategoryById) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysCategoryById) GenerateM() (common.ActiveRecord, error) { - return &models.SysCategory{}, nil -} diff --git a/app/cms/service/dto/sys_content.go b/app/cms/service/dto/sys_content.go deleted file mode 100644 index c96632f8..00000000 --- a/app/cms/service/dto/sys_content.go +++ /dev/null @@ -1,95 +0,0 @@ -package dto - -import ( - "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/sdk/api" - "go-admin/app/cms/models" - - "go-admin/common/dto" - common "go-admin/common/models" -) - -type SysContentSearch struct { - dto.Pagination `search:"-"` - CateId string `form:"cateId" search:"type:exact;column:cate_id;table:sys_content" comment:"分类"` - Name string `form:"name" search:"type:contains;column:name;table:sys_content" comment:"名称"` - Status string `form:"status" search:"type:exact;column:status;table:sys_content" comment:"状态"` -} - -func (m *SysContentSearch) GetNeedSearch() interface{} { - return *m -} - -func (m *SysContentSearch) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (m *SysContentSearch) Generate() dto.Index { - o := *m - return &o -} - -type SysContentControl struct { - Id int `uri:"Id" comment:""` // - CateId int `json:"cateId" comment:""` - Name string `json:"name" comment:""` - Status int `json:"status" comment:""` - Img string `json:"img" comment:""` - Content string `json:"content" comment:""` - Remark string `json:"remark" comment:""` - Sort int `json:"sort" comment:""` -} - -func (s *SysContentControl) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("ShouldBindUri error: %s", err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (s *SysContentControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysContentControl) GenerateM() (common.ActiveRecord, error) { - return &models.SysContent{ - Model: common.Model{s.Id}, - CateId: s.CateId, - Name: s.Name, - Status: s.Status, - Img: s.Img, - Content: s.Content, - Remark: s.Remark, - Sort: s.Sort, - }, nil -} - -func (s *SysContentControl) GetId() interface{} { - return s.Id -} - -type SysContentById struct { - dto.ObjectById -} - -func (s *SysContentById) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysContentById) GenerateM() (common.ActiveRecord, error) { - return &models.SysContent{}, nil -} diff --git a/app/other/apis/sys_area_data.go b/app/other/apis/sys_area_data.go deleted file mode 100644 index 6180fa9f..00000000 --- a/app/other/apis/sys_area_data.go +++ /dev/null @@ -1,178 +0,0 @@ -package apis - -import ( - "github.com/gin-gonic/gin/binding" - "go-admin/app/other/models" - "go-admin/app/other/service" - "go-admin/app/other/service/dto" - "net/http" - - "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/jwtauth/user" - - "go-admin/common/actions" -) - -type SysAreaData struct { - api.Api -} - -func (e SysAreaData) GetPage(c *gin.Context) { - s := service.SysAreaData{} - req := dto.SysAreaDataSearch{} - err := e.MakeContext(c). - MakeOrm(). - Bind(&req, binding.Form). - MakeService(&s.Service). - Errors - if err != nil { - e.Logger.Error(err) - e.Error(500, err, err.Error()) - return - } - - list := make([]models.SysAreaData, 0) - err = s.GetPage(&req, &list).Error - if err != nil { - e.Logger.Error(err) - e.Error(http.StatusInternalServerError, err, "查询失败") - return - } - - e.OK(list, "查询成功") -} - -func (e SysAreaData) Get(c *gin.Context) { - s := service.SysAreaData{} - req := dto.SysAreaDataById{} - err := e.MakeContext(c). - MakeOrm(). - Bind(&req, nil). - MakeService(&s.Service). - Errors - if err != nil { - e.Logger.Error(err) - e.Error(500, err, err.Error()) - return - } - var object models.SysAreaData - p := actions.GetPermissionFromContext(c) - err = s.Get(&req, p, &object) - if err != nil { - e.Error(http.StatusUnprocessableEntity, err, "查询失败") - return - } - - e.OK(object, "查询成功") -} - -func (e SysAreaData) Insert(c *gin.Context) { - e.MakeContext(c) - log := e.GetLogger() - control := new(dto.SysAreaDataControl) - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //新增操作 - err = control.Bind(c) - if err != nil { - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - object, err := control.Generate() - if err != nil { - e.Error(http.StatusInternalServerError, err, "模型生成失败") - return - } - // 设置创建人 - object.SetCreateBy(user.GetUserId(c)) - - serviceSysAreaData := service.SysAreaData{} - serviceSysAreaData.Orm = db - serviceSysAreaData.Log = log - err = serviceSysAreaData.Insert(object) - if err != nil { - log.Error(err) - e.Error(http.StatusInternalServerError, err, "创建失败") - return - } - - e.OK(object.GetId(), "创建成功") -} - -func (e SysAreaData) Update(c *gin.Context) { - e.MakeContext(c) - log := e.GetLogger() - control := new(dto.SysAreaDataControl) - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //更新操作 - err = control.Bind(c) - if err != nil { - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - object, err := control.Generate() - if err != nil { - e.Error(http.StatusInternalServerError, err, "模型生成失败") - return - } - object.SetUpdateBy(user.GetUserId(c)) - - //数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysAreaData := service.SysAreaData{} - serviceSysAreaData.Orm = db - serviceSysAreaData.Log = log - err = serviceSysAreaData.Update(object, p) - if err != nil { - log.Error(err) - return - } - e.OK(object.GetId(), "更新成功") -} - -func (e SysAreaData) Delete(c *gin.Context) { - e.MakeContext(c) - log := e.GetLogger() - control := new(dto.SysAreaDataById) - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //删除操作 - err = control.Bind(c) - if err != nil { - log.Errorf("Bind error: %s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - - // 设置编辑人 - control.SetUpdateBy(user.GetUserId(c)) - - // 数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysAreaData := service.SysAreaData{} - serviceSysAreaData.Orm = db - serviceSysAreaData.Log = log - err = serviceSysAreaData.Remove(control, p) - if err != nil { - log.Errorf("RemoveSysAreaData error, %s", err) - e.Error(http.StatusInternalServerError, err, "删除失败") - return - } - e.OK(control.GetId(), "删除成功") -} diff --git a/app/other/apis/sys_file_dir.go b/app/other/apis/sys_file_dir.go deleted file mode 100644 index 64358bf1..00000000 --- a/app/other/apis/sys_file_dir.go +++ /dev/null @@ -1,198 +0,0 @@ -package apis - -import ( - "net/http" - - "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/jwtauth/user" - - "go-admin/app/other/models" - "go-admin/app/other/service" - "go-admin/app/other/service/dto" - "go-admin/common/actions" -) - -type SysFileDir struct { - api.Api -} - -func (e SysFileDir) GetPage(c *gin.Context) { - e.Context = c - log := e.GetLogger() - search := new(dto.SysFileDirSearch) - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - err = c.ShouldBind(search) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - - var list *[]models.SysFileDir - serviceStudent := service.SysFileDir{} - serviceStudent.Log = log - serviceStudent.Orm = db - list, err = serviceStudent.SetSysFileDir(search) - if err != nil { - log.Errorf("SetSysFileDir error, %s", err) - e.Error(http.StatusUnprocessableEntity, err, "查询失败") - return - } - - e.OK(list, "查询成功") -} - -func (e SysFileDir) Get(c *gin.Context) { - control := new(dto.SysFileDirById) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //查看详情 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("ShouldBindUri error: %s", err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - } - - var object models.SysFileDir - - serviceSysFileDir := service.SysFileDir{} - serviceSysFileDir.Log = log - serviceSysFileDir.Orm = db - err = serviceSysFileDir.GetSysFileDir(control, &object) - if err != nil { - log.Errorf("GetSysFileDir error, %s", err) - e.Error(http.StatusInternalServerError, err, "查询失败") - return - } - - e.OK(object, "查询成功") -} - -func (e SysFileDir) Insert(c *gin.Context) { - control := new(dto.SysFileDirControl) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //新增操作 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("ShouldBindUri error: %s", err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("ShouldBind error: %s", err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - // 设置创建人 - control.CreateBy = user.GetUserId(c) - - serviceSysFileDir := service.SysFileDir{} - serviceSysFileDir.Orm = db - serviceSysFileDir.Log = log - err = serviceSysFileDir.InsertSysFileDir(control) - if err != nil { - log.Errorf("InsertSysFileDir error, %s", err) - e.Error(http.StatusInternalServerError, err, "创建失败") - return - } - - e.OK(control.Id, "创建成功") -} - -func (e SysFileDir) Update(c *gin.Context) { - control := new(dto.SysFileDirControl) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("ShouldBindUri error: %s", err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("ShouldBind error: %#v", err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - } - // 设置创建人 - control.UpdateBy = user.GetUserId(c) - - //数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysFileDir := service.SysFileDir{} - serviceSysFileDir.Orm = db - serviceSysFileDir.Log = log - err = serviceSysFileDir.Update(control, p) - if err != nil { - log.Errorf("UpdateSysFileDir error, %s", err) - e.Error(http.StatusInternalServerError, err, "更新失败") - return - } - e.OK(control.Id, "更新成功") -} - -func (e SysFileDir) Delete(c *gin.Context) { - control := new(dto.SysFileDirById) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - msgID := pkg.GenerateMsgIDFromContext(c) - //删除操作 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - } - - // 设置编辑人 - control.UpdateBy = user.GetUserId(c) - - // 数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysFileDir := service.SysFileDir{} - serviceSysFileDir.Orm = db - serviceSysFileDir.MsgID = msgID - err = serviceSysFileDir.RemoveSysFileDir(control, p) - if err != nil { - log.Errorf("RemoveSysFileDir error, %s", err) - e.Error(http.StatusInternalServerError, err, "删除失败") - return - } - e.OK(control.Id, "删除成功") -} diff --git a/app/other/apis/sys_file_info.go b/app/other/apis/sys_file_info.go deleted file mode 100644 index 68d9a711..00000000 --- a/app/other/apis/sys_file_info.go +++ /dev/null @@ -1,209 +0,0 @@ -package apis - -import ( - models2 "go-admin/app/other/models" - service2 "go-admin/app/other/service" - dto2 "go-admin/app/other/service/dto" - "net/http" - - "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/jwtauth/user" - - "go-admin/common/actions" -) - -type SysFileInfo struct { - api.Api -} - -func (e SysFileInfo) GetPage(c *gin.Context) { - e.Context = c - log := e.GetLogger() - search := new(dto2.SysFileInfoSearch) - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - err = c.ShouldBind(search) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - - //数据权限检查 - p := actions.GetPermissionFromContext(c) - - list := make([]models2.SysFileInfo, 0) - var count int64 - serviceStudent := service2.SysFileInfo{} - serviceStudent.Log = log - serviceStudent.Orm = db - err = serviceStudent.GetSysFileInfoPage(search, p, &list, &count) - if err != nil { - log.Errorf("GetSysFileInfoPage error, %s", err.Error()) - e.Error(http.StatusInternalServerError, err, "查询失败") - return - } - - e.PageOK(list, int(count), search.PageIndex, search.PageSize, "查询成功") -} - -func (e SysFileInfo) Get(c *gin.Context) { - control := new(dto2.SysFileInfoById) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //查看详情 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("参数验证错误, error:%s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - - var object models2.SysFileInfo - - //数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysFileInfo := service2.SysFileInfo{} - serviceSysFileInfo.Log = log - serviceSysFileInfo.Orm = db - err = serviceSysFileInfo.GetSysFileInfo(control, p, &object) - if err != nil { - log.Errorf("GetSysFileInfo error, %s", err.Error()) - e.Error(http.StatusInternalServerError, err, "查询失败") - return - } - - e.OK(object, "查询成功") -} - -func (e SysFileInfo) Insert(c *gin.Context) { - control := new(dto2.SysFileInfoControl) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //新增操作 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - // 设置创建人 - control.CreateBy = user.GetUserId(c) - - serviceSysFileInfo := service2.SysFileInfo{} - serviceSysFileInfo.Orm = db - serviceSysFileInfo.Log = log - err = serviceSysFileInfo.InsertSysFileInfo(control) - if err != nil { - log.Errorf("InsertSysFileInfo error: %s", err) - e.Error(http.StatusInternalServerError, err, "创建失败") - return - } - - e.OK(control.Id, "创建成功") -} - -func (e SysFileInfo) Update(c *gin.Context) { - control := new(dto2.SysFileInfoControl) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("参数验证错误, error:%s", err) - e.Error(http.StatusUnprocessableEntity, err, "参数验证失败") - return - } - // 设置创建人 - control.UpdateBy = user.GetUserId(c) - - //数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysFileInfo := service2.SysFileInfo{} - serviceSysFileInfo.Orm = db - serviceSysFileInfo.Log = log - err = serviceSysFileInfo.UpdateSysFileInfo(control, p) - if err != nil { - log.Errorf("UpdateSysFileInfo error: %s", err) - e.Error(http.StatusInternalServerError, err, "创建失败") - return - } - e.OK(control.Id, "更新成功") -} - -func (e SysFileInfo) Delete(c *gin.Context) { - control := new(dto2.SysFileInfoById) - e.Context = c - log := e.GetLogger() - db, err := e.GetOrm() - if err != nil { - log.Error(err) - return - } - - //删除操作 - err = c.ShouldBindUri(control) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(422, err, "参数验证失败") - return - } - err = c.ShouldBind(control) - if err != nil { - log.Warnf("参数验证错误, error: %s", err) - e.Error(422, err, "参数验证失败") - return - } - - // 设置编辑人 - control.UpdateBy = user.GetUserId(c) - - // 数据权限检查 - p := actions.GetPermissionFromContext(c) - - serviceSysFileInfo := service2.SysFileInfo{} - serviceSysFileInfo.Orm = db - serviceSysFileInfo.Log = log - err = serviceSysFileInfo.RemoveSysFileInfo(control, p) - if err != nil { - log.Errorf("RemoveSysFileInfo error: %s", err) - e.Error(http.StatusInternalServerError, err, "创建失败") - return - } - e.OK(control.Id, "删除成功") -} diff --git a/app/other/models/sys_area_data.go b/app/other/models/sys_area_data.go deleted file mode 100644 index d1832586..00000000 --- a/app/other/models/sys_area_data.go +++ /dev/null @@ -1,27 +0,0 @@ -package models - -import ( - "go-admin/common/models" -) - -type SysAreaData struct { - Id int `json:"id" gorm:"primaryKey;comment:主键编码"` - PId int `json:"pId" gorm:"size:11;comment:上级编码"` - Name string `json:"name" gorm:"size:128;comment:名称"` - Children []SysAreaData `json:"children,omitempty" gorm:"-"` - models.ControlBy - models.ModelTime -} - -func (SysAreaData) TableName() string { - return "sys_china_area_data" -} - -func (e *SysAreaData) Generate() models.ActiveRecord { - o := *e - return &o -} - -func (e *SysAreaData) GetId() interface{} { - return e.Id -} diff --git a/app/other/models/sys_file_dir.go b/app/other/models/sys_file_dir.go deleted file mode 100644 index b8ea46ee..00000000 --- a/app/other/models/sys_file_dir.go +++ /dev/null @@ -1,40 +0,0 @@ -package models - -import ( - "go-admin/common/models" -) - -type SysFileDir struct { - models.Model - Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId int `json:"p_id" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 - Children []SysFileDir `json:"children,omitempty" gorm:"-"` // 下级信息 - models.ControlBy - models.ModelTime -} - -//type SysFileDirL struct { -// models.Model -// Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 -// PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 -// Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 -// Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 -// models.ControlBy -// models.ModelTime -// Children []SysFileDirL `json:"children,omitempty" gorm:"-"` // 下级信息 -//} - -func (SysFileDir) TableName() string { /**/ - return "sys_file_dir" -} - -func (e *SysFileDir) Generate() models.ActiveRecord { - o := *e - return &o -} - -func (e *SysFileDir) GetId() interface{} { - return e.Id -} diff --git a/app/other/models/sys_file_info.go b/app/other/models/sys_file_info.go deleted file mode 100644 index c3cceccb..00000000 --- a/app/other/models/sys_file_info.go +++ /dev/null @@ -1,31 +0,0 @@ -package models - -import ( - "go-admin/common/models" -) - -type SysFileInfo struct { - models.Model - Type string `json:"type" gorm:"size:255;comment:类型"` // - Name string `json:"name" gorm:"size:255;comment:名称"` // - Size string `json:"size" gorm:"size:11;comment:大小"` // - PId int `json:"p_id" gorm:"size:11;comment:目录"` // - Source string `json:"source" gorm:"size:255;comment:来源"` // - Url string `json:"url" gorm:"size:255;comment:地址"` // - FullUrl string `json:"full_url" gorm:"size:255;comment:全地址"` // - models.ControlBy - models.ModelTime -} - -func (SysFileInfo) TableName() string { - return "sys_file_info" -} - -func (e *SysFileInfo) Generate() models.ActiveRecord { - o := *e - return &o -} - -func (e *SysFileInfo) GetId() interface{} { - return e.Id -} diff --git a/app/other/router/sys_area_data.go b/app/other/router/sys_area_data.go deleted file mode 100644 index 24de8ed9..00000000 --- a/app/other/router/sys_area_data.go +++ /dev/null @@ -1,25 +0,0 @@ -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" - "go-admin/common/middleware" -) - -func init() { - routerCheckRole = append(routerCheckRole, registerSysAreaDataRouter) -} - -// 需认证的路由代码 -func registerSysAreaDataRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - api := apis.SysAreaData{} - r := v1.Group("/sys-area-data").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - r.GET("", api.GetPage) - r.GET("/:id", api.Get) - r.POST("", api.Insert) - r.PUT("/:id", api.Update) - r.DELETE("", api.Delete) - } -} diff --git a/app/other/router/sys_file_dir.go b/app/other/router/sys_file_dir.go deleted file mode 100644 index a1cc4c83..00000000 --- a/app/other/router/sys_file_dir.go +++ /dev/null @@ -1,25 +0,0 @@ -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" - "go-admin/common/middleware" -) - -func init() { - routerCheckRole = append(routerCheckRole, registerSysFileDirRouter) -} - -// 需认证的路由代码 -func registerSysFileDirRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - api := apis.SysFileDir{} - r := v1.Group("/file-dir").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - r.GET("", api.GetPage) - r.GET("/:id", api.Get) - r.POST("", api.Insert) - r.PUT("/:id", api.Update) - r.DELETE("/:id", api.Delete) - } -} diff --git a/app/other/router/sys_file_info.go b/app/other/router/sys_file_info.go deleted file mode 100644 index f59e2e6e..00000000 --- a/app/other/router/sys_file_info.go +++ /dev/null @@ -1,25 +0,0 @@ -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" - "go-admin/common/middleware" -) - -func init() { - routerCheckRole = append(routerCheckRole, registerSysFileInfoRouter) -} - -// 需认证的路由代码 -func registerSysFileInfoRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - api := apis.SysFileInfo{} - r := v1.Group("/file-info").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - r.GET("", api.GetPage) - r.GET("/:id", api.Get) - r.POST("", api.Insert) - r.PUT("/:id", api.Update) - r.DELETE("/:id", api.Delete) - } -} diff --git a/app/other/service/dto/sys_area_data.go b/app/other/service/dto/sys_area_data.go deleted file mode 100644 index 5388926a..00000000 --- a/app/other/service/dto/sys_area_data.go +++ /dev/null @@ -1,96 +0,0 @@ -package dto - -import ( - "go-admin/app/other/models" - "time" - - "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/sdk/api" - - "go-admin/common/dto" -) - -type SysAreaDataSearch struct { - dto.Pagination `search:"-"` - PId string `form:"pId" search:"type:exact;column:p_id;table:sys_china_area_data" comment:"上级编码"` - Name string `form:"name" search:"type:exact;column:name;table:sys_china_area_data" comment:"名称"` -} - -func (m *SysAreaDataSearch) GetNeedSearch() interface{} { - return *m -} - -func (m *SysAreaDataSearch) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -type SysAreaDataControl struct { - Id int `uri:"id" comment:"编码"` // 编码 - PId int `json:"pId" comment:"上级编码"` - Name string `json:"name" comment:"名称"` - CreateTime time.Time `json:"createTime" comment:""` - UpdateTime time.Time `json:"updateTime" comment:""` - DeleteTime time.Time `json:"deleteTime" comment:""` -} - -func (s *SysAreaDataControl) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("ShouldBindUri error: %s", err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (s *SysAreaDataControl) Generate() (*models.SysAreaData, error) { - return &models.SysAreaData{ - Id: s.Id, - PId: s.PId, - Name: s.Name, - }, nil -} - -func (s *SysAreaDataControl) GetId() interface{} { - return s.Id -} - -type SysAreaDataById struct { - Id int `uri:"id"` - Ids []int `json:"ids"` -} - -func (s *SysAreaDataById) GetId() interface{} { - if len(s.Ids) > 0 { - s.Ids = append(s.Ids, s.Id) - return s.Ids - } - return s.Id -} - -func (s *SysAreaDataById) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("ShouldBindUri error: %s", err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (s *SysAreaDataById) SetUpdateBy(id int) { - -} diff --git a/app/other/service/dto/sys_file_dir.go b/app/other/service/dto/sys_file_dir.go deleted file mode 100644 index dab253ba..00000000 --- a/app/other/service/dto/sys_file_dir.go +++ /dev/null @@ -1,99 +0,0 @@ -package dto - -import ( - "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/sdk/api" - "go-admin/app/other/models" - - "go-admin/common/dto" - common "go-admin/common/models" -) - -type SysFileDirSearch struct { - dto.Pagination `search:"-"` - - ID int `form:"Id" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"` - Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"` - PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"` - //Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"` - Path string `form:"path" search:"type:exact;column:path;table:sys_file_dir" comment:"路径"` -} - -func (m *SysFileDirSearch) GetNeedSearch() interface{} { - return *m -} - -func (m *SysFileDirSearch) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (m *SysFileDirSearch) Generate() dto.Index { - o := *m - return &o -} - -type SysFileDirControl struct { - Id int `uri:"Id" comment:"标识"` // 标识 - Label string `json:"label" comment:"目录名称"` - PId int `json:"pId" comment:"上级目录"` - Sort string `json:"sort" comment:"排序"` - Path string `json:"path" comment:"路径"` - CreateBy int `json:"-"` - UpdateBy int `json:"-"` -} - -func (s *SysFileDirControl) Bind(ctx *gin.Context) error { - log := api.GetRequestLogger(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("ShouldBindUri error: %s", err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("ShouldBind error: %s", err.Error()) - } - return err -} - -func (s *SysFileDirControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) { - return &models.SysFileDir{ - Model: common.Model{Id: s.Id}, - Label: s.Label, - PId: s.PId, - //Sort: s.Sort, - Path: s.Path, - ControlBy: common.ControlBy{ - CreateBy: s.CreateBy, - UpdateBy: s.UpdateBy, - }, - }, nil -} - -func (s *SysFileDirControl) GetId() interface{} { - return s.Id -} - -type SysFileDirById struct { - dto.ObjectById - UpdateBy int `json:"-"` -} - -func (s *SysFileDirById) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysFileDirById) GenerateM() (common.ActiveRecord, error) { - return &models.SysFileDir{}, nil -} diff --git a/app/other/service/dto/sys_file_info.go b/app/other/service/dto/sys_file_info.go deleted file mode 100644 index 955555a9..00000000 --- a/app/other/service/dto/sys_file_info.go +++ /dev/null @@ -1,52 +0,0 @@ -package dto - -import ( - "go-admin/app/other/models" - "go-admin/common/dto" - common "go-admin/common/models" -) - -type SysFileInfoSearch struct { - dto.Pagination `search:"-"` - ID int `form:"Id" search:"type:exact;column:id;table:sys_file_info" comment:"标识"` - Type string `form:"type" search:"type:exact;column:type;table:sys_file_info" comment:"类型"` - Name string `form:"name" search:"type:exact;column:name;table:sys_file_info" comment:"名称"` - PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_info" comment:"目录"` - Source string `form:"source" search:"type:exact;column:source;table:sys_file_info" comment:"来源"` -} - -func (m *SysFileInfoSearch) GetNeedSearch() interface{} { - return *m -} - -type SysFileInfoControl struct { - Id int `uri:"id" comment:"标识"` // 标识 - Type string `json:"type" comment:"类型"` - Name string `json:"name" comment:"名称"` - Size string `json:"size" comment:"大小"` - PId int `json:"pId" comment:"目录"` - Source string `json:"source" comment:"来源"` - Url string `json:"url" comment:"地址"` - FullUrl string `json:"fullUrl" comment:"全地址"` - CreateBy int `json:"-"` - UpdateBy int `json:"-"` -} - -func (s *SysFileInfoControl) Generate() (*models.SysFileInfo, error) { - return &models.SysFileInfo{ - Model: common.Model{Id: s.Id}, - Type: s.Type, - Name: s.Name, - Size: s.Size, - PId: s.PId, - Source: s.Source, - Url: s.Url, - FullUrl: s.FullUrl, - ControlBy: common.ControlBy{CreateBy: s.CreateBy, UpdateBy: s.UpdateBy}, - }, nil -} - -type SysFileInfoById struct { - dto.ObjectById - UpdateBy int `json:"-"` -} diff --git a/app/other/service/sys_area_data.go b/app/other/service/sys_area_data.go deleted file mode 100644 index 95e0a988..00000000 --- a/app/other/service/sys_area_data.go +++ /dev/null @@ -1,129 +0,0 @@ -package service - -import ( - "errors" - - "github.com/go-admin-team/go-admin-core/sdk/service" - "gorm.io/gorm" - - "go-admin/app/other/models" - "go-admin/app/other/service/dto" - "go-admin/common/actions" - cDto "go-admin/common/dto" -) - -type SysAreaData struct { - service.Service -} - -// GetPage 获取SysAreaData列表 -func (e *SysAreaData) GetPage(c *dto.SysAreaDataSearch, list *[]models.SysAreaData) *SysAreaData { - var data models.SysAreaData - var areaDataList []models.SysAreaData - err := e.Orm.Model(&data). - Scopes( - cDto.MakeCondition(c.GetNeedSearch()), - ). - Find(&areaDataList).Error - if err != nil { - e.Log.Errorf("Service GetSysAreaDataPage error:%s", err) - _ = e.AddError(err) - return e - } - for i := 0; i < len(areaDataList); i++ { - if areaDataList[i].PId != 86 { - continue - } - menusInfo := areaDataCall(&areaDataList, areaDataList[i]) - *list = append(*list, menusInfo) - } - return e -} - -// areaDataCall 构建树 -func areaDataCall(areaDataList *[]models.SysAreaData, areaData models.SysAreaData) models.SysAreaData { - list := *areaDataList - - min := make([]models.SysAreaData, 0) - for j := 0; j < len(list); j++ { - if areaData.Id != list[j].PId { - continue - } - mi := models.SysAreaData{} - mi = list[j] - mi.Children = []models.SysAreaData{} - ms := areaDataCall(areaDataList, mi) - min = append(min, ms) - } - areaData.Children = min - return areaData -} - -// Get 获取SysAreaData对象 -func (e *SysAreaData) Get(d *dto.SysAreaDataById, p *actions.DataPermission, model *models.SysAreaData) error { - var data models.SysAreaData - - err := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ). - First(model, d.GetId()).Error - if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { - err = errors.New("查看对象不存在或无权查看") - e.Log.Errorf("db error:%s", err) - return err - } - if err != nil { - e.Log.Errorf("Service GetSysAreaData error:%s", err) - return err - } - return nil -} - -// Insert 创建SysAreaData对象 -func (e *SysAreaData) Insert(model *models.SysAreaData) error { - var data models.SysAreaData - - err := e.Orm.Model(&data). - Create(model).Error - if err != nil { - e.Log.Errorf("Service InsertSysAreaData error:%s", err) - return err - } - return nil -} - -// Update 修改SysAreaData对象 -func (e *SysAreaData) Update(c *models.SysAreaData, p *actions.DataPermission) error { - db := e.Orm.Model(&models.SysAreaData{ - Id: c.GetId().(int), - }). - Scopes( - actions.Permission(c.TableName(), p), - ).Updates(c) - if err := db.Error; err != nil { - e.Log.Errorf("Service UpdateSysAreaData error: %s", err) - return err - } - if db.RowsAffected == 0 { - return errors.New("无权更新该数据") - } - return nil -} - -// Remove 删除SysAreaData -func (e *SysAreaData) Remove(d *dto.SysAreaDataById, p *actions.DataPermission) error { - var data models.SysAreaData - db := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ).Delete(&data, d.GetId()) - if err := db.Error; err != nil { - e.Log.Errorf("Service RemoveSysAreaData error: %s", err) - return err - } - if db.RowsAffected == 0 { - return errors.New("无权删除该数据") - } - return nil -} \ No newline at end of file diff --git a/app/other/service/sys_file_dir.go b/app/other/service/sys_file_dir.go deleted file mode 100644 index bf455e81..00000000 --- a/app/other/service/sys_file_dir.go +++ /dev/null @@ -1,169 +0,0 @@ -package service - -import ( - "errors" - "fmt" - common "go-admin/common/models" - - "github.com/go-admin-team/go-admin-core/sdk/service" - "gorm.io/gorm" - - "go-admin/app/other/models" - "go-admin/app/other/service/dto" - "go-admin/common/actions" - cDto "go-admin/common/dto" -) - -type SysFileDir struct { - service.Service -} - -// GetSysFileDirPage 获取SysFileDir列表 -func (e *SysFileDir) GetSysFileDirPage(c *dto.SysFileDirSearch, list *[]models.SysFileDir) error { - var err error - var data models.SysFileDir - - err = e.Orm.Model(&data). - Scopes( - cDto.MakeCondition(c.GetNeedSearch()), - ). - Find(list). //Limit(-1).Offset(-1). - Error - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - return nil -} - -// GetSysFileDir 获取SysFileDir对象 -func (e *SysFileDir) GetSysFileDir(d cDto.Control, model *models.SysFileDir) error { - var err error - var data models.SysFileDir - - db := e.Orm.Model(&data). - First(model, d.GetId()) - err = db.Error - if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { - err = errors.New("查看对象不存在或无权查看") - e.Log.Errorf("db error: %s", err) - return err - } - if db.Error != nil { - e.Log.Errorf("db error:%s", err) - return err - } - return nil -} - -// InsertSysFileDir 创建SysFileDir对象 -func (e *SysFileDir) InsertSysFileDir(model *dto.SysFileDirControl) error { - var err error - data, _ := model.GenerateM() - - err = e.Orm.Create(data).Error - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - path := fmt.Sprintf("/%d", model.Id) - //db = e.Orm.Model(&data). - // First(&data, model.GetId()) - //err = db.Error - - if model.PId != 0 { - var dept models.SysFileDir - e.Orm.Model(&models.SysFileDir{}).Where("id = ?", model.PId).First(&dept) - path = dept.Path + path - } else { - path = "/0" + path - } - //var mp = map[string]string{} - //mp["path"] = path - if err = e.Orm.Model(&models.SysFileDir{}).Where("id = ?", model.Id).Update("path", path).Error; err != nil { - return err - } - - return nil -} - -// UpdateSysFileDir 修改SysFileDir对象 -func (e *SysFileDir) Update(c *dto.SysFileDirControl, p *actions.DataPermission) error { - var err error - data, _ := c.GenerateM() - - db := e.Orm.Model(&models.SysFileDir{Model: common.Model{Id: c.GetId().(int)}}). - Scopes( - actions.Permission(data.TableName(), p), - ).Updates(data) - if db.Error != nil { - e.Log.Errorf("db error: %s", err) - return err - } - if db.RowsAffected == 0 { - return errors.New("无权更新该数据") - } - return nil -} - -// RemoveSysFileDir 删除SysFileDir -func (e *SysFileDir) RemoveSysFileDir(d *dto.SysFileDirById, p *actions.DataPermission) error { - var err error - var data models.SysFileDir - - db := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ).Delete(&data, d.Id) - if db.Error != nil { - err = db.Error - e.Log.Errorf("Delete error: %s", err) - return err - } - if db.RowsAffected == 0 { - err = errors.New("无权删除该数据") - return err - } - return nil -} - -func (e *SysFileDir) SetSysFileDir(c *dto.SysFileDirSearch) (*[]models.SysFileDir, error) { - var list []models.SysFileDir - err := e.GetSysFileDirPage(c, &list) - m := make([]models.SysFileDir, 0) - for i := 0; i < len(list); i++ { - if list[i].PId != 0 { - continue - } - info := SysFileDirCall(&list, list[i]) - m = append(m, info) - } - return &m, err -} - -func SysFileDirCall(list *[]models.SysFileDir, m models.SysFileDir) models.SysFileDir { - listGroup := *list - min := make([]models.SysFileDir, 0) - for j := 0; j < len(listGroup); j++ { - if m.Id != listGroup[j].PId { - continue - } - mi := models.SysFileDir{} - mi.Id = listGroup[j].Id - mi.PId = listGroup[j].PId - mi.Label = listGroup[j].Label - //mi.Sort = listGroup[j].Sort - mi.CreatedAt = listGroup[j].CreatedAt - mi.UpdatedAt = listGroup[j].UpdatedAt - mi.Children = []models.SysFileDir{} - ms := SysFileDirCall(list, mi) - min = append(min, ms) - } - if len(min) > 0 { - m.Children = min - } else { - m.Children = nil - } - - return m -} diff --git a/app/other/service/sys_file_info.go b/app/other/service/sys_file_info.go deleted file mode 100644 index 0a79a707..00000000 --- a/app/other/service/sys_file_info.go +++ /dev/null @@ -1,130 +0,0 @@ -package service - -import ( - "errors" - common "go-admin/common/models" - - "go-admin/app/other/models" - "go-admin/app/other/service/dto" - - "go-admin/common/actions" - cDto "go-admin/common/dto" - - "github.com/go-admin-team/go-admin-core/sdk/service" - "gorm.io/gorm" -) - -type SysFileInfo struct { - service.Service -} - -// GetSysFileInfoPage 获取SysFileInfo列表 -func (e *SysFileInfo) GetSysFileInfoPage(c *dto.SysFileInfoSearch, p *actions.DataPermission, list *[]models.SysFileInfo, count *int64) error { - var err error - var data models.SysFileInfo - - err = e.Orm.Model(&data). - Scopes( - cDto.MakeCondition(c.GetNeedSearch()), - cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), - actions.Permission(data.TableName(), p), - ). - Find(list).Limit(-1).Offset(-1). - Count(count).Error - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - return nil -} - -// GetSysFileInfo 获取SysFileInfo对象 -func (e *SysFileInfo) GetSysFileInfo(d *dto.SysFileInfoById, p *actions.DataPermission, model *models.SysFileInfo) error { - var err error - var data models.SysFileInfo - - db := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ). - First(model, d.GetId()) - err = db.Error - if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { - err = errors.New("查看对象不存在或无权查看") - e.Log.Errorf("db error: %s", err) - return err - } - if db.Error != nil { - e.Log.Errorf("db error: %s", err) - return err - } - return nil -} - -// InsertSysFileInfo 创建SysFileInfo对象 -func (e *SysFileInfo) InsertSysFileInfo(model *dto.SysFileInfoControl) error { - var err error - var data *models.SysFileInfo - - data, err = model.Generate() - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - - err = e.Orm.Model(&data). - Create(data).Error - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - return nil -} - -// UpdateSysFileInfo 修改SysFileInfo对象 -func (e *SysFileInfo) UpdateSysFileInfo(c *dto.SysFileInfoControl, p *actions.DataPermission) error { - var err error - var data *models.SysFileInfo - - data, err = c.Generate() - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - err = e.Orm.Debug().Model(&models.SysFileInfo{Model: common.Model{ - Id: c.Id, - }}). - Scopes( - actions.Permission(data.TableName(), p), - ).Updates(&data).Error - if err != nil { - e.Log.Errorf("db error: %s", err) - return err - } - if err == gorm.ErrRecordNotFound { - return errors.New("无权更新该数据") - - } - return nil -} - -// RemoveSysFileInfo 删除SysFileInfo -func (e *SysFileInfo) RemoveSysFileInfo(d *dto.SysFileInfoById, p *actions.DataPermission) error { - var err error - var data models.SysFileInfo - - db := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ).Delete(&data, d.GetId()) - if db.Error != nil { - err = db.Error - e.Log.Errorf("Delete error: %s", err) - return err - } - if db.RowsAffected == 0 { - err = errors.New("无权删除该数据") - return err - } - return nil -} diff --git a/cmd/api/cms.go b/cmd/api/cms.go deleted file mode 100644 index 417de8a9..00000000 --- a/cmd/api/cms.go +++ /dev/null @@ -1,8 +0,0 @@ -package api - -import "go-admin/app/cms/router" - -func init() { - //注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法 - AppRouters = append(AppRouters, router.InitRouter) -} diff --git a/cmd/migrate/migration/models/sys_area_data.go b/cmd/migrate/migration/models/sys_area_data.go deleted file mode 100644 index f2dacf2f..00000000 --- a/cmd/migrate/migration/models/sys_area_data.go +++ /dev/null @@ -1,13 +0,0 @@ -package models - -type SysAreaData struct { - Id int `json:"id" gorm:"primaryKey;comment:主键编码"` - PId int `json:"pId" gorm:"size:11;comment:上级编码"` - Name string `json:"name" gorm:"size:128;comment:名称"` - ControlBy - ModelTime -} - -func (SysAreaData) TableName() string { - return "sys_area_data" -} \ No newline at end of file diff --git a/cmd/migrate/migration/models/sys_category.go b/cmd/migrate/migration/models/sys_category.go deleted file mode 100644 index f2edac3e..00000000 --- a/cmd/migrate/migration/models/sys_category.go +++ /dev/null @@ -1,16 +0,0 @@ -package models - -type SysCategory struct { - Model - Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // - Img string `json:"img" gorm:"type:varchar(255);comment:图标"` // - Sort int `json:"sort" gorm:"type:int(4);comment:排序"` // - Status int `json:"status" gorm:"type:int(1);comment:状态"` // - Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // - ControlBy - ModelTime -} - -func (SysCategory) TableName() string { - return "sys_category" -} diff --git a/cmd/migrate/migration/models/sys_content.go b/cmd/migrate/migration/models/sys_content.go deleted file mode 100644 index 2c3c20db..00000000 --- a/cmd/migrate/migration/models/sys_content.go +++ /dev/null @@ -1,18 +0,0 @@ -package models - -type SysContent struct { - Model - CateId int `json:"cateId" gorm:"type:int(11);comment:分类id"` - Name string `json:"name" gorm:"type:varchar(255);comment:名称"` - Status int `json:"status" gorm:"type:int(1);comment:状态"` - Img string `json:"img" gorm:"type:varchar(255);comment:图片"` - Content string `json:"content" gorm:"type:text;comment:内容"` - Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` - Sort int `json:"sort" gorm:"type:int(4);comment:排序"` - ControlBy - ModelTime -} - -func (SysContent) TableName() string { - return "sys_content" -} diff --git a/cmd/migrate/migration/models/sys_file_dir.go b/cmd/migrate/migration/models/sys_file_dir.go deleted file mode 100644 index 83181f0f..00000000 --- a/cmd/migrate/migration/models/sys_file_dir.go +++ /dev/null @@ -1,16 +0,0 @@ -package models - -type SysFileDir struct { - Model - Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 - Children []SysFileDir `json:"children,omitempty" gorm:"-"` // 下级信息 - ControlBy - ModelTime -} - -func (SysFileDir) TableName() string { /**/ - return "sys_file_dir" -} diff --git a/cmd/migrate/migration/models/sys_file_info.go b/cmd/migrate/migration/models/sys_file_info.go deleted file mode 100644 index 66fe8515..00000000 --- a/cmd/migrate/migration/models/sys_file_info.go +++ /dev/null @@ -1,18 +0,0 @@ -package models - -type SysFileInfo struct { - Model - Type string `json:"type" gorm:"type:varchar(255);comment:类型"` // - Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // - Size string `json:"size" gorm:"type:int(11);comment:大小"` // - PId int `json:"pId" gorm:"type:int(11);comment:目录"` // - Source string `json:"source" gorm:"type:varchar(255);comment:来源"` // - Url string `json:"url" gorm:"type:varchar(255);comment:地址"` // - FullUrl string `json:"fullUrl" gorm:"type:varchar(255);comment:全地址"` // - ControlBy - ModelTime -} - -func (SysFileInfo) TableName() string { - return "sys_file_info" -} diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 8afaa8b8..91e86a17 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -32,13 +32,8 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(models.SysPost), new(models.DictData), new(models.DictType), - new(models.SysAreaData), new(models.SysJob), new(models.SysConfig), - new(models.SysFileDir), - new(models.SysFileInfo), - new(models.SysCategory), - new(models.SysContent), new(models.SysApi), ) if err != nil { diff --git a/common/global/adm.go b/common/global/adm.go index be239390..a172d3fa 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -2,7 +2,7 @@ package global const ( // Version go-admin version info - Version = "2.0.0-beta.5" + Version = "2.0.0-beta.6" ) var ( diff --git a/config/db.sql b/config/db.sql index 1a2b35a3..4fe1ad24 100644 --- a/config/db.sql +++ b/config/db.sql @@ -12,8 +12,6 @@ INSERT INTO `sys_api` VALUES (10, 'go-admin/common/actions.IndexAction.func1', ' INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); -INSERT INTO `sys_api` VALUES (17, 'go-admin/app/other/apis.SysChinaAreaData.GetPage-fm', '行政区列表', '/api/v1/sys-area-data', 'BUS', 'GET', '2021-05-13 19:59:01.342', '2021-06-13 20:53:47.453', NULL, 0, 0); -INSERT INTO `sys_api` VALUES (18, 'go-admin/app/other/apis.SysChinaAreaData.Get-fm', '行政区通过id获取', '/api/v1/sys-area-data/:id', 'BUS', 'GET', '2021-05-13 19:59:01.390', '2021-06-13 20:53:47.497', NULL, 0, 0); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); @@ -42,10 +40,6 @@ INSERT INTO `sys_api` VALUES (45, 'go-admin/app/admin/apis.SysMenu.GetMenuTreeSe INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); -INSERT INTO `sys_api` VALUES (49, 'go-admin/app/other/apis.SysFileDir.GetPage-fm', '文件夹列表', '/api/v1/file-dir', 'BUS', 'GET', '2021-05-13 19:59:02.937', '2021-06-13 20:53:49.321', NULL, 0, 0); -INSERT INTO `sys_api` VALUES (50, 'go-admin/app/other/apis.SysFileDir.Get-fm', '文件夹通过id获取', '/api/v1/file-dir/:id', 'BUS', 'GET', '2021-05-13 19:59:02.981', '2021-06-13 20:53:49.364', NULL, 0, 0); -INSERT INTO `sys_api` VALUES (51, 'go-admin/app/other/apis.SysFileInfo.GetPage-fm', '文件列表', '/api/v1/file-info', 'BUS', 'GET', '2021-05-13 19:59:03.028', '2021-06-13 20:53:49.405', NULL, 0, 0); -INSERT INTO `sys_api` VALUES (52, 'go-admin/app/other/apis.SysFileInfo.Get-fm', '文件通过id获取', '/api/v1/file-info/:id', 'BUS', 'GET', '2021-05-13 19:59:03.069', '2021-06-13 20:53:49.448', NULL, 0, 0); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); @@ -61,12 +55,9 @@ INSERT INTO `sys_api` VALUES (68, 'go-admin/common/middleware/handler.Ping', '* INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); -INSERT INTO `sys_api` VALUES (77, 'go-admin/app/other/apis.SysChinaAreaData.Insert-fm', '行政区创建', '/api/v1/sys-area-data', 'BUS', 'POST', '2021-05-13 19:59:04.210', '2021-06-13 20:53:50.416', NULL, 0, 0); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); -INSERT INTO `sys_api` VALUES (83, 'go-admin/app/other/apis.SysFileDir.Insert-fm', '文件夹创建', '/api/v1/file-dir', 'BUS', 'POST', '2021-05-13 19:59:04.500', '2021-06-13 20:53:50.703', NULL, 0, 0); -INSERT INTO `sys_api` VALUES (84, 'go-admin/app/other/apis.SysFileInfo.Insert-fm', '文件创建', '/api/v1/file-info', 'BUS', 'POST', '2021-05-13 19:59:04.551', '2021-06-13 20:53:50.743', NULL, 0, 0); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); @@ -78,7 +69,6 @@ INSERT INTO `sys_api` VALUES (92, 'go-admin/app/admin/apis.SysApi.Update-fm', ' INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); -INSERT INTO `sys_api` VALUES (98, 'go-admin/app/other/apis.SysChinaAreaData.Update-fm', '行政区编辑', '/api/v1/sys-area-data/:id', 'BUS', 'PUT', '2021-05-13 19:59:05.387', '2021-06-13 20:53:51.120', NULL, 0, 0); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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); INSERT INTO `sys_api` VALUES (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);