diff --git a/app/admin/service/dto/sys_api.go b/app/admin/service/dto/sys_api.go index 5e53d071..d26034ee 100644 --- a/app/admin/service/dto/sys_api.go +++ b/app/admin/service/dto/sys_api.go @@ -11,8 +11,9 @@ type SysApiGetPageReq struct { dto.Pagination `search:"-"` Title string `form:"title" search:"type:contains;column:title;table:sys_api" comment:"标题"` Path string `form:"path" search:"type:contains;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:"请求方式"` ParentId string `form:"parentId" search:"type:exact;column:parent_id;table:sys_api" comment:"按钮id"` + Type string `form:"type" search:"-" comment:"类型"` SysApiOrder } @@ -84,7 +85,6 @@ func (s *SysApiGetReq) GetId() interface{} { return s.Id } - // SysApiDeleteReq 功能删除请求参数 type SysApiDeleteReq struct { Ids []int `json:"ids"` @@ -93,4 +93,3 @@ type SysApiDeleteReq struct { func (s *SysApiDeleteReq) GetId() interface{} { return s.Ids } - diff --git a/app/admin/service/sys_api.go b/app/admin/service/sys_api.go index 1818a887..d8d6c350 100644 --- a/app/admin/service/sys_api.go +++ b/app/admin/service/sys_api.go @@ -23,13 +23,20 @@ func (e *SysApi) GetPage(c *dto.SysApiGetPageReq, p *actions.DataPermission, lis var err error var data models.SysApi - err = e.Orm.Debug().Model(&data). + orm := e.Orm.Debug().Model(&data). Scopes( cDto.MakeCondition(c.GetNeedSearch()), cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), actions.Permission(data.TableName(), p), - ). - Find(list).Limit(-1).Offset(-1). + ) + if c.Type != "" { + qType := c.Type + if qType == "暂无" { + qType = "" + } + orm = orm.Where("`type` = ?", qType) + } + err = orm.Find(list).Limit(-1).Offset(-1). Count(count).Error if err != nil { e.Log.Errorf("Service GetSysApiPage error:%s", err)