You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
473 B
27 lines
473 B
|
7 years ago
|
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
|
||
|
|
}
|