enhanced favorites
This commit is contained in:
@@ -24,11 +24,13 @@ import org.jooq.DeleteConditionStep;
|
||||
import org.jooq.InsertOnDuplicateStep;
|
||||
import org.jooq.InsertReturningStep;
|
||||
import org.jooq.InsertValuesStep7;
|
||||
import org.jooq.Record5;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record6;
|
||||
import org.jooq.Record7;
|
||||
import org.jooq.Record8;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.SelectConditionStep;
|
||||
import org.jooq.SelectHavingStep;
|
||||
import org.jooq.SelectLimitPercentStep;
|
||||
import org.jooq.UpdateConditionStep;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
@@ -493,31 +495,39 @@ public class DoneGateway {
|
||||
}
|
||||
|
||||
public List<FavoriteBean> getFavorites(Integer login) {
|
||||
SelectConditionStep<Record5<Integer, String, String, String, String>> sql = getJooq()
|
||||
Name COUNT = DSL.name("cnt");
|
||||
SelectHavingStep<Record6<Integer, String, String, String, String, Integer>> sql = getJooq()
|
||||
// @formatter:off
|
||||
.select(T_FAVORITE.PK_FAVORITE,
|
||||
V_PROJECT.NAME,
|
||||
V_MODULE.NAME,
|
||||
V_JOB.NAME,
|
||||
V_BILLING.NAME)
|
||||
V_BILLING.NAME,
|
||||
DSL.count(T_DONE.PK).as(COUNT))
|
||||
.from(T_FAVORITE)
|
||||
.leftJoin(V_PROJECT).on(V_PROJECT.PK.eq(T_FAVORITE.FK_PROJECT))
|
||||
.leftJoin(V_MODULE).on(V_MODULE.PK.eq(T_FAVORITE.FK_MODULE))
|
||||
.leftJoin(V_JOB).on(V_JOB.PK.eq(T_FAVORITE.FK_JOB))
|
||||
.leftJoin(V_BILLING).on(V_BILLING.PK.eq(T_FAVORITE.FK_BILLING))
|
||||
.where(T_FAVORITE.FK_LOGIN.eq(login));
|
||||
.leftJoin(T_DONE).on(T_DONE.FK_PROJECT.eq(T_FAVORITE.FK_PROJECT))
|
||||
.and(T_DONE.FK_MODULE.eq(T_FAVORITE.FK_MODULE))
|
||||
.and(T_DONE.FK_JOB.eq(T_FAVORITE.FK_JOB))
|
||||
.where(T_FAVORITE.FK_LOGIN.eq(login))
|
||||
.groupBy(T_FAVORITE.PK_FAVORITE, V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, V_BILLING.NAME);
|
||||
// @formatter:on
|
||||
LOGGER.trace(sql);
|
||||
List<FavoriteBean> list = new ArrayList<>();
|
||||
for (Record5<Integer, String, String, String, String> r : sql.fetch()) {
|
||||
for (Record6<Integer, String, String, String, String, Integer> r : sql.fetch()) {
|
||||
FavoriteBean bean = new FavoriteBean();
|
||||
bean.setFkFavorite(r.get(T_FAVORITE.PK_FAVORITE));
|
||||
bean.setProject(r.get(V_PROJECT.NAME));
|
||||
bean.setModule(r.get(V_MODULE.NAME));
|
||||
bean.setJob(r.get(V_JOB.NAME));
|
||||
bean.setBilling(r.get(V_BILLING.NAME));
|
||||
bean.setLoad(r.get(COUNT, Integer.class));
|
||||
list.add(bean);
|
||||
}
|
||||
list.sort((o1, o2) -> o1 != null && o1.getModule() != null && o2 != null ? o1.getModule().compareTo(o2.getModule()) : 0);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import java.io.Serializable;
|
||||
*
|
||||
*/
|
||||
public class FavoriteBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
private Integer fkFavorite;
|
||||
private String project;
|
||||
private String module;
|
||||
private String job;
|
||||
private String billing;
|
||||
private Integer load;
|
||||
|
||||
/**
|
||||
* @return the project
|
||||
@@ -85,4 +86,18 @@ public class FavoriteBean implements Serializable {
|
||||
public void setFkFavorite(Integer fkFavorite) {
|
||||
this.fkFavorite = fkFavorite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the load
|
||||
*/
|
||||
public Integer getLoad() {
|
||||
return load;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param load the load to set
|
||||
*/
|
||||
public void setLoad(Integer load) {
|
||||
this.load = load;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,12 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li th:each="f : ${favorites}">
|
||||
<a class="dropdown-item" th:href="@{/done/usefav/{id}(id=${f.fkFavorite})}">
|
||||
<span th:text="${f.project} + ' ' + ${f.module} + ' ' + ${f.job}"></span>
|
||||
<span class="row" style="min-width: 512px">
|
||||
<span class="col-1" th:text="${f.load}"></span>
|
||||
<span class="col-2" th:text="${f.project}"></span>
|
||||
<span class="col-3" th:text="${f.module}"></span>
|
||||
<span class="col-6" th:text="${f.job}"></span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
|
||||
<title>Timetrack</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/5.3.3/css/bootstrap.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/datatables/2.1.8/css/dataTables.dataTables.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/font-awesome/6.7.2/css/all.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/fullcalendar/6.1.9/main.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/5.3.8/css/bootstrap.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/datatables/2.3.2/css/dataTables.dataTables.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/font-awesome/7.0.1/css/all.min.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/webjars/fullcalendar/6.1.10/main.css}" />
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}">
|
||||
<link rel="stylesheet" type="text/css" th:href="@{/public/dynamicstyle.css}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" th:href="@{/png/favicon/favicon-32x32.png}" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" th:href="@{/png/favicon/favicon-16x16.png}" />
|
||||
|
||||
<script th:src="@{/webjars/jquery/3.7.1/jquery.min.js}"></script>
|
||||
<script th:src="@{/webjars/bootstrap/5.3.3/js/bootstrap.bundle.min.js}"></script>
|
||||
<script th:src="@{/webjars/datatables/2.1.8/js/dataTables.dataTables.min.js}"></script>
|
||||
<script th:src="@{/webjars/fullcalendar/6.1.9/main.js}"></script>
|
||||
<script th:src="@{/webjars/bootstrap/5.3.8/js/bootstrap.bundle.min.js}"></script>
|
||||
<script th:src="@{/webjars/datatables/2.3.2/js/dataTables.dataTables.min.js}"></script>
|
||||
<script th:src="@{/webjars/fullcalendar/6.1.10/main.js}"></script>
|
||||
<script th:src="@{/js/helper.js}"></script>
|
||||
<script th:src="@{/js/clock.js}"></script>
|
||||
<script th:src="@{/js/schedule.js}"></script>
|
||||
|
||||
Reference in New Issue
Block a user