tank/code/rest/base_dao.go
2019-04-26 11:43:54 +08:00

27 lines
473 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}