1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 17:56:20 +00:00

Tag colors (server)

This commit is contained in:
jendib
2013-08-07 23:45:47 +02:00
parent 1deda6e993
commit b2ab313d11
12 changed files with 90 additions and 13 deletions

View File

@@ -82,7 +82,7 @@ public class TagDao {
@SuppressWarnings("unchecked")
public List<TagDto> getByDocumentId(String documentId) {
EntityManager em = ThreadLocalContext.get().getEntityManager();
StringBuilder sb = new StringBuilder("select t.TAG_ID_C, t.TAG_NAME_C from T_DOCUMENT_TAG dt ");
StringBuilder sb = new StringBuilder("select t.TAG_ID_C, t.TAG_NAME_C, t.TAG_COLOR_C from T_DOCUMENT_TAG dt ");
sb.append(" join T_TAG t on t.TAG_ID_C = dt.DOT_IDTAG_C ");
sb.append(" where dt.DOT_IDDOCUMENT_C = :documentId and t.TAG_DELETEDATE_D is null ");
sb.append(" order by t.TAG_NAME_C ");
@@ -99,6 +99,7 @@ public class TagDao {
TagDto tagDto = new TagDto();
tagDto.setId((String) o[i++]);
tagDto.setName((String) o[i++]);
tagDto.setColor((String) o[i++]);
tagDtoList.add(tagDto);
}
return tagDtoList;
@@ -112,7 +113,7 @@ public class TagDao {
@SuppressWarnings("unchecked")
public List<TagStatDto> getStats(String userId) {
EntityManager em = ThreadLocalContext.get().getEntityManager();
StringBuilder sb = new StringBuilder("select t.TAG_ID_C, t.TAG_NAME_C, count(d.DOC_ID_C) ");
StringBuilder sb = new StringBuilder("select t.TAG_ID_C, t.TAG_NAME_C, t.TAG_COLOR_C, count(d.DOC_ID_C) ");
sb.append(" from T_TAG t ");
sb.append(" left join T_DOCUMENT_TAG dt on t.TAG_ID_C = dt.DOT_IDTAG_C ");
sb.append(" left join T_DOCUMENT d on d.DOC_ID_C = dt.DOT_IDDOCUMENT_C and d.DOC_DELETEDATE_D is null and d.DOC_IDUSER_C = :userId ");
@@ -132,6 +133,7 @@ public class TagDao {
TagStatDto tagDto = new TagStatDto();
tagDto.setId((String) o[i++]);
tagDto.setName((String) o[i++]);
tagDto.setColor((String) o[i++]);
tagDto.setCount(((Number) o[i++]).intValue());
tagStatDtoList.add(tagDto);
}

View File

@@ -18,6 +18,11 @@ public class TagDto {
* Name.
*/
private String name;
/**
* Color.
*/
private String color;
/**
* Getter of id.
@@ -54,4 +59,22 @@ public class TagDto {
public void setName(String name) {
this.name = name;
}
/**
* Getter of color.
*
* @return the color
*/
public String getColor() {
return color;
}
/**
* Setter of color.
*
* @param color color
*/
public void setColor(String color) {
this.color = color;
}
}

View File

@@ -47,6 +47,12 @@ public class Tag {
*/
@Column(name = "TAG_DELETEDATE_D")
private Date deleteDate;
/**
* Tag name.
*/
@Column(name = "TAG_COLOR_C", nullable = false, length = 6)
private String color;
/**
* Getter of id.
@@ -119,6 +125,24 @@ public class Tag {
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* Getter of color.
*
* @return the color
*/
public String getColor() {
return color;
}
/**
* Setter of color.
*
* @param color color
*/
public void setColor(String color) {
this.color = color;
}
/**
* Getter of deleteDate.

View File

@@ -1 +1 @@
db.version=1
db.version=2

View File

@@ -0,0 +1,3 @@
alter table T_TAG add column TAG_COLOR_C varchar(6) not null;
update T_TAG set TAG_COLOR_C = '3a87ad';
update T_CONFIG set CFG_VALUE_C='2' where CFG_ID_C='DB_VERSION';