Refine the rest structure.
This commit is contained in:
26
code/rest/base_dao.go
Normal file
26
code/rest/base_dao.go
Normal file
@ -0,0 +1,26 @@
|
||||
package rest
|
||||
|
||||
import "tank/code/tool/builder"
|
||||
|
||||
type BaseDao struct {
|
||||
Bean
|
||||
}
|
||||
|
||||
//根据一个sortMap,获取到order字符串
|
||||
func (this *BaseDao) GetSortString(sortArray []builder.OrderPair) string {
|
||||
|
||||
if sortArray == nil || len(sortArray) == 0 {
|
||||
return ""
|
||||
}
|
||||
str := ""
|
||||
for _, pair := range sortArray {
|
||||
if pair.Value == "DESC" || pair.Value == "ASC" {
|
||||
if str != "" {
|
||||
str = str + ","
|
||||
}
|
||||
str = str + " " + pair.Key + " " + pair.Value
|
||||
}
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
Reference in New Issue
Block a user