作者 linmadan

修复关闭任务记录任务不显示bug

... ... @@ -66,8 +66,12 @@ func (repository *OffTaskRecordRepository) Find(queryOptions map[string]interfac
var offTaskRecordModels []*models.OffTaskRecord
offTaskRecords := make([]*domain.OffTaskRecord, 0)
query := tx.Model(&offTaskRecordModels)
if taskIds, ok := queryOptions["taskIds"]; ok && len(taskIds.([]int64)) > 0 {
if taskIds, ok := queryOptions["taskIds"]; ok {
if len(taskIds.([]int64)) > 0{
query = query.Where(`off_task_record.task_id IN (?)`, pg.In(taskIds.([]int64)))
}else {
return int64(0), offTaskRecords, nil
}
}
if offStartTime, ok := queryOptions["offStartTime"]; ok && !offStartTime.(time.Time).IsZero() {
query = query.Where(`off_task_record.create_time > ?`, offStartTime)
... ...
... ... @@ -61,7 +61,34 @@ var _ = Describe("搜索关闭任务记录", func() {
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1)
})
})
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": 102,
"taskContentMatch": "",
"taskType": 1,
"customerValue": "",
"taskNature": "",
"offStartTime": time.Date(2020, time.Month(4), 5, 8, 0, 0, 0, time.Now().Location()),
"offEndTime": time.Time{},
"offset": 0,
"limit": 20,
}
httpExpect.POST("/off-task-records/search-off-task-record").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 0)
})
})
})
... ...