Browse Source

fix:数据导出附件权限添加

duxin 3 years ago
parent
commit
6d0dce945b

+ 13 - 0
src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go

@@ -48,6 +48,7 @@ type SieveCondition struct {
 	Subtype      string    `json:"subtype"`      //信息类型
 	SelectIds    []string  `json:"selectId"`     //选择信息导出
 	Comeinfrom   string    `json:"comeinfrom"`   //查询来源
+	FileExists   string    `json:"fileExists"`   //是否有附件
 }
 
 const (
@@ -292,6 +293,17 @@ func getDataExportSql(scd *SieveCondition) string {
 			musts = append(musts, fmt.Sprintf(query_missing, "winnertel"))
 		}
 	}
+
+	//搜索范围是否只有附件
+	//搜索范围只选择附件,是否有附件条件无效;
+	var isFileSearch = strings.ReplaceAll(scd.SelectType, ",", "\",\"") == "filetext"
+	if !isFileSearch && scd.FileExists != "" {
+		if scd.FileExists == "1" { //有附件
+			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
+		} else if scd.FileExists == "-1" { //无附件
+			musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
+		}
+	}
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
 	return qstr
 }
@@ -324,6 +336,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 		ComeInTime:   qutil.Int64All((*query)["comeintime"]),
 		Comeinfrom:   qutil.ObjToString((*query)["comeinfrom"]),
 		SelectIds:    getStringArrFromDbResult((*query)["selectIds"]),
+		FileExists:   qutil.ObjToString((*query)["fileExists"]),
 	}
 }
 

+ 1 - 0
src/jfw/public/dataexport.go

@@ -184,6 +184,7 @@ func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interf
 		"winner":       winnerSave,
 		"hasBuyertel":  this.Hasbuyertel,
 		"hasWinnertel": this.Haswinnertel,
+		"fileExists":   this.FileExists,
 		"comeintime":   now.Unix(),
 	}
 	//选择信息id