Browse Source

fix: 睿思研报查询条件

hsun 2 months ago
parent
commit
6388bc4a80
2 changed files with 23 additions and 12 deletions
  1. 18 8
      models/report.go
  2. 5 4
      services/document_manage_service/document_manage_service.go

+ 18 - 8
models/report.go

@@ -1686,7 +1686,7 @@ func GetReportListByCollectList(classifyIdFirst, classifyIdSecond, classifyIdThi
 	return items, err
 }
 
-func GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList []string, keyword, author string, state int) (count int, err error) {
+func GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList []string, keyword, author string, isPublic int, stateArr []int) (count int, err error) {
 	o := orm.NewOrmUsingDB("rddp")
 	var params []interface{}
 
@@ -1731,9 +1731,14 @@ func GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyId
 		params = append(params, author)
 	}
 
-	if state > 0 {
-		sql += " AND b.state = ? "
-		params = append(params, state)
+	if isPublic > 0 {
+		sql += " AND b.is_public_publish = ? "
+		params = append(params, isPublic)
+	}
+
+	if len(stateArr) > 0 {
+		sql += fmt.Sprintf(" AND b.state IN (%s)", utils.GetOrmInReplace(len(stateArr)))
+		params = append(params, stateArr)
 	}
 
 	// 分类id判断
@@ -1772,7 +1777,7 @@ func GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyId
 	return count, err
 }
 
-func GetReportListByCollectListV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList []string, keyword, orderField, orderType string, startSize, pageSize int, author string, state int) (items []*ReportList, err error) {
+func GetReportListByCollectListV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList []string, keyword, orderField, orderType string, startSize, pageSize int, author string, isPublic int, stateArr []int) (items []*ReportList, err error) {
 	o := orm.NewOrmUsingDB("rddp")
 	var params []interface{}
 
@@ -1799,9 +1804,14 @@ b.abstract,b.admin_id,b.admin_real_name,b.last_modify_admin_id,b.last_modify_adm
 		params = append(params, author)
 	}
 
-	if state > 0 {
-		sql += " AND b.state = ? "
-		params = append(params, state)
+	if isPublic > 0 {
+		sql += " AND b.is_public_publish = ? "
+		params = append(params, isPublic)
+	}
+
+	if len(stateArr) > 0 {
+		sql += fmt.Sprintf(" AND b.state IN (%s)", utils.GetOrmInReplace(len(stateArr)))
+		params = append(params, stateArr)
 	}
 
 	// 分类id判断

+ 5 - 4
services/document_manage_service/document_manage_service.go

@@ -503,10 +503,11 @@ func RuiSiReportListV2(classifyIdList, chartPermissionIdList []string, keyword,
 	// 作者为 全球市场战略研究中心 PCI Research
 	var author string
 	//author := "战研中心 PCIR"
-	// 已发布的报告
-	state := 2
+	// 已发布/已审批的公开发布的报告
+	isPublic := 2
+	stateArr := []int{2, 6}
 
-	count, err := models.GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, author, state)
+	count, err := models.GetReportListByCollectCountV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, author, isPublic, stateArr)
 	if err != nil {
 		return nil, err
 	}
@@ -518,7 +519,7 @@ func RuiSiReportListV2(classifyIdList, chartPermissionIdList []string, keyword,
 		return &reportPage, nil
 	}
 
-	reportList, err := models.GetReportListByCollectListV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, startSize, pageSize, author, state)
+	reportList, err := models.GetReportListByCollectListV2(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, startSize, pageSize, author, isPublic, stateArr)
 	if err != nil {
 		return nil, err
 	}