added download option, see #1
This commit is contained in:
@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'de.jottyfan.bico'
|
||||
version = '0.0.8'
|
||||
version = '0.0.9'
|
||||
|
||||
description = """BibleClassOrganizer"""
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package de.jottyfan.bico.modules.download;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class DownloadController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private DownloadService service;
|
||||
|
||||
@GetMapping(value = "/download", produces = "text/csv")
|
||||
@ResponseBody
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public String download() {
|
||||
return service.getCsv();
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package de.jottyfan.bico.modules.download;
|
||||
|
||||
import static de.jottyfan.bico.db.Tables.V_CALENDAR;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.SelectWhereStep;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.jottyfan.bico.db.tables.records.VCalendarRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
public class DownloadRepository {
|
||||
private static final Logger LOGGER = LogManager.getLogger(DownloadRepository.class);
|
||||
|
||||
@Autowired
|
||||
private DSLContext jooq;
|
||||
|
||||
public String getCsv() {
|
||||
SelectWhereStep<VCalendarRecord> sql = jooq.selectFrom(V_CALENDAR);
|
||||
LOGGER.trace(sql);
|
||||
return sql.fetch().formatCSV();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package de.jottyfan.bico.modules.download;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class DownloadService {
|
||||
|
||||
@Autowired
|
||||
private DownloadRepository repository;
|
||||
|
||||
public String getCsv() {
|
||||
return repository.getCsv();
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@
|
||||
<ul class="navbar-nav mb-2 mb-lg-0" th:if="${hasBUrole}">
|
||||
<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/}" style="margin-left: 12px">Einteilung</a></li>
|
||||
<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/subject/list}" style="margin-left: 12px">Themen</a></li>
|
||||
<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/download}" style="margin-left: 12px">Download</a></li>
|
||||
</ul>
|
||||
<ul layout:fragment="header"></ul>
|
||||
<ul class="nav navbar-nav ms-auto">
|
||||
|
Reference in New Issue
Block a user