|
@@ -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"]),
|
|
|
}
|
|
|
}
|
|
|
|