mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 17:56:20 +00:00
Search on tags (server)
This commit is contained in:
@@ -112,6 +112,9 @@ public class DocumentDao {
|
||||
|
||||
StringBuilder sb = new StringBuilder("select d.DOC_ID_C c0, d.DOC_TITLE_C c1, d.DOC_DESCRIPTION_C c2, d.DOC_CREATEDATE_D c3");
|
||||
sb.append(" from T_DOCUMENT d ");
|
||||
if (criteria.getTagIdList() != null && !criteria.getTagIdList().isEmpty()) {
|
||||
sb.append(" left join T_DOCUMENT_TAG dt on dt.DOT_IDDOCUMENT_C = d.DOC_ID_C ");
|
||||
}
|
||||
|
||||
// Adds search criteria
|
||||
List<String> criteriaList = new ArrayList<String>();
|
||||
@@ -132,6 +135,10 @@ public class DocumentDao {
|
||||
criteriaList.add("d.DOC_CREATEDATE_D <= :createDateMax");
|
||||
parameterMap.put("createDateMax", criteria.getCreateDateMax());
|
||||
}
|
||||
if (criteria.getTagIdList() != null && !criteria.getTagIdList().isEmpty()) {
|
||||
criteriaList.add("dt.DOT_IDTAG_C in :tagIdList");
|
||||
parameterMap.put("tagIdList", criteria.getTagIdList());
|
||||
}
|
||||
|
||||
criteriaList.add("d.DOC_DELETEDATE_D is null");
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sismics.docs.core.dao.jpa.criteria;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,11 @@ public class DocumentCriteria {
|
||||
*/
|
||||
private Date createDateMax;
|
||||
|
||||
/**
|
||||
* Tag IDs.
|
||||
*/
|
||||
private List<String> tagIdList;
|
||||
|
||||
/**
|
||||
* Getter of userId.
|
||||
*
|
||||
@@ -100,4 +106,22 @@ public class DocumentCriteria {
|
||||
public void setCreateDateMax(Date createDateMax) {
|
||||
this.createDateMax = createDateMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of tagIdList.
|
||||
*
|
||||
* @return the tagIdList
|
||||
*/
|
||||
public List<String> getTagIdList() {
|
||||
return tagIdList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of tagIdList.
|
||||
*
|
||||
* @param tagIdList tagIdList
|
||||
*/
|
||||
public void setTagIdList(List<String> tagIdList) {
|
||||
this.tagIdList = tagIdList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
|
||||
hibernate.connection.url=jdbc:hsqldb:mem:d<EFBFBD>s
|
||||
hibernate.connection.url=jdbc:hsqldb:mem:docs
|
||||
hibernate.connection.username=sa
|
||||
hibernate.connection.password=
|
||||
hibernate.hbm2ddl.auto=none
|
||||
|
||||
Reference in New Issue
Block a user