better fav support
This commit is contained in:
@@ -7,7 +7,7 @@ plugins {
|
|||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
|
||||||
group = 'de.jottyfan'
|
group = 'de.jottyfan'
|
||||||
version = '1.5.8'
|
version = '1.5.9'
|
||||||
|
|
||||||
description = """timetrack"""
|
description = """timetrack"""
|
||||||
|
|
||||||
|
|||||||
@@ -195,6 +195,13 @@ public class DoneController extends CommonController {
|
|||||||
return "redirect:/done/list";
|
return "redirect:/done/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RolesAllowed("timetrack_user")
|
||||||
|
@GetMapping(value = "/done/unfavorize_by_id/{id}")
|
||||||
|
public String unfavorizeById(@PathVariable("id") Integer id) {
|
||||||
|
doneService.unfavorizeById(id);
|
||||||
|
return "redirect:/done/list";
|
||||||
|
}
|
||||||
|
|
||||||
@RolesAllowed("timetrack_user")
|
@RolesAllowed("timetrack_user")
|
||||||
@GetMapping(value = "/done/usefav/{id}")
|
@GetMapping(value = "/done/usefav/{id}")
|
||||||
public String usefavorite(@PathVariable("id") Integer id) {
|
public String usefavorite(@PathVariable("id") Integer id) {
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import org.jooq.Record7;
|
|||||||
import org.jooq.Record8;
|
import org.jooq.Record8;
|
||||||
import org.jooq.Result;
|
import org.jooq.Result;
|
||||||
import org.jooq.SelectConditionStep;
|
import org.jooq.SelectConditionStep;
|
||||||
import org.jooq.SelectHavingStep;
|
|
||||||
import org.jooq.SelectLimitPercentStep;
|
import org.jooq.SelectLimitPercentStep;
|
||||||
|
import org.jooq.SelectSeekStep4;
|
||||||
import org.jooq.UpdateConditionStep;
|
import org.jooq.UpdateConditionStep;
|
||||||
import org.jooq.exception.DataAccessException;
|
import org.jooq.exception.DataAccessException;
|
||||||
import org.jooq.impl.DSL;
|
import org.jooq.impl.DSL;
|
||||||
@@ -494,9 +494,19 @@ public class DoneGateway {
|
|||||||
sql.execute();
|
sql.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unfavorizeById(Integer id) {
|
||||||
|
DeleteConditionStep<TFavoriteRecord> sql = getJooq()
|
||||||
|
// @formatter:off
|
||||||
|
.deleteFrom(T_FAVORITE)
|
||||||
|
.where(T_FAVORITE.PK_FAVORITE.eq(id));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql);
|
||||||
|
sql.execute();
|
||||||
|
}
|
||||||
|
|
||||||
public List<FavoriteBean> getFavorites(Integer login) {
|
public List<FavoriteBean> getFavorites(Integer login) {
|
||||||
Name COUNT = DSL.name("cnt");
|
Name COUNT = DSL.name("cnt");
|
||||||
SelectHavingStep<Record6<Integer, String, String, String, String, Integer>> sql = getJooq()
|
SelectSeekStep4<Record6<Integer, String, String, String, String, Integer>, String, String, String, String> sql = getJooq()
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
.select(T_FAVORITE.PK_FAVORITE,
|
.select(T_FAVORITE.PK_FAVORITE,
|
||||||
V_PROJECT.NAME,
|
V_PROJECT.NAME,
|
||||||
@@ -513,7 +523,8 @@ public class DoneGateway {
|
|||||||
.and(T_DONE.FK_MODULE.eq(T_FAVORITE.FK_MODULE))
|
.and(T_DONE.FK_MODULE.eq(T_FAVORITE.FK_MODULE))
|
||||||
.and(T_DONE.FK_JOB.eq(T_FAVORITE.FK_JOB))
|
.and(T_DONE.FK_JOB.eq(T_FAVORITE.FK_JOB))
|
||||||
.where(T_FAVORITE.FK_LOGIN.eq(login))
|
.where(T_FAVORITE.FK_LOGIN.eq(login))
|
||||||
.groupBy(T_FAVORITE.PK_FAVORITE, V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, V_BILLING.NAME);
|
.groupBy(T_FAVORITE.PK_FAVORITE, V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, V_BILLING.NAME)
|
||||||
|
.orderBy(V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, V_BILLING.NAME);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
LOGGER.trace(sql);
|
LOGGER.trace(sql);
|
||||||
List<FavoriteBean> list = new ArrayList<>();
|
List<FavoriteBean> list = new ArrayList<>();
|
||||||
@@ -527,7 +538,6 @@ public class DoneGateway {
|
|||||||
bean.setLoad(r.get(COUNT, Integer.class));
|
bean.setLoad(r.get(COUNT, Integer.class));
|
||||||
list.add(bean);
|
list.add(bean);
|
||||||
}
|
}
|
||||||
list.sort((o1, o2) -> o1 != null && o1.getModule() != null && o2 != null ? o1.getModule().compareTo(o2.getModule()) : 0);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,13 @@ public class DoneService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unfavorizeById(Integer id) {
|
||||||
|
try {
|
||||||
|
new DoneGateway(dsl).unfavorizeById(id);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<FavoriteBean> getFavorites(String username) {
|
public List<FavoriteBean> getFavorites(String username) {
|
||||||
try {
|
try {
|
||||||
DoneGateway gw = new DoneGateway(dsl);
|
DoneGateway gw = new DoneGateway(dsl);
|
||||||
|
|||||||
@@ -100,14 +100,17 @@
|
|||||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Favoriten</button>
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Favoriten</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li th:each="f : ${favorites}">
|
<li th:each="f : ${favorites}">
|
||||||
<a class="dropdown-item" th:href="@{/done/usefav/{id}(id=${f.fkFavorite})}">
|
<table>
|
||||||
<span class="row" style="min-width: 512px">
|
<tr><td><a class="text-danger" th:href="@{/done/unfavorize_by_id/{id}(id=${f.fkFavorite})}"><i class="fa fa-trash"></i></a></td>
|
||||||
|
<td><a class="dropdown-item" th:href="@{/done/usefav/{id}(id=${f.fkFavorite})}">
|
||||||
|
<span class="row" style="min-width: 640px">
|
||||||
<span class="col-1" th:text="${f.load}"></span>
|
<span class="col-1" th:text="${f.load}"></span>
|
||||||
<span class="col-2" th:text="${f.project}"></span>
|
<span class="col-2" th:text="${f.project}"></span>
|
||||||
<span class="col-3" th:text="${f.module}"></span>
|
<span class="col-3" th:text="${f.module}"></span>
|
||||||
<span class="col-6" th:text="${f.job}"></span>
|
<span class="col-6" th:text="${f.job}"></span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a></td></tr>
|
||||||
|
</table>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user