瀏覽代碼

修改审批排序

longyu 3 年之前
父節點
當前提交
7abf786fbd
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 1 1
      controllers/roadshow/calendar.go
  2. 6 2
      models/roadshow/calendar.go

+ 1 - 1
controllers/roadshow/calendar.go

@@ -69,7 +69,7 @@ func (this *CalendarController) CalendarList() {
 		return
 	}
 	page = paging.GetPaging(currentIndex, pageSize, total)
-	dataList, err := roadshow.GetCalendarList(condition, pars, startSize, pageSize)
+	dataList, err := roadshow.GetCalendarList(condition, pars, status, startSize, pageSize)
 	if err != nil {
 		this.FailWithMessage("获取信息失败!", "获取数据失败,GetCalendarList,Err:"+err.Error())
 		return

+ 6 - 2
models/roadshow/calendar.go

@@ -152,7 +152,7 @@ func GetCalendarListCount(condition string, pars []interface{}) (count int, err
 	return
 }
 
-func GetCalendarList(condition string, pars []interface{}, pageLimit ...int) (list []*CalendarListView, err error) {
+func GetCalendarList(condition string, pars []interface{}, status int, pageLimit ...int) (list []*CalendarListView, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM  rs_calendar AS a
 		INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
@@ -160,7 +160,11 @@ func GetCalendarList(condition string, pars []interface{}, pageLimit ...int) (li
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
+	if status==1 {
+		sql += ` ORDER BY a.create_time ASC LIMIT ?,? `
+	}else{
+		sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
+	}
 	_, err = o.Raw(sql, pars, pageLimit).QueryRows(&list)
 	return
 }