提交 231c8495 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

增加api查询模式 修改后台查询方法示例

上级 3795471c
......@@ -71,11 +71,26 @@ func (a *SysApi) GetInfoList(info modelInterface.PageInfo) (err error, list inte
return
} else {
var apiList []SysApi
err = qmsql.DEFAULTDB.Where("path LIKE ?", "%"+a.Path+"%").Find(&apiList).Count(&total).Error
if err!=nil{
model := qmsql.DEFAULTDB.Model(info)
if a.Path != "" {
model = model.Where("path LIKE ?", "%"+a.Path+"%")
db = db.Where("path LIKE ?", "%"+a.Path+"%")
}
if a.Description != "" {
model = model.Where("description LIKE ?", "%"+a.Description+"%")
db = db.Where("description LIKE ?", "%"+a.Description+"%")
}
if a.Method != "" {
model = model.Where("method = ?", a.Method)
db = db.Where("method = ?", a.Method)
}
err = model.Find(&apiList).Count(&total).Error
if err != nil {
return err, apiList, total
}else{
err = db.Order("group", true).Where("path LIKE ?", "%"+a.Path+"%").Find(&apiList).Error
} else {
err = db.Order("group", true).Find(&apiList).Error
}
return err, apiList, total
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册