瀏覽代碼

no message

zhangchuanxing 3 月之前
父節點
當前提交
e4ac580819
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      models/industrial_management.go

+ 3 - 3
models/industrial_management.go

@@ -121,14 +121,14 @@ func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize,
 	if isBillboard {
 		var startTime string
 		startTime = time.Now().AddDate(0, 0, -30).Format(utils.FormatDate)
-		conditionBillboard = ` 	( SELECT COUNT( 1 ) FROM cygx_industry_fllow AS f WHERE f.industrial_management_id = man.industrial_management_id AND f.create_time > '` + startTime + `'  ) AS follow_num, `
+		conditionBillboard = ` 	( SELECT COUNT( 1 ) FROM cygx_industry_fllow AS f WHERE f.industrial_management_id = man.industrial_management_id AND f.follow_type = 1  AND f.create_time > '` + startTime + `'  ) AS follow_num, `
 	}
 	sql := `SELECT
 			man.*,
 			re.chart_permission_name,
 			man.new_art_publish_date  AS update_time ,
 			MIN(art.publish_date) AS min_report_time,` + conditionBillboard + `
-		    (SELECT COUNT( 1 )  FROM cygx_industry_fllow AS f WHERE f.user_id = ` + strconv.Itoa(uid) + ` AND f.industrial_management_id = man.industrial_management_id AND f.type = 1) AS is_follow
+		     (SELECT follow_type  FROM cygx_industry_fllow AS f WHERE f.user_id = ` + strconv.Itoa(uid) + ` AND f.follow_type = 1 AND  f.industrial_management_id = man.industrial_management_id) AS follow_type
 			FROM
 			cygx_industrial_management AS man
 			INNER JOIN cygx_report_mapping AS re ON re.chart_permission_id = man.chart_permission_id
@@ -140,7 +140,7 @@ func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize,
 			AND art.is_class = 1 ` + condition + `
 			GROUP BY
 			man.industry_name 
-			ORDER BY ` + orderSrt + ` LIMIT ?,?`
+			ORDER BY  follow_type DESC ,  ` + orderSrt + ` LIMIT ?,?`
 	_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
 	return
 }