feat ✨ 接口管理模块添加列排序

This commit is contained in:
wenjianzhang committed 2021-05-24 16:30:21 +08:00
1 parent 7880151ef2
commit cc74686108
3 files changed
+11 -13

No files matched your search

-2
View File
@@ -19,8 +19,6 @@ func registerSysApiRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
{
r.GET("", api.GetSysApiList)
r.GET("/:id", api.GetSysApi)
//r.POST("", api.InsertSysApi)
r.PUT("/:id", api.UpdateSysApi)
//r.DELETE("", api.DeleteSysApi)
}
}
+4 -3
View File
@@ -12,7 +12,6 @@ import (
type SysApiSearch struct {
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:"标题"`
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:"类型"`
@@ -21,7 +20,9 @@ type SysApiSearch 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{} {
@@ -105,4 +106,4 @@ func (s *SysApiById) Generate() dto.Control {
func (s *SysApiById) GenerateM() (common.ActiveRecord, error) {
return &models.SysApi{}, nil
}
}
+7 -8
View File
@@ -77,18 +77,17 @@ func (e *SysApi) CheckStorageSysApi(c *[]runtime.Router) error {
// UpdateSysApi 修改SysApi对象
func (e *SysApi) UpdateSysApi(c *dto.SysApiControl, p *actions.DataPermission) error {
var model = models.SysApi{}
e.Orm.Scopes(
actions.Permission(model.TableName(), p),
).First(&model, c.GetId())
db := e.Orm.Debug().First(&model, c.GetId())
if db.RowsAffected == 0 {
return errors.New("无权更新该数据")
}
c.Generate(&model)
db := e.Orm.Save(&model)
db = e.Orm.Save(&model)
if err := db.Error; err != nil {
e.Log.Errorf("Service UpdateSysApi error:%s", err)
return err
}
if db.RowsAffected == 0 {
return errors.New("无权更新该数据")
}
return nil
}
@@ -108,4 +107,4 @@ func (e *SysApi) RemoveSysApi(d *dto.SysApiById, p *actions.DataPermission) erro
return errors.New("无权删除该数据")
}
return nil
}
}