浏览代码

排序根据状态来

ziwen 1 年之前
父节点
当前提交
267d7d8ce4
共有 2 个文件被更改,包括 2 次插入2 次删除
  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
 	}