feat ✨ 接口管理模块添加列排序
This commit is contained in:
1 parent
7880151ef2
commit
cc74686108
3 files changed
+9
-11
No files matched your search
@@ -19,8 +19,6 @@ func registerSysApiRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
|
|||||||
{
|
{
|
||||||
r.GET("", api.GetSysApiList)
|
r.GET("", api.GetSysApiList)
|
||||||
r.GET("/:id", api.GetSysApi)
|
r.GET("/:id", api.GetSysApi)
|
||||||
//r.POST("", api.InsertSysApi)
|
|
||||||
r.PUT("/:id", api.UpdateSysApi)
|
r.PUT("/:id", api.UpdateSysApi)
|
||||||
//r.DELETE("", api.DeleteSysApi)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
|
|
||||||
type SysApiSearch struct {
|
type SysApiSearch struct {
|
||||||
dto.Pagination `search:"-"`
|
dto.Pagination `search:"-"`
|
||||||
Name string `form:"name" search:"type:exact;column:name;table:sys_api" comment:"名称"`
|
|
||||||
Title string `form:"title" search:"type:exact;column:title;table:sys_api" comment:"标题"`
|
Title string `form:"title" search:"type:exact;column:title;table:sys_api" comment:"标题"`
|
||||||
Path string `form:"path" search:"type:exact;column:path;table:sys_api" comment:"地址"`
|
Path string `form:"path" search:"type:exact;column:path;table:sys_api" comment:"地址"`
|
||||||
Action string `form:"action" search:"type:exact;column:action;table:sys_api" comment:"类型"`
|
Action string `form:"action" search:"type:exact;column:action;table:sys_api" comment:"类型"`
|
||||||
@@ -21,7 +20,9 @@ type SysApiSearch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysApiOrder struct {
|
type SysApiOrder struct {
|
||||||
HandleOrder string `search:"type:order;column:handle;table:sys_api" form:"handle_order"`
|
TitleOrder string `search:"type:order;column:title;table:sys_api" form:"title_order"`
|
||||||
|
PathOrder string `search:"type:order;column:path;table:sys_api" form:"path_order"`
|
||||||
|
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAt_order"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SysApiSearch) GetNeedSearch() interface{} {
|
func (m *SysApiSearch) GetNeedSearch() interface{} {
|
||||||
|
|||||||
@@ -77,18 +77,17 @@ func (e *SysApi) CheckStorageSysApi(c *[]runtime.Router) error {
|
|||||||
// UpdateSysApi 修改SysApi对象
|
// UpdateSysApi 修改SysApi对象
|
||||||
func (e *SysApi) UpdateSysApi(c *dto.SysApiControl, p *actions.DataPermission) error {
|
func (e *SysApi) UpdateSysApi(c *dto.SysApiControl, p *actions.DataPermission) error {
|
||||||
var model = models.SysApi{}
|
var model = models.SysApi{}
|
||||||
e.Orm.Scopes(
|
db := e.Orm.Debug().First(&model, c.GetId())
|
||||||
actions.Permission(model.TableName(), p),
|
if db.RowsAffected == 0 {
|
||||||
).First(&model, c.GetId())
|
return errors.New("无权更新该数据")
|
||||||
|
}
|
||||||
c.Generate(&model)
|
c.Generate(&model)
|
||||||
db := e.Orm.Save(&model)
|
db = e.Orm.Save(&model)
|
||||||
if err := db.Error; err != nil {
|
if err := db.Error; err != nil {
|
||||||
e.Log.Errorf("Service UpdateSysApi error:%s", err)
|
e.Log.Errorf("Service UpdateSysApi error:%s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if db.RowsAffected == 0 {
|
|
||||||
return errors.New("无权更新该数据")
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user