Browse Source

order test

main
pixel 5 years ago
parent
commit
0280c5f25c
  1. 4
      README-zh_CN.md
  2. 9
      server/api/v1/sys_api.go
  3. 9
      server/model/sys_api.go
  4. 24262
      web/package-lock.json

4
README-zh_CN.md

@ -247,10 +247,10 @@ go run main.go;
| 昵称 | 项目职务 | 姓 |
| ---- | ---- | ---- |
| [@piexlmax](https://github.com/piexlmax) | 项目发起者 | 蒋 |
| [@granty1](https://github.com/granty1) | 前端开发 | 尹 |
| [@granty1](https://github.com/granty1) | 后台开发 | 印 |
| [@Ruio9244](https://github.com/Ruio9244) | 全栈开发 | 严 |
| [@1319612909](https://github.com/1319612909) | 前端UI开发 | 杜 |
| [@krank666](https://github.com/krank666) | 后台开发 | 印 |
| [@krank666](https://github.com/krank666) | 前端开发 | 尹 |
| [@chen-chen-up](https://github.com/chen-chen-up) | 新手开发 | 宋 |
## 12. 捐赠

9
server/api/v1/sys_api.go

@ -45,11 +45,6 @@ func DeleteApi(c *gin.Context) {
}
}
type AuthAndPathIn struct {
AuthorityId string `json:"authorityId"`
ApiIds []uint `json:"apiIds"`
}
//条件搜索后端看此api
// @Tags SysApi
@ -65,10 +60,12 @@ func GetApiList(c *gin.Context) {
type searchParams struct {
model.SysApi
model.PageInfo
OrderKey string `json:"orderKey"`
Desc bool `json:"desc"`
}
var sp searchParams
_ = c.ShouldBindJSON(&sp)
err, list, total := sp.SysApi.GetInfoList(sp.PageInfo)
err, list, total := sp.SysApi.GetInfoList(sp.PageInfo, sp.OrderKey, sp.Desc)
if err != nil {
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
} else {

9
server/model/sys_api.go

@ -101,7 +101,7 @@ func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
// @return err error
// @return list interface{}
// @return total int
func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
func (a *SysApi) GetInfoList(info PageInfo, Order string, Desc bool) (err error, list interface{}, total int) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
@ -128,7 +128,12 @@ func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total
if err != nil {
return err, apiList, total
} else {
err = db.Limit(limit).Offset(offset).Order("api_group", true).Find(&apiList).Error
db = db.Limit(limit).Offset(offset)
if Order != "" {
err = db.Order(Order+" desc", true).Find(&apiList).Error
} else {
err = db.Order("api_group", true).Find(&apiList).Error
}
}
return err, apiList, total
}

24262
web/package-lock.json
File diff suppressed because it is too large
View File

Loading…
Cancel
Save