xiziwen 4 månader sedan
förälder
incheckning
ff62a40cb0

+ 6 - 1
controllers/document_manage/document_manage_controller.go

@@ -193,6 +193,11 @@ func (this *DocumentManageController) RuiSiReportList() {
 	classifyIdFirst, _ := this.GetInt("ClassifyIdFirst", 0)
 	classifyIdSecond, _ := this.GetInt("ClassifyIdSecond", 0)
 	classifyIdThird, _ := this.GetInt("ClassifyIdThird", 0)
+	chartPermissionIdString := this.GetString("ChartPermissionIdList")
+	var chartPermissionIdList []string
+	if strings.TrimSpace(chartPermissionIdString) != "" {
+		chartPermissionIdList = strings.Split(chartPermissionIdString, ",")
+	}
 
 	keyword := this.GetString("Keyword")
 	orderField := this.GetString("OrderField")
@@ -206,7 +211,7 @@ func (this *DocumentManageController) RuiSiReportList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, keyword, orderField, orderType, currentIndex, pageSize)
+	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, currentIndex, pageSize)
 	if err != nil {
 		br.Msg = "获取报告列表失败"
 		br.ErrMsg = "获取报告列表失败,Err:" + err.Error()

+ 4 - 2
models/report.go

@@ -166,7 +166,8 @@ type ReportListResp struct {
 // @return err error
 func GetReportListCountV1(condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT COUNT(1) AS count  FROM report as a WHERE 1=1 `
+	sql := `SELECT COUNT(1) AS count  FROM report as a left join chart_permission_search_key_word_mapping b on
+a.classify_id_first = b.classify_id WHERE 1=1 `
 	if condition != "" {
 		sql += condition
 	}
@@ -201,7 +202,8 @@ func GetReportListV1(condition string, pars []interface{}, startSize, pageSize i
 func GetReportListByCondition(condition string, pars []interface{}, startSize, pageSize int) (items []*ReportList, err error) {
 	o := orm.NewOrmUsingDB("rddp")
 
-	sql := `SELECT * FROM report as a WHERE 1=1  `
+	sql := `SELECT * FROM report as a left join chart_permission_search_key_word_mapping b on
+a.classify_id_first = b.classify_id WHERE 1=1  `
 	if condition != "" {
 		sql += condition
 	}

+ 7 - 1
services/document_manage_service/document_manage_service.go

@@ -213,7 +213,7 @@ func GetAllClassifyIdsByParentId(parentId int) ([]string, error) {
 	return classifyIdList, nil
 }
 
-func RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird int, keyword string, orderField, orderType string, startSize, pageSize int) (*models.ReportListResp, error) {
+func RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird int, chartPermissionIdList []string, keyword string, orderField, orderType string, startSize, pageSize int) (*models.ReportListResp, error) {
 	logs.Info("RuiSiReportList")
 
 	var condition string
@@ -231,6 +231,12 @@ func RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird int, key
 		condition += ` AND a.classify_id_third = ? `
 		pars = append(pars, classifyIdThird)
 	}
+	if len(chartPermissionIdList) > 0 {
+		condition += ` and b.chart_permission_id in (` + utils.GetOrmInReplace(len(chartPermissionIdList)) + `)`
+		for _, chartPermissionId := range chartPermissionIdList {
+			pars = append(pars, chartPermissionId)
+		}
+	}
 	if keyword != "" {
 		condition += ` and ( a.title like ? or a.admin_real_name like ? ) `
 		pars = append(pars, "%"+keyword+"%", "%"+keyword+"%")