|
@@ -499,7 +499,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
|
|
|
if spqp.IsEnt {
|
|
|
var staffs []string
|
|
|
- userStr += fmt.Sprintf(" and a.entid='%s' and a.source = 2 ", spqp.EntId)
|
|
|
+ userStr += fmt.Sprintf(" and a.entid='%s' ", spqp.EntId)
|
|
|
|
|
|
//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
|
|
|
userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
|
|
@@ -521,8 +521,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
staffs = append(staffs, common.InterfaceToStr(v.Id))
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if len(staffs) == 0 {
|
|
|
+ } else {
|
|
|
log.Printf("部门管理员为获取到部门员工:%s", spqp.EntUserId)
|
|
|
result = []*bxsubscribe.SubscribeInfo{}
|
|
|
return
|
|
@@ -535,12 +534,12 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
if spqp.IsRead == "" && len(staffs) == 0 {
|
|
|
//查询数量(需要去重)
|
|
|
//if len(querys) > 1 {
|
|
|
- countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr)
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s and a.source = 2", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr)
|
|
|
//} else {
|
|
|
// countSql = fmt.Sprintf("select count(1) from %s a WHERE 1=1 %s ", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
|
|
|
//}
|
|
|
//列表查询
|
|
|
- findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s order by a.date desc,a.id desc",
|
|
|
+ findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,b.isvalidfile as attachment_count from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where %s %s and a.source = 2 order by a.date desc,a.id desc",
|
|
|
aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.Join(querys, " and "), userStr)
|
|
|
} else {
|
|
|
//查询分配人员或是否已读
|
|
@@ -556,7 +555,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
}
|
|
|
}
|
|
|
//if len(querys) > 1 {
|
|
|
- countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where source=2 %s and %s and ((%s) or EXISTS (SELECT 1 from %s c STRAIGHT_JOIN %s b ON c.infoid = b.infoid %s WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, strings.Join(querys, " and "), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
|
+ countSql = fmt.Sprintf("select count(1) from %s a STRAIGHT_JOIN %s b ON a.infoid = b.infoid %s where a.source=2 %s and %s and ((%s) or EXISTS (SELECT 1 from %s c STRAIGHT_JOIN %s b ON c.infoid = b.infoid %s WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, strings.Join(querys, " and "), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
|
//} else {
|
|
|
// countSql = fmt.Sprintf("select count(1) from %s a WHERE a.source=2 %s and ((%s) or EXISTS (SELECT 1 from %s c WHERE c.source=3 %s and a.id=pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.ReplaceAll(staffQuery, "a.", "c."))
|
|
|
//}
|