xingzai 3 лет назад
Родитель
Сommit
e2b18ad349
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      models/report.go

+ 4 - 4
models/report.go

@@ -446,8 +446,8 @@ func GetDepartmentList(permissionName string, userId int) (items []*DepartmentRe
 			d.nick_name,
 			d.department_id,
 			d.img_url,
-			( SELECT count( 1 ) FROM cygx_article_department_follow AS f  WHERE f.department_id = d.department_id  AND user_id =?   ) AS fllow_num,
-			( SELECT count( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id ) AS sum_num
+			( SELECT count( 1 ) FROM cygx_article_department_follow AS f  WHERE f.department_id = d.department_id  AND user_id =?  AND f.type= 1  ) AS fllow_num,
+			( SELECT count( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id AND f.type= 1 ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id) AS sum_num
 		FROM
 		cygx_article_department AS d
 			INNER JOIN cygx_article AS a ON d.department_id = a.department_id
@@ -599,8 +599,8 @@ func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err e
 			d.department_id,
 			d.nick_name,
 			d.img_url,
-			( SELECT count( 1 ) FROM cygx_article_department_follow AS af WHERE af.user_id = ? AND af.department_id = d.department_id ) AS my_fllow_num,
-			( SELECT count( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id  ) AS fllow_num,
+			( SELECT count( 1 ) FROM cygx_article_department_follow AS af WHERE af.user_id = ? AND af.department_id = d.department_id AND af.type= 1 ) AS my_fllow_num,
+			( SELECT count( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id  AND f.type= 1 ) AS fllow_num,
 			( SELECT count( 1 ) FROM cygx_article AS a WHERE a.department_id = d.department_id  ) AS article_num,
 			( SELECT count( 1 ) FROM cygx_article_collect  AS c  WHERE c.article_id IN (SELECT  article_id FROM cygx_article AS a WHERE a.department_id = d.department_id )) AS collect_num
 		FROM