DengBiao 1 год назад
Родитель
Сommit
c62ee68740
1 измененных файлов: 17 добавлений и 6 удалений
  1. +17
    -6
      app/db/db_central_kitchen_for_school_user_with_day.go

+ 17
- 6
app/db/db_central_kitchen_for_school_user_with_day.go Просмотреть файл

@@ -79,13 +79,24 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoV2(ordNo string, state int, startDate, endDate string, kindList []int) (count int64, err error) {
var m model.CentralKitchenForSchoolUserWithDay
sDate, _ := time.ParseInLocation("2006-01-02", startDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02", endDate, time.Local)

count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("state !=?", state).
And("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).
In("kind", kindList).
Count(&m)
sess := centralKitchenForSchoolUserWithDayDb.Db.NewSession()
sess = sess.Where("1=1")
if ordNo != "" {
sess.And("ord_no =?", ordNo)
}
if state != 0 {
sess.And("state !=?", state)
}
if startDate != "" {
sDate, _ := time.ParseInLocation("2006-01-02", startDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02", endDate, time.Local)
sess.And("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).
}
if len(kindList) > 0 {
sess.In("kind", kindList)
}
count, err = sess.Count(&m)
return count, nil
}



Загрузка…
Отмена
Сохранить