|
@@ -580,10 +580,10 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
staffs = spqp.Staffs
|
|
|
}
|
|
|
// 空查询优化,不走关联表计算数量
|
|
|
- if len(querys) == 0 {
|
|
|
- countSql = fmt.Sprintf("select count(1) from %s a %s where %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, leftJoinStr, userStr)
|
|
|
+ if len(querys) == 1 {
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s a %s where 1=1 %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, leftJoinStr, userStr)
|
|
|
//列表查询
|
|
|
- findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count, IF(a.source is NULL,1,a.source) as source from %s a LEFT JOIN %s b ON a.infoid = b.infoid %s where %s order by a.date desc,a.id desc",
|
|
|
+ findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count, IF(a.source is NULL,1,a.source) as source from %s a LEFT JOIN %s b ON a.infoid = b.infoid %s where 1=1 %s order by a.date desc,a.id desc",
|
|
|
aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr)
|
|
|
} else {
|
|
|
// 无查询分配人员、是否已读
|