basic structure
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package de.jottyfan.camporganizer.module.common;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class IndexController {
|
||||
private static final Logger LOGGER = LogManager.getLogger(IndexController.class);
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@GetMapping("/")
|
||||
public String index() {
|
||||
if (request == null) {
|
||||
LOGGER.error("request is null");
|
||||
}
|
||||
return "/";
|
||||
}
|
||||
|
||||
@GetMapping("/logout")
|
||||
public String getLogout(HttpServletRequest request) throws ServletException {
|
||||
request.logout();
|
||||
return "redirect:/";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package de.jottyfan.camporganizer.module.common;
|
||||
|
||||
import static de.jottyfan.camporganizer.db.jooq.Tables.V_CAMP;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Repository
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public class IndexGateway {
|
||||
private static final Logger LOGGER = LogManager.getLogger(IndexGateway.class);
|
||||
|
||||
@Autowired
|
||||
private DSLContext jooq;
|
||||
|
||||
public Stream<VCampRecord> getAllCamps() {
|
||||
SelectWhereStep<VCampRecord> sql = jooq.selectFrom(V_CAMP);
|
||||
LOGGER.debug(sql.toString());
|
||||
return sql.fetchStream();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user