|
@@ -516,7 +516,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
for _, v := range *users {
|
|
for _, v := range *users {
|
|
userIds = append(userIds, common.InterfaceToStr(v.Id))
|
|
userIds = append(userIds, common.InterfaceToStr(v.Id))
|
|
}
|
|
}
|
|
- userStr += fmt.Sprintf(" a.userid in (%s) ", strings.Join(userIds, ","))
|
|
|
|
|
|
+ userStr += fmt.Sprintf(" and a.userid in (%s) ", strings.Join(userIds, ","))
|
|
} else {
|
|
} else {
|
|
log.Printf("部门管理员为获取到部门员工:%s", spqp.EntUserId)
|
|
log.Printf("部门管理员为获取到部门员工:%s", spqp.EntUserId)
|
|
result = []*bxsubscribe.SubscribeInfo{}
|
|
result = []*bxsubscribe.SubscribeInfo{}
|
|
@@ -527,14 +527,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
//查询数量(需要去重)
|
|
//查询数量(需要去重)
|
|
if len(querys) > 1 {
|
|
if len(querys) > 1 {
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a STRAIGHT_JOIN %s b ON %s and a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a STRAIGHT_JOIN %s b ON %s and a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
|
|
- countSql = fmt.Sprintf("SELECT count(1) AS count FROM (SELECT DISTINCT matchkeys,infoid FROM %s WHERE 1=1 and %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
|
|
|
|
+ countSql = fmt.Sprintf("SELECT count(1) AS count FROM (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE 1=1 and %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
} else {
|
|
} else {
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
//countSql = fmt.Sprintf("select count(1) as count from %s a where %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
countSql = fmt.Sprintf("SELECT count(1) AS count FROM ( SELECT DISTINCT matchkeys,infoid FROM %s a WHERE %s ) AS data", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
countSql = fmt.Sprintf("SELECT count(1) AS count FROM ( SELECT DISTINCT matchkeys,infoid FROM %s a WHERE %s ) AS data", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
}
|
|
}
|
|
//列表查询
|
|
//列表查询
|
|
- findSql = fmt.Sprintf("select a.infoid,a.matchkeys,b.isvalidfile as attachment_count from (SELECT DISTINCT matchkeys,infoid FROM %s WHERE 1=1 and %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s"+
|
|
|
|
- " order by a.date desc,a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
|
|
|
|
+ findSql = fmt.Sprintf("select a.infoid,a.matchkeys,b.isvalidfile as attachment_count from (SELECT DISTINCT matchkeys,infoid FROM %s a WHERE 1=1 and %s ) a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s"+
|
|
|
|
+ " order by b.publishtime desc", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, Baseinfo, leftJoinStr, strings.Join(querys, " and "))
|
|
} else {
|
|
} else {
|
|
if spqp.BuySubject == 1 {
|
|
if spqp.BuySubject == 1 {
|
|
//企业主体是企业的个人查询
|
|
//企业主体是企业的个人查询
|