From d4e08986743f090ebbe2a509f2d55aaca1c216af Mon Sep 17 00:00:00 2001 From: ouqiang Date: Wed, 6 Sep 2017 09:43:13 +0800 Subject: [PATCH] =?UTF-8?q?fix($task):=20=E4=BF=AE=E5=A4=8D=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8=E9=A1=B5=E6=80=BB=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=95=B0=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/task.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/models/task.go b/models/task.go index 1572743..a0fe28e 100644 --- a/models/task.go +++ b/models/task.go @@ -229,7 +229,11 @@ func (task *Task) GetDependencyTaskList(ids string) ([]Task, error) { func (task *Task) Total(params CommonMap) (int64, error) { session := Db.Alias("t").Join("LEFT", taskHostTableName(), "t.id = th.task_id") task.parseWhere(session, params) - return session.GroupBy("t.id").Count(task) + list := make([]Task, 0) + + err := session.GroupBy("t.id").Find(&list) + + return int64(len(list)), err } // 解析where