mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-23 09:22:18 +00:00
This commit is contained in:
parent
50034400ee
commit
cd251ea387
@ -977,7 +977,7 @@ public interface CollectionDAO {
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT json FROM thread_entity <condition> AND "
|
||||
+ "JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) "
|
||||
+ "JSON_OVERLAPS(json_extract(taskAssignees, '$[*].id'), :userTeamJsonMysql) "
|
||||
+ "ORDER BY createdAt DESC "
|
||||
+ "LIMIT :limit",
|
||||
connectionType = MYSQL)
|
||||
@ -995,7 +995,7 @@ public interface CollectionDAO {
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT count(id) FROM thread_entity <condition> AND "
|
||||
+ "JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) ",
|
||||
+ "JSON_OVERLAPS(json_extract(taskAssignees, '$[*].id'), :userTeamJsonMysql) ",
|
||||
connectionType = MYSQL)
|
||||
int listCountTasksAssignedTo(
|
||||
@BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres,
|
||||
@ -1012,7 +1012,7 @@ public interface CollectionDAO {
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT json FROM thread_entity <condition> "
|
||||
+ "AND (JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username) "
|
||||
+ "AND (JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username) "
|
||||
+ "ORDER BY createdAt DESC "
|
||||
+ "LIMIT :limit",
|
||||
connectionType = MYSQL)
|
||||
@ -1031,7 +1031,7 @@ public interface CollectionDAO {
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT count(id) FROM thread_entity <condition> "
|
||||
+ "AND (JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username) ",
|
||||
+ "AND (JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username) ",
|
||||
connectionType = MYSQL)
|
||||
int listCountTasksOfUser(
|
||||
@BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres,
|
||||
@ -1210,8 +1210,8 @@ public interface CollectionDAO {
|
||||
+ "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) "
|
||||
+ " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) OR "
|
||||
+ "(JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username)"
|
||||
+ "GROUP BY te.type, te.taskStatus",
|
||||
+ "(JSON_OVERLAPS(JSON_EXTRACT(taskAssignees, '$[*].id'), :userTeamJsonMysql) OR createdBy = :username)"
|
||||
+ " GROUP BY te.type, te.taskStatus",
|
||||
connectionType = MYSQL)
|
||||
@RegisterRowMapper(OwnerCountFieldMapper.class)
|
||||
List<List<String>> listCountByOwner(
|
||||
|
@ -965,12 +965,9 @@ public class FeedRepository {
|
||||
}
|
||||
|
||||
private String getUserTeamJsonMysql(UUID userId, List<String> teamIds) {
|
||||
// Build a string like this for the tasks filter
|
||||
// [{"id":"9e78b924-b75c-4141-9845-1b3eb81fdc1b","type":"team"},{"id":"fe21e1ba-ce00-49fa-8b62-3c9a6669a11b","type":"user"}]
|
||||
List<String> result = new ArrayList<>();
|
||||
JSONObject json = getUserTeamJson(userId, "user");
|
||||
result.add(json.toString());
|
||||
teamIds.forEach(id -> result.add(getUserTeamJson(id, "team").toString()));
|
||||
result.add("\"" + userId.toString() + "\"");
|
||||
teamIds.forEach(id -> result.add("\"" + id + "\""));
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user