u
This commit is contained in:
1 parent
d60be4a75b
commit
be8eaae7c5
24 files changed
+595
-232
No files matched your search
@@ -60,7 +60,7 @@ func Find(table string, conditions map[string]interface{}, orderBy ...string) ([
|
||||
|
||||
query := fmt.Sprintf("SELECT * FROM %s WHERE %s", table, strings.Join(whereParts, " AND "))
|
||||
|
||||
order := "b_id DESC"
|
||||
order := "id DESC"
|
||||
if len(orderBy) > 0 && orderBy[0] != "" {
|
||||
order = orderBy[0]
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func Find(table string, conditions map[string]interface{}, orderBy ...string) ([
|
||||
func FindAll(table string, orderBy ...string) ([]mapx.M, error) {
|
||||
query := fmt.Sprintf("SELECT * FROM %s", table)
|
||||
|
||||
order := "b_id DESC"
|
||||
order := "id DESC"
|
||||
if len(orderBy) > 0 && orderBy[0] != "" {
|
||||
order = orderBy[0]
|
||||
}
|
||||
@@ -111,11 +111,11 @@ func FindOne(table string, conditions map[string]interface{}, orderBy ...string)
|
||||
|
||||
query := fmt.Sprintf("SELECT * FROM %s WHERE %s", table, strings.Join(whereParts, " AND "))
|
||||
|
||||
order := "b_id DESC"
|
||||
order := "id DESC"
|
||||
if len(orderBy) > 0 && orderBy[0] != "" {
|
||||
order = orderBy[0]
|
||||
}
|
||||
query += " ORDER BY " + order + " LIMIT 1" // 只取一条记录
|
||||
query += " ORDER BY " + order + " LIMIT 1"
|
||||
|
||||
row := mapx.New()
|
||||
err := DB.Get(&row, query, values...)
|
||||
|
||||
Reference in new issue
Block a user