Add tags filter to ORM.getMediaFilesWhere
This commit is contained in:
parent
99c883dbe5
commit
710083131a
@ -410,6 +410,16 @@ public class ORM {
|
|||||||
query.append("mf.file_hash = ?"
|
query.append("mf.file_hash = ?"
|
||||||
sqlParams << params.fileHash }
|
sqlParams << params.fileHash }
|
||||||
|
|
||||||
|
if (params.tags) {
|
||||||
|
String L = "mft${idx}":
|
||||||
|
String T = "t${idx}":
|
||||||
|
tags.eachWithIndex { tag, idx ->
|
||||||
|
query.append(" JOIN media_files_tags $L ON ")
|
||||||
|
.append(" $L.media_file_id = md.id ")
|
||||||
|
.append(" JOIN tags $L.tag_id = $T.id AND $T.name = ?")
|
||||||
|
|
||||||
|
sqlParams << tag } }
|
||||||
|
|
||||||
if (whereClauses)
|
if (whereClauses)
|
||||||
query.append(" WHERE ").append(whereClauses.join(" AND ")
|
query.append(" WHERE ").append(whereClauses.join(" AND ")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user