var count int = 0
if err := db.Table("ats").Joins(" LEFT JOIN read_states ON ats.id = read_states.target_id ").Where("ats.tenant_id = ? and ats.object_id = ? and ats.object_type = ? AND read_states.status = 'unread'", tenantId, uid, common.EMPLOYEE).Count(&count).Error; err != nil {
common.Log.Error("查询出错 %v", err)
return 0, err
}
return count, nil