Browse Source

排序根据状态来

ziwen 1 year ago
parent
commit
267d7d8ce4
2 changed files with 2 additions and 2 deletions
  1. 1 1
      models/report.go
  2. 1 1
      models/smart_report/smart_report.go

+ 1 - 1
models/report.go

@@ -122,7 +122,7 @@ func GetReportList(condition string, pars []interface{}, companyType string, sta
 	if condition != "" {
 		sql += condition
 	}
-	sql += `ORDER BY state ASC, modify_time DESC LIMIT ?,?`
+	sql += `ORDER BY FIELD(state,3,1,2,4), modify_time DESC LIMIT ?,?`
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }

+ 1 - 1
models/smart_report/smart_report.go

@@ -151,7 +151,7 @@ func (m *SmartReport) GetPageItemsByCondition(condition string, pars []interface
 	if len(fieldArr) == 0 {
 		fields = `*`
 	}
-	order := `ORDER BY create_time DESC`
+	order := `ORDER BY FIELD(state,3,1,2,4), create_time DESC`
 	if orderRule != "" {
 		order = ` ORDER BY ` + orderRule
 	}